TCS NQT 2020 Official Mock Test Fully Solved | Programming and Coding Section

[Applause] hello everyone welcome to talent battle as TCS nqt test date is approaching faster and faster all you students sure might be a bit nervous regarding your last-minute revisions to help you out TCS itself has given out a mock test for all the students to practice and prepare for the actual nqt test on the 3rd and the 4th of August I have also added the link in the description box below to check it out in this video we will be solving questions in the programming concepts and coding section from this mock test by TCS but before that don't forget to subscribe to our Channel and hit the bell icon for dates as we will be uploading more and more videos regarding campus related placements to help you get placed in your dream companies let's begin this is a coding question it is write a program as per the below specifications the conditions are accepts 1 integer number which will be a two-digit number from stdin second is interchange the two digits of this number third is print the resulting number to STD out it can be assumed that the number input value will be such that there will be no zero as any of the two digits other than the calculated numerical output value no other strings or messages should be printed to STD out so let us begin by first understanding the question we need to write a program and we are given with three conditions the first is accepts 1 integer number so this is the regarding the input which we will be providing to the program it would be a two-digit number from stdin okay the second is interchange the two digits of this number so once we give input to this number then the the function which we'll be writing in the program it will interchange the two numbers which we have given and print the output and the third condition they have mentioned is the output should be printed in such a manner that there will be no zeros in the input number and there will be no strings or messages printed to ste out so they want only the interchanged number we printed to STD out so this is how they wanted the input number it will be a two-digit number say x and y XY and the input should be from STD in output interchange the input number so it would be Y X and to STD outlet so let us understand when in a C program dimension STD in it is the standard input stream so we need to use scanf for the input and when they mentioned standard STD out it is the standard output stream so we have to use the printf to write the output now let us begin with the program this is the C code we have written to execute the problem statement okay so the input they want it to be a two digit number okay so we have it has include stdio.h into Maine we have taken a variable integer integer number printf enter a two-digit number okay and we are inputting it using the scanf so let us understand this is an interchange program for a two digit number okay so let us consider we have a number 12 okay well this is the input we have given to this program so the output should be 21 okay so the output should be 21 so in this case we need to see how the number 12 is actually formed so this is nothing but 2 is at the unit's place and 1 is at the tens place okay so if we see the number is formed in a way 1 into 10 plus 2 into 1 this is the tens place 1 and this is the unit's place number 2 so we have multiplied 1 with 10 and 2 with 1 okay if you see what this forms is 10 plus 2 is well similarly to get the output 21 the formation will be to start n plus 1 star 1 equal to 21 right so first we need to get the face value the face value of x and the face value of y correct because initially or like this program will work for any number so we don't know what number we are giving so according to this logic if we move ahead we have declared three variables three integers so firstly to get the tens place digit we will divide the number the input number by ten so whatever will be the quotient will be stored in this integer variable for finding the unit's place menu we get a mod of the input number so whatever is the reminder will be stored in digit two now to form the new integer what we have to do is the unit space number we will take it at the tens place in a bind multiplied by ten the tens place number we will consider it for the unit's place and multiplied by one or no need for that correct and then when we print out it should print the result now let us compile this program okay so these are the compilation results and if we run the program into the two-digit number I enter twelve it gives 21 okay now let us try it with a different number say I enter 98 here is the result 89 so we get the result as as expected the next question in C language we can find the length of a string using which function below are the options so this is not a logical but a fact-based question we can see the options provided can be confusing so to answer such questions you really need to know the names of the functions here for example this is related to the string functions it may happen the question might be updated for example which function in C copies a string to another string so try and go through different functions in C to answer such type of questions well the answer here is option a STR a lien this is the function used in C which can find the length of a string the next question is what is the output of the following code snippet the code snippet is hash include' main and then the function is written in Const a 5 a + + and pin tip if we observe this course snippet the first line itself seems to be erroneous the thing is they have mentioned hash include' and then they have written the main function hash include' expects a library fight after the hash include keyword if we try to compile this program the code snippet which Theseus has given we see the below compilation error it mentions has include expects file name hence among the options the answer is a compile-time error next question which statement is correct about circular linked list the options are a doubly circular linked list is not possible to implement B there is no pointer that points to null C a node can be inserted but cannot be deleted and D can be used to implement undo feature in word processing so first let us understand what is a circular linked list sir to the linked list in C is a linked list in which the last node wants to the head or front node making the data structure look like a circle a circular linked list node can be implemented using sing singly linked on doubly linked list here the first option is doubly circular linked list is not possible to implement which is incorrect because circular linked list can be singly circular on doubly circular linked list second there is no pointer that points to null in a sink in a circular link placed the end node points to the head node or the front node so every node points to some node making a circular list that's why no pointer points to null is correct if we check the other options a node can be inserted but cannot be deleted this is wrong because we can insert as well as we can delete and we can add just the head node as well as the end node so the answer is B there is no pointer that points to null next question which of the below is not a predefined file stream in C language below are the options stderr STI or STD out and ste in if we observe the options below we see STI o stdio is a C standard library header file when we write a C program we include a statement right in the beginning hash include h3 IO dot H so this is the library file and it is not a file stream and instead STD l HTI out in destiny in are all predefined file streams in C language so the answer is B a next question which of the below data types occupies the most amount of memory toxins are double care float and int now double requires eight bytes of memory in C whereas care requires a single byte float requires four bytes and in requires two to four bytes so the answer is a double it requires the highest amount of memory among the four that is eight bytes next question the C built-in function to release dynamic memory is a free B del D allocate C dispose and D release so the correct option here is a free because are the three options the allocate and dispose and release are aren't any functions in C so the correct answer is a free next question sizeof operator is used to get the size of options are a datatype only be program file in memory C available free memory and D data type or variable so the thing is the size of operator returns the size of its operand of the parameter between its brackets it can be applied to any data type as well as a variable so the answer is D data type or variable size of operator cannot be used to check the available free memory in C so C is definitely not an option as well as me next question a Q is what type of a data structure the options are a circular list be first-in first-out C lastin first-out and D sequential axes the answer here is B first-in first-out a C and D are the wrong options time to you from talent battle for watching this video if you liked this video click on the like button and don't forget to subscribe to our YouTube channel as we will be posting more and more campus related updates through our YouTube channel click on the bell icon for notifications related to placement update we would like you to know that we have lost a five days Decius in cutie specific crash course if you have yet not started with your preparation please go through all the details I have also added a link in the description box below all the very best for your TC is in QT exam stay tuned for more updates

24 Replies to “TCS NQT 2020 Official Mock Test Fully Solved | Programming and Coding Section”

  1. Really good job ..but in coding question it clearly shows that no should be 2 digits and non zero instead of only scanf("%d") ,it should be scanf("%2d") that it only take first 2 digit .suppose we wanna take input 36765 bt %2d only take 36 and both digits should be non zero logic is little bit wrong for the particular case .thank you

  2. We have to check for all the numbers can a user if ,
    So what if he gives 4 digit no so we have to first identify that given no. Is 2 digits only or not
    2nd if user give zero in digit then????
    Can't expect such level from you.

  3. hey can you please tell us that in TCS will the coding be as easy as this ?? In some other websites it is being said that this year the coding will be in the form of a story and we have to understand the problem and then do the code. Is it true or the question is gonna be so easy like this.??

Leave a Reply

Your email address will not be published. Required fields are marked *