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

  Рет қаралды 24,674

Prep Insta

Prep Insta

Күн бұрын

Пікірлер: 49
@PrepInsta
@PrepInsta 11 ай бұрын
Launching TCS Crash Course, Checkout the registration link in the description!
@Ashbluff1
@Ashbluff1 11 ай бұрын
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))
@killerkinggg9048
@killerkinggg9048 11 ай бұрын
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)); } }
@lakshmikiranmai7317
@lakshmikiranmai7317 11 ай бұрын
Hello Prepinsta: Giveaway question answer: (PYTHON) n= str(input()) print(int(n,17))
@appurb2001
@appurb2001 11 ай бұрын
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)
@MuthuAnushya
@MuthuAnushya 11 ай бұрын
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 ай бұрын
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 ай бұрын
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
@jessyjasmitha5666
@jessyjasmitha5666 11 ай бұрын
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}")
@rohankarmakar1761
@rohankarmakar1761 11 ай бұрын
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
@dibabosuchatterjee1497
@dibabosuchatterjee1497 11 ай бұрын
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....
@264vsainagaCharitha
@264vsainagaCharitha 11 ай бұрын
🥲
@orlando_kawaii
@orlando_kawaii 10 ай бұрын
So did u do all of those in C++
@dibabosuchatterjee1497
@dibabosuchatterjee1497 10 ай бұрын
@@orlando_kawaii java
@arunchandrahalemani7951
@arunchandrahalemani7951 11 ай бұрын
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)
@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
@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))
@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.
@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 ай бұрын
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
@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 ай бұрын
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()
@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]
@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; }
@DivyanshuGiri-d5d
@DivyanshuGiri-d5d 11 ай бұрын
Give away answer for the code
@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
@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); } }
@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
@joydevdafadar5614
@joydevdafadar5614 11 ай бұрын
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 ай бұрын
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
@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
@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]
@RagulRagul-xb5zu
@RagulRagul-xb5zu 15 күн бұрын
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(); } }
@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
(Most Asked) TCS NQT Coding Questions and Answers 2021
44:05
Prep Insta
Рет қаралды 401 М.
Чистка воды совком от денег
00:32
FD Vasya
Рет қаралды 5 МЛН
А я думаю что за звук такой знакомый? 😂😂😂
00:15
Денис Кукояка
Рет қаралды 6 МЛН
AlgoZenith Premium Teaser | Feel free to compare in comments
1:23
Vivek Gupta
Рет қаралды 2,1 М.
TCS Logical Reasoning Questions and Answers 2024
42:47
Prep Insta
Рет қаралды 24 М.
TCS NQT Coding Questions & Answers 2024| Off Campus Updates
51:43
TCS Ninja Coding Questions 2022
43:50
Prep Insta
Рет қаралды 144 М.
Making an Algorithm Faster
30:08
NeetCodeIO
Рет қаралды 161 М.
Python for Beginners - Learn Coding with Python in 1 Hour
1:00:06
Programming with Mosh
Рет қаралды 19 МЛН
Google Coding Interview With A High School Student
57:24
Clément Mihailescu
Рет қаралды 4,2 МЛН
HackSussex Coders' Cup 2024
2:37:14
HackSussex
Рет қаралды 933 М.
What I Wish I Knew Before Becoming A Software Developer
15:06
Jeremiah Peoples
Рет қаралды 584 М.
Чистка воды совком от денег
00:32
FD Vasya
Рет қаралды 5 МЛН