(Most Asked) TCS NQT Coding Questions with Answers (TCS NQT 2020)
HTML-код
- Опубликовано: 11 ноя 2024
- The most asked type TCS NQT Coding Questions asked in TCS NQT 2020 Exam the whole solution is provided for TCS NQT 2020 Coding Questions with Answers.
TCS NQT Preparation Course - bit.ly/prime-t...
Use Coupon Code "RUclips" to get maximum discount.
Check Solutions and more code on - prepinsta.com/...
Imp: Join Whatsapp Notification Group : prepinsta.com/...
Join Telegram Notification channel : prepinsta.com/...
TCS All Coding Questions Playlist - • TCS Coding Questions w...
Video 2 - • TCS Aptitude Questions...
Video 3 - • (Asked 25 times) TCS N...
TCS NQT Online Course - bit.ly/TCS-NQT-and-Ninja-Course
10:40 there is another way sir. We don't need to write all the consonents in condition we can just upgrade the vowel condition as
if(b[j]!='a' || b[j]!='e' || b[j]!='i' || b[j]!='o' || b[j]!='u')
It should be "&&" instead of "||"
Use '&&' instead of all the '||'
@@thomaspgeorge4339 but if we use && then all of the given alphabets must be present right?? in order to make it execute
@@santoshgokul3374 i thought so too....but I tried running the program and only this gives the right output
Yeah man you're right I just tried now 😅😅 thanks
Python solution for this problem
a,b,c=input("Enter a string:").split()
d=''
for i in range(0,len(a)):
if a[i] in 'aeiou' :
d=d+'%'
else:
d=d+a[i]
e=''
for i in range(0,len(b)):
if b[i] not in 'aeiou':
e=e+'#'
else:
e=e+b[i]
f=''
for i in range(0,len(c)):
if 96
For making the 3rd word into uppercase, I can also use the string in-built function - strupr(c)
It becomes a lot easier
what about in c++
In easy way if we check b[j]!=a,e,i,o,u.etc in a particular situation
Thanks to MHADEV.. If this is not visible on my recommended videos then I can't found this type of explaination.... So simple and easy way... Thanks to Atulya Sir
In second part one can use:
if(b[j]!='a'&&b[j]!='i'&&b[j]!='o'.......)//vowels with logical and operator
@@jsa155 the question says 3 english words right? So i think we shouldnt worry about numbers.
@@jsa155 alright, agree with you
data = []
result = ''
for i in range(3):
data.append(input("Enter the word
"))
print(data)
for i in data[0]:
if i in ['a','e','i','o','u']:
data[0] = data[0].replace(i,'%')
else:
continue
for i in data[1]:
if i not in ['a','e','i','o','u']:
data[1] = data[1].replace(i,'#')
else:
continue
for i in data[2]:
data[2] = data[2].upper()
for i in data:
result = result + i
print(result)
Join our TA Support Group on Discord, where we will help you out with all your queries:
prepinsta.com/discord/
I am in prepinsta's safe hands
Thanks :) Jatin
😂 still stay carefull
Thanks for explaining...I was looking forward towards these topic😁
Thank you Ashish
You can use toupper() for last case.
yes you can use that as well
@@PrepInsta thank you, sir.
Your concept is really awesome
We can use else in 2 case with vowel condition.. and we can use tolower function for case 3
strupr() or toupper() right?
got placed in tcs because of prepinsta
Thank you apoorva :)
Hey apurva...m preparing for nqt 2020 can you please help me?
@Apoorva Jain
we can concatenate by strcat(a,b,c);
No
Can make it this way I guess
g=strcat(a, b) ;
h=strcat(g, c) ;
then print h
@@mishrithabattiyanda8871 so this means we can only concatenate only two strings at a time?
10:13 .........25 of thm r vwls
for checking of consonant character why should we check by 21 characters , if we can use != condition with vowel so we get same result, am i right?
bytheway very good explanation, Thankyou.
well explanation ...
for NQT 2020...is it compulsory to use command line programming? can't we use simple C or C++....as we are having habits of using them without command line arguments?
you can use simple c or c++
sir in printf statement there is ampersand symbol(&)
Sir we can use scanf() function in exam right??? Or we have to take input through command line arguments??
You can take input either way. Both are acceptable.
Correct me if i am wrong,if we want to concatenate the words i think simply we can write printf("%s%s%s",a,b,c);
Instead of printf("%s %s %s",a,b,c);
yes, you can do that as well :)
printf("%s%s%s",&a,&b,&c); could we use this statement to concatenate the strings?
sir plz make an playlist on tcs ninja coding questions
If you have any question please feel free it ask us in the comment section
Plz provide us a concatenation step to get the desired o/p of this question.
Or can we use strcat(a,strcat(b,c)); statement for concatenation..is this Will be right??
{
char *str1;
char *str2;
str1=strcat(a, b) ;
str2=strcat(str1, c) ;
printf("%s", &str2) ;
return 0;
}
Is it correct, please do reply!!!
#include
Int main( int argc, char **argv)
Char **items;
Int j=argv;
For(i=1;(i%4); i++)
Int **p=&items(j);
Printf("%c", **p);
J--;
Return 0;
Can any one explain this code with example input
Sir in tcs nqt coding section...is it compulsory for us for write the code using cammand line arguments or simply we can input it through scanf..
plz help!!
command line arguments not in syllabus
it will be specified in the given question what to use
For consonants we can have done with for loop of aeiou only by using ! Operator
Hi,
Yes, you can also use that as well :)
Why will i concatenate .......i could just delete the spaces between %s and %s......it would do the work without adding an extra line to the program...... isn't it?
Sir if we use a[i]!='a'||a[i]!='e' instead of writing all the constant letters we can achieve same result
Yes! We can but and operator is used instead of or operator 🙂
No, because if there are any other characters...instead of alphabet then it will accept them too...
Is it mandatory to write code in cmd line arguments??
no you can use C, C++, Java perl and python
16:02 in java we have to just use String.toUpper() method.
and whole string will be converted in to upper case.
in exam can we use pre-define classes and their methods sir??????
or we are not allowed to use them???
please clear my doubt.
Yes most probably yes. I am saying this because I have used string.h C library in other placement tests (never appeared for TCS though)
Better use isupper and other methods of c++
for the 3rd part can't we just use strupr( ) ?
very well explained
Thank you shivangi
on the 1st part where a[i] ='a' was there you said you are not comparing with ascii values but on the upper case part 'a' how this becomes now ascii?
yes , i have same doubt
sir we have to right whole program/code or just have to write only logic or function snippet ?????'
please clear my doubt.
Whole compiled and logical program
Hello sir I have bought your prime course .Was having one query that can we use java for coding questions 1 and 2.
Sir if our syntax are correct but program is not run due toh error so kuch no milenge thode bht??
Sir can you make this video in pass the string from command line argument because we will have to take the input using command line argument so please
can you please let me know how to do concatenation so that we get exact o/p mentioned in the question?
strcat((strcat(a,b)),c);
printf("%s",&a);
After ending of while loop ,write these lines , program will run successfully.
This question concatenation of strings came in InfyTQ exam today
@@dasmala9255 thanks..
we could have used strupr() func instead nah?
Is there any online paid course?
For all basic c language
no there isn't as of yet!
Refering to Books by C.P.Arora and BalaGuruswami and reading the manual in dev C's "help" section, helped me a lot.
Sir in python the word of vowels cannot replace by that symbol
Eg: a[i]='%'
Use escape character
How to use
Example:-- ur string is
s='sandeep'
For I in range (Len(s)):
If(s[I]=='a'):
s.replace(str(s[I]), '@')
You can also append in to list
can we use this to check the consonants :
if(!isalpha(b[i]))
yes you can use that :)
What is this bro?
@@santoshgokul3374 are you preparing for nqt 2021 bro??
@@sahilgaikwad98 yeah man
In constant part why don't we use not equal to instead of printing all 21 alphabet
Getting error 'gets' is invalid
which version of python can be used?2.7 or 3
Python 3 will be there in exam
Why did you consider "e" as a consonant 😁
Can i know the concepts cut off
Video is not cleared properly
Sir, the third word is not converted into Uppercase
Hey, please check the code. That you've written because as per our code it is getting convereted.
We want still more methods on it
Will post them soon
I am from mechanical background . Can u start coding classes from zero . Sir i m not good in coding but ' I WANT ' to be good.
Yes, in our online classes we focus on that itself.
Technique was not good, the b[j] part could be done in short and easy trick...
How to concatanate plz let me know sir
It is your homework its simple and basic just google
@@PrepInsta
strcat((strcat(a,b)),c);
printf("%s",&a);
After ending of while loop ,write these lines , program will run successfully. I think this method is correct. Isn't it?
Just print all together
Scored 1297 in aptitude and 51 in programming. M I qualified?
did u?
If anyone wants to see the code in python:
def splitString(newList):
#Function to convert the string into list form
newA = newList.split(" ")
a = how are you , newA =[ "how" , "are" , "you"]
return newA
def convertString(x):
p = [char for char in x[0]]
# Traversing character by character in 1st word in list i.e "how"
e = ' '
f = ' '
g = ' '
for i in range(0, len(p)):
if p[i] == 'a' or p[i] == 'e' or p[i] == 'i' or p[i] == 'o' or p[i] == 'u':
p[i] = '%'
e += p[i]
q = [char for char in x[1]]
#Traversing character by character in 2nd word in list i.e "are"
for i in range(0, len(q)):
if q[i] != 'a' and q[i] != 'e' and q[i] != 'i' and q[i] != 'o' and q[i] != 'u':
q[i] = '#'
f += q[i]
r = x[2].upper()
#Converting 3rd word into uppercase
g = e + f + r
#Concatenating all the 3 word
return g
a = input("Enter a 3 word String : ")
li = splitString(a)
print(convertString(li))
great :)
bro instead of using C , you should use JAVA its hardly 8 lines of code for the given problem statement.
----------------------------------------------------------------------
public class LogicalQuestion {
public static void main(String[] args) {
// TODO Auto-generated method stub
String word1,word2,word3;
Scanner input = new Scanner(System.in);
word1 = input.next(); // reads only one word
word2 = input.next();
word3 = input.next();
// Replace all vowel to %
word1 = word1.replaceAll("[AEIOUaeiou]", "%");
// Replace all consonants to #
word2 = word2.replaceAll("[BCDFGHJKLMNPQRSTVWXYZbcdfghjklmnpqrstvwxyz]", "#");
// Replace third word to upper case
word3 = word3.toUpperCase();
// at last concatenate all the three words
System.out.println(word1+word2+word3);
}
}
can you please give it in java Language?
prepinsta.com/tcs-coding-questions/ you can find the code here
Sir can I update tcs nqt form after 24 July ??
Yes you can update it before hall ticket generation
Thanks sir
Sir please send me this code in java...please
You can find code in prep insta website
Can I know the aptitude cutoff
70%
2nd part worst explanation bro
The way ur explaining is not satisfying
hlw Atulya sir,.
i used to message you on your whatsapp no. please reply.
Hey,
Atulya sir is on leave till tuesday. I think he will reply onc ehe is back.
Your explanation is just awesome
Good explanation
thank you chandana