TCS Coding Questions and Answers for 2024 Batch | TCS NQT Preparation

แชร์
ฝัง
  • เผยแพร่เมื่อ 24 พ.ย. 2024
  • TCS Coding Questions and Answers for 2024 Batch | TCS NQT Preparation
    TCS Crash Course Just @1499 : prepinsta.com/...
    TCS Preparation Course - bit.ly/prime-t...
    Use Coupon Code "TH-cam" to get maximum discount.
    Actual Previous year TCS NQT Coding Questions: prepinsta.com/...
    TCS NQT Coding Playlist : • TCS Ninja Coding Quest...
    Learn Coding with PrepInsta Top 100 codes - prepinsta.com/...
    For Updates on Placements Join :
    1. Instagram - prepinsta.com/...
    2. Whatsapp - prepinsta.com/...
    3. Telegram - prepinsta.com/...
    4. LinkedIn - / prepinsta
    5. Discord - prepinsta.com/...
    Follow our Mentors -
    1.Atulya Kaushik - / atulya.kaushik
    2. Manish Agarwal - / manish.agarwal01

ความคิดเห็น • 49

  • @PrepInsta
    @PrepInsta  10 หลายเดือนก่อน

    Launching TCS Crash Course, Checkout the registration link in the description!

  • @killerkinggg9048
    @killerkinggg9048 10 หลายเดือนก่อน +4

    import java.util.Scanner;
    public class Base17 {
    public static void main(String[] args) {
    Scanner s =new Scanner(System.in);
    String in=s.next();
    System.out.println(Integer.parseInt(in,17));
    }
    }

  • @Ashbluff1
    @Ashbluff1 11 หลายเดือนก่อน +1

    def convert(input):
    ans=0
    for i in range(len(input)):
    if input[i] == 'A':
    k = 10
    elif input[i] == 'B':
    k = 11
    elif input[i] == 'C':
    k = 12
    elif input[i] == 'D':
    k = 13
    elif input[i] == 'E':
    k = 14
    elif input[i] == 'F':
    k = 15
    elif input[i] == 'G':
    k = 16
    else:
    k = int(input[i])
    ans += k * (17 ** (len(input) - 1 - i))
    return ans
    input = input()
    print("Decimal number: ",convert(input))

  • @appurb2001
    @appurb2001 11 หลายเดือนก่อน +1

    def base17_decimal(num):
    dict1 = {'a': 10, 'b': 11, 'c': 12, 'd': 13, 'e': 14, 'f': 15, 'g': 16}
    num = num.lower()
    res = 0

    for i, digit in enumerate(reversed(num)):
    if digit.isdigit():
    decimal_digit = int(digit)
    else:
    decimal_digit = dict1[digit]
    res += decimal_digit * (17 ** i)
    return res

  • @shreyaghosh1489
    @shreyaghosh1489 11 หลายเดือนก่อน

    Solution for 2nd question in python
    st=input()
    d={'A':10,'B':11,'C':12,'D':13,'E':14,'F':15,'G':16}
    i=len(st)-1
    s=0
    p=0
    while(i>=0):
    if st[i].isdigit():
    s=s+int(st[i])*(pow(17,p))
    else:
    s=s+(d[st[i]]*pow(17,p))
    i=i-1
    p=p+1
    print(s)

  • @lakshmikiranmai7317
    @lakshmikiranmai7317 11 หลายเดือนก่อน +2

    Hello Prepinsta:
    Giveaway question answer: (PYTHON)
    n= str(input())
    print(int(n,17))

  • @MuthuAnushya
    @MuthuAnushya 11 หลายเดือนก่อน +2

    Hello sir the first problem is geekforgeeks problem sir today i saw that and try to solve sum of subarray awesome explanation sir..

    • @PrepInsta
      @PrepInsta  11 หลายเดือนก่อน +1

      Hey there❤️, Kindly message us at 8448440710 Whatsapp number, our mentors will guide you further precisely with the details.

    • @taufiqattar1756
      @taufiqattar1756 11 หลายเดือนก่อน

      ​@@PrepInstayou replied all comments but not on my comment of solution code 😂

  • @anyanu7475
    @anyanu7475 11 หลายเดือนก่อน

    #include
    using namespace std;
    int main(){
    string t;
    cin>>t;
    int power=0, val=0, temp=0;
    for(int i=t.size()-1; i>=0; i--){
    if(t[i]-'0' < 10) temp = t[i]-'0';
    else temp = t[i]-'A'+10;
    val += temp*pow(17, power);
    power++;
    }
    cout

  • @prasannakumari-d2t
    @prasannakumari-d2t 11 หลายเดือนก่อน +6

    Hi sir..nice explanation sir.. please do more coding questions videos for tcs nqt preparation sir..

    • @PrepInsta
      @PrepInsta  11 หลายเดือนก่อน

      Thanks for commenting❤️, Sure we will be coming up with more videos like this, till then kindly refer this link prepinsta.com/tcs-nqt/placement-papers/

    • @roushankumar2250
      @roushankumar2250 11 หลายเดือนก่อน

      Can u share the WhatsApp group link for 24 batch as the link given in the description doesn't work ​@@PrepInsta

  • @rohankarmakar1761
    @rohankarmakar1761 11 หลายเดือนก่อน +1

    my approach in cpp
    #include
    using namespace std;
    int main()
    {
    int s=15;
    int arr[10]={5,3,7,14,18,1,18,4,3,8};
    for(int i=0; i

    • @mohitdulani9144
      @mohitdulani9144 10 หลายเดือนก่อน

      not correct approach

  • @arunchandrahalemani7951
    @arunchandrahalemani7951 10 หลายเดือนก่อน

    Solution for giveaway with very easy to understand code using dictionary:
    # creating the mapping using dictionary
    base17 = {
    '0' : 0,
    '1' : 1,
    '2' : 2,
    '3' : 3,
    '4' : 4,
    '5' : 5,
    '6' : 6,
    '7' : 7,
    '8' : 8,
    '9' : 9,
    'A' : 10,
    'B' : 11,
    'C' : 12,
    'D' : 13,
    'E' : 14,
    'F' : 15,
    'G' : 16
    }
    number = input("Enter the base 17 value: ")

    last_index = len(number)-1
    result = 0
    power = 0
    while last_index >= 0:
    result = result + (base17[number[last_index]] * pow(17,power))
    power += 1
    last_index -= 1
    print(result)

  • @jessyjasmitha5666
    @jessyjasmitha5666 11 หลายเดือนก่อน +2

    CODE IN PYTHON
    def base17_to_decimal(input_str):
    base17_digits = '0123456789ABCDEFG'
    input_str = input_str[::-1] # Reverse the input string for easier processing
    decimal_value = 0
    for i in range(len(input_str)):
    decimal_value += base17_digits.index(input_str[i]) * (17 ** i)
    return decimal_value
    # Test cases
    input_1 = input()
    output_1 = base17_to_decimal(input_1)
    print(f"Case 1 - Input: {input_1}, Output: {output_1}")
    input_2 = input()
    output_2 = base17_to_decimal(input_2)
    print(f"Case 2 - Input: {input_2}, Output: {output_2}")

  • @gaurang7goel
    @gaurang7goel 11 หลายเดือนก่อน

    C++ solution:
    #include
    #include
    #include
    using namespace std;
    int base17ToDecimal(const string& input) {
    int decimalValue = 0;
    int power = 0;
    for (int i = input.length() - 1; i >= 0; --i) {
    char currentChar = toupper(input[i]);
    int digitValue;
    if (isdigit(currentChar)) {
    digitValue = currentChar - '0';
    } else {
    digitValue = currentChar - 'A' + 10;
    }
    decimalValue += digitValue * pow(17, power);
    ++power;
    }
    return decimalValue;
    }
    int main() {
    string input;
    cout > input;
    int result = base17ToDecimal(input);
    cout

  • @kunalghosh4785
    @kunalghosh4785 11 หลายเดือนก่อน

    #include
    using namespace std;
    int main()
    {
    string s;
    cin>>s;
    int n = s.size();
    unordered_map arr;
    for(int i=0; i

  • @dibabosuchatterjee1497
    @dibabosuchatterjee1497 10 หลายเดือนก่อน +3

    The most important thing is: PYTHON COMPILER FOR TCS NQT IS NOT UPTO THE MARK. I mean it always shows compilation error. NOW IT'S YOUR CHOICE....

  • @vamsiBheemireddy
    @vamsiBheemireddy 11 หลายเดือนก่อน

    #include
    using namespace std;
    int output(int number,int c,int len)
    {
    int r=17,count=0;
    int val=0;
    val+=number*pow(r,c);
    return val;
    }
    int main()
    {
    string s;
    cin>>s;
    int len=s.length()-1;
    int result=0,out;
    for(int i=s.length()-1;i>=0;i--)
    {
    if(s[i]>=48&&s[i]=65&&s[i]

  • @058_shivammishra9
    @058_shivammishra9 11 หลายเดือนก่อน +1

    Hello Prepinsta, Here is my GiveAway Question's Answer code:
    #include
    #include
    #include
    using namespace std;
    int heptaToDecimal(string heptaNumber) {
    int decimalNumber = 0;
    int power = 0;
    for (int i = heptaNumber.length() - 1; i >= 0; i--) {
    if (heptaNumber[i] >= '0' && heptaNumber[i] = 'A' && heptaNumber[i] heptaNumber;
    int decimalNumber = heptaToDecimal(heptaNumber);
    std::cout

  • @kavyametturu6827
    @kavyametturu6827 11 หลายเดือนก่อน

    Sir... Can you please explain all the recent tcs codevita coding question solutions like solo rider, password generator,ware house, pick up service,etc...

    • @PrepInsta
      @PrepInsta  11 หลายเดือนก่อน

      Hey there❤️We will be soon coming with the video for this as well, till then kindly refer this link : prepinsta.com/tcs-codevita/practice-questions-with-answers/

  • @shivanisankar3874
    @shivanisankar3874 11 หลายเดือนก่อน

    Giveaway answer for the code (Python)
    num= str(input())
    print(int(num,17))

  • @DivyanshuGiri-d5d
    @DivyanshuGiri-d5d 11 หลายเดือนก่อน

    give away answer for the code:
    #include
    #include
    using namespace std;
    int main ()
    {
    string num;
    cin >> num;
    int decimalValue = stoi (num, nullptr, 17);
    cout

  • @taufiqattar1756
    @taufiqattar1756 11 หลายเดือนก่อน +1

    Answer for question in cpp
    #include
    #include
    #include
    using namespace std;
    int base17ToDecimal(string input) {
    int decimalValue = 0;
    int power = 0;

    for (int i = input.length() - 1; i >= 0; --i) {
    char currentChar = input[i];
    int digitValue;

    if (isdigit(currentChar)) {
    digitValue = currentChar - '0';
    } else {

    digitValue = currentChar - 'A' + 10;
    }

    decimalValue += digitValue * pow(17, power);
    power++;
    }
    return decimalValue;
    }
    int main() {
    string input;
    cout > input;
    if (input.length()

  • @saumyasrivastava4065
    @saumyasrivastava4065 11 หลายเดือนก่อน

    I created next step portal account in 2022 and also I updated and submitted application form in October 2023, but now when I am applying for TCS NQT off campus application is submitted successfully but in Track my application date of the receiving application form is not getting updated, please provide a solution to it at earliest as my college TPO has given a time limit to fill the google form which needs to be further processed to TCS.
    I have also mailed regarding this to TCS several times but getting no response.

    • @PrepInsta
      @PrepInsta  11 หลายเดือนก่อน

      Thanks for commenting🙌, We recommend you to kindly reach out to your TPO for the details as well as stay updated to your mails and spam folder as well, TCS will guide you further with the updates as you have mailed them.

  • @Noobda69
    @Noobda69 11 หลายเดือนก่อน

    #include
    using namespace std;
    int main(){
    string s;
    cin>>s;
    double ans=0.0;
    int n=0;
    for(int i=s.length()-1;i>=0;i--){
    if(s[i]>='0' && s[i]= 'a' && s[i]

  • @RagulRagul-xb5zu
    @RagulRagul-xb5zu 6 วันที่ผ่านมา

    import java.util.Scanner;
    public class Base17ToDecimal {
    public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);
    System.out.print("Enter base-17 number: ");
    String base17Input = scanner.nextLine();
    try {
    int decimalValue = Integer.parseInt(base17Input, 17);
    System.out.println("Decimal value: " + decimalValue);
    } catch (NumberFormatException e) {
    System.out.println("Invalid base-17 input");
    }
    scanner.close();
    }
    }

  • @amanjaisani3044
    @amanjaisani3044 11 หลายเดือนก่อน

    #include
    using namespace std;
    void todec(string s){
    int n=s.size();
    long long m=0,d;
    for(int i=n-1;i>=0;--i ){
    if(s[i]>57){
    d=s[i]-'A'+10;
    }
    else{
    d=s[i]-48;
    }

    m+=d*pow(17,n-1-i);

    }
    couts;
    todec(s);
    }
    int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    solve();
    return 0;
    }

  • @lakshmi-n2z
    @lakshmi-n2z 11 หลายเดือนก่อน

    Here is my answer to the given question as I am in final year of my Btech prime will be helpful hope I will get access .
    import java.util.Scanner;
    public class Coding{
    public static int convertToDecimal(String input) {
    int decimalValue = 0;
    int power = 0;
    for (int i = input.length() - 1; i >= 0; i--) {
    char digit = input.charAt(i);
    int digitValue;
    if (Character.isDigit(digit)) {
    digitValue = digit - '0';
    } else {
    digitValue = digit - 'A' + 10;
    }
    decimalValue += digitValue * Math.pow(17, power);
    power++;
    }
    return decimalValue;
    }
    public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);
    System.out.print("Enter a base-17 number: ");
    String userInput = scanner.nextLine();
    int decimalResult = convertToDecimal(userInput);
    System.out.println("Decimal equivalent: " + decimalResult);
    }
    }

  • @DivyanshuGiri-d5d
    @DivyanshuGiri-d5d 11 หลายเดือนก่อน

    Give away answer for the code

  • @joydevdafadar5614
    @joydevdafadar5614 11 หลายเดือนก่อน +1

    Giveaway Answer :
    Code using C++
    #include
    #include
    using namespace std;
    int main() {
    string str;
    //Taking input from user
    cin >> str;
    int ans = 0;
    int power = 1;
    for( int i=str.length()-1; i>=0; i-- ) {
    char ch = str[i];
    if( ch-'0' >= 0 && ch-'0' < 10 ){
    // If it is a number 0-9
    ans += (power*(ch-'0'));
    }
    else{
    //If it is a Character A-G
    ans += (power*((ch-'A')+10));
    }
    // Maintaining the power for every reverse iteration
    power *= 17;
    }
    //Printing The answer
    cout

  • @rishijain8472
    @rishijain8472 11 หลายเดือนก่อน +1

    C++ CODE:
    #include
    using namespace std;
    long long power(int x)
    {
    long long res=1;
    for(int i=0;i=65 && ch>s;
    long long res=0;
    reverse(s.begin(),s.end());
    for(int i=0;i

  • @adwaitagarai3923
    @adwaitagarai3923 11 หลายเดือนก่อน

    sweet seventeen ans in c++
    #include
    using namespace std;
    int main() {
    mapmp{
    {'a',10},{'b',11},
    {'c',12},{'d',13},{'e',14},{'f',15},{'g',16},{'h',17},{'i',18},{'j',19},{'k',20},{'l',21},{'m',22},{'n',23},{'o',24},{'p',25},{'q',26},{'r',27},{'s',28},{'t',29},{'u',30},{'v',31},{'w',32},{'x',33},{'y',34},{'z',35}
    };
    string str;
    cout= '0' && str[j]

  • @BornToSHiNe00
    @BornToSHiNe00 11 หลายเดือนก่อน

    class j365 {
    public static int multiply (int n , int value) {
    int ans = 1;
    while (n != 0) {
    ans = value * ans;
    n--;
    }
    return ans;
    }
    public static void main(String[] args) {
    String str = "23GF";
    HashMap map = new HashMap();
    map.put('A' , 10);
    map.put('B', 11);
    map.put('C',12);
    map.put('D',13);
    map.put('E',14);
    map.put('F',15);
    map.put('G',16);
    int n = str.length()-1; // 1
    int sum = 0;
    for (int i=0; i

  • @anmolgulati8186
    @anmolgulati8186 11 หลายเดือนก่อน

    The answer to your questions is below , can i get prepinsta prime now pls , i really need it.
    Thanks
    #include
    #include
    using namespace std;
    int baseToDecimal(const string& input_str, int base) {
    int decimal_value = 0;
    int power = 0;
    for (int i = input_str.size() - 1; i >= 0; --i) {
    char digit = input_str[i];
    int digit_value = 0;
    if (isdigit(digit)) {
    digit_value = digit - '0';
    } else if (isalpha(digit)) {
    digit_value = toupper(digit) - 'A' + 10;
    }
    decimal_value += digit_value * pow(base, power);
    ++power;
    }
    return decimal_value;
    }
    int main() {
    string input_str;
    cin>>input_str;
    int base = 17;
    int output = baseToDecimal(input_str, base);
    cout

  • @rachitbadoni5717
    @rachitbadoni5717 11 หลายเดือนก่อน

    // the code for giveaway question...
    #include
    using namespace std;
    int main()
    {
    int base=17;
    string s;
    cin>>s;
    unordered_mapmp;
    mp['A']=10;
    mp['B']=11;
    mp['C']=12;
    mp['D']=13;
    mp['E']=14;
    mp['F']=15;
    mp['G']=16;
    int ans=0,ctr=0;
    for(int i=s.size()-1;i>=0;i--)
    {
    if(mp.find(s[i])!=mp.end())//present in map
    {
    ans+=mp[s[i]]*pow(17,ctr);
    }
    else
    {
    ans+=(s[i]-'0')*pow(17,ctr);
    }
    ctr++;
    }
    cout