TCS NQT Programming Logic Questions
TCS NQT Programming Logic Questions
In this article, we will be discussing some of the TCS NQT programming logic
questions and answers asked in the previous recruitment tests.
Q1. There are two integer numbers X and Y that are between 0 to 25. The user stores the
value under a 5-bit number. How many minimum bits are required to store the result of the
below expression?
Res=3*(X-Y)
A.8
Explore 'TCS'
B.5
Articles
C.7
(https://www.faceprep.in/tcs#articles)
D.8
Explanation: If we perform X-Y the possible answers shall be from -75 to 75. In order to
store this, we need 8 bits.
https://www.faceprep.in/tcs/tcs-nqt-programming-logic-questions/ 1/9
7/16/2021 TCS NQT Programming Logic Questions
Postfix Expression: +11/^^-20*5 20 15 6Login 5
Link copied to clipboard. (https://www.faceprep.in/login/?rurl=/tcs/tcs-nqt-programming-logic-questions/)
Answer: Option D
Q3. Write the name of a library of functions that is used to perform arithmetic operations on
BigInteger and BigDecimal.
(https://www.faceprep.in/tcs-nqt-cracker/?
aff_id=418&utm_source=Sidebar_Ads&utm_medium
Answer: import java.math.*;
Explanation: java.math consists of all the required functions related to BigInteger and
BigDecimal.
Q4. Consider the following tree. What will be the preorder traversal?
A. D H E B I F G C A
B. D H E B A F I G C
C. A B D E H C F I G
D. H I D E F G B C A
Answer: Option C
Explanation: In preorder traversal, we have to visit the root first and then left, and finally
right.
(https://www.faceprep.in/tcs-nqt-cracker/?
aff_id=418&utm_source=Article&utm_medium=Article_Ads&utm_campaign=TCS_NQT_Crc&utm_content=TCS_NQT_Crc)
https://www.faceprep.in/tcs/tcs-nqt-programming-logic-questions/ 2/9
7/16/2021 TCS NQT Programming Logic Questions
A.no parameters Login (https://www.faceprep.in/login/?rurl=/tcs/tcs-nqt-programming-logic-questions/)
Sign Up
Link copied to clipboard.
Explore Share away!
(https://www.faceprep.in/) Dismiss
(https://www.faceprep.in/signup/?rurl=/tcs/tcs-nqt-programming-logic-questions/)
B.stdin
C.stdout
D.stderr
Answer: Option B
Explanation: In order to clear the input stream buffer we have to pass stdin to flush.
Q6. What is the name of the method that examines a particular data entity and determines
what data elements need to be associated?
A. Entity-relationship diagram
B. Logic Data modeling
C. Customer Entities
D. Functional Primitive
Answer: Option A
Explanation: An ER diagram shows the relationship among entity sets. An entity set is a
group of similar entities and these entities can have attributes. In terms of DBMS, an entity
is a table or attribute of a table in the database, so by showing the relationship among
tables and their attributes, ER diagram shows the complete logical structure of a database.
void msg()
System.out.Println(‘Num: num++);}
tw.msg()
Answer: Num: 30
Explanation: We are creating the object for the class Inner that is present inside the class
Main. num is initialized to 30 and it is static. When the function msg() invokes it will print
the value as 30 and then it will be updated as 31 since it uses a post-increment operator.
A. : :
B. []
C. ()
D. +
Answer: Option A
https://www.faceprep.in/tcs/tcs-nqt-programming-logic-questions/ 3/9
7/16/2021 TCS NQT Programming Logic Questions
Explanation: Scope resolution operator(::) Login helps us in accessing the global variable,
(https://www.faceprep.in/login/?rurl=/tcs/tcs-nqt-programming-logic-questions/)
Sign Up
Link copied to clipboard.
Explore Share away! Dismiss
accessing function outside(https://www.faceprep.in/)
the class, access the namespace and so on. This operator can
(https://www.faceprep.in/signup/?rurl=/tcs/tcs-nqt-programming-logic-questions/)
never be overloaded.
Q9.Which data structure is used to convert an expression from one form to another form?
A. Graph
B. Stack
C. LinkedList
D. Queue
Answer: Option B
Explanation: In order to convert an Infix expression to postfix or vice versa we need to use
a stack for the same.
Q10. Which of the following options best suits for ‘Memory Leak Occurred’
Answer: Option C
Q11. Select the best suitable answer for the below functions.
sizeof()
strlen
Answer: Option A
Explanation: sizeof() always gives the total size of any datatype allocated by the compiler.
Where the strlen() gives the length of the string i.e number of characters in a string.
Q12. In a Singly Circular Linked List, how many address fields are there?
https://www.faceprep.in/tcs/tcs-nqt-programming-logic-questions/ 4/9
7/16/2021 TCS NQT Programming Logic Questions
B. 2+1
C. 1
D. 2
Answer: Option C
Explanation: Always a singly linked list will have a data field and an address field. The last
node of the linked list will be pointing the head if it is a circular linked list else it will be
pointing to null.
D. extract the physical requirements of the users and convert them to software
Answer: Option D
Explanation: System designers are intended to create software based on the requirements
of their clients. They need to extract the physical requirements of the users and convert
them to software.
Q14. _______ is a process to identify the key aspects of an entity and hiding the rest.
A. Encapsulation
B. Inheritance
C. Abstraction
D. Polymorphism
Answer: Option C
Explanation: Abstraction is hiding the implementation and showing the functionality alone.
Whereas Encapsulation binds the variables data and code acting o data to one single unit.
A. Star-topology
B. Circuit-topology
C. Ring-topology
D. Bus-topology
Answer: Option B
https://www.faceprep.in/tcs/tcs-nqt-programming-logic-questions/ 5/9
7/16/2021 TCS NQT Programming Logic Questions
(https://bit.ly/32vSVOf)
A. 5
B. Compile-time error
C. 0
D. 25
Answer: Option C
Explanation: The statement that was used is nothing but a ternary or conditional operator.
A. Differ by 10
B. Same
C. Differ by 20
D. Differ due to left and right precedence
Answer: Option B
Explanation:
m*n + p/d = 10*35 + 5/6 = 350 + 0 = 350
A. Insertion of the node is done from the end and deletion from the end
B. Insertion of the node is done from beginning and deletion from end
C. Insertion of the node is done from beginning and deletion from beginning
D. Insertion of the node is done from end and deletion from beginning
Answer: Option C
https://www.faceprep.in/tcs/tcs-nqt-programming-logic-questions/ 6/9
7/16/2021 TCS NQT Programming Logic Questions
Index 1
Math functions in C language
Index 2
Output in float data type
A ceil(3.6) 1 32.000000
B floor(3.6) 2 3.000000
C pow(2,5) 3 12.000000
D abs(-12) 4 25.000000
5 4.000000
6 0.000000
Q20. The kind of software testing you can do when you have both the source code and the
executable code in hand, is called as?
Answer: Option C
Explanation: White Box Testing is a software testing technique in which internal structure,
design, and coding of software are tested to verify the flow of input-output and to improve
design, usability, and security. In white-box testing, code is visible to testers so it is also
called Clear box testing, Open box testing, Transparent box testing, Code-based testing,
and Glass box testing.
Do watch the video below for more TCS NQT Programming Logic Questions.
https://www.faceprep.in/tcs/tcs-nqt-programming-logic-questions/ 7/9
7/16/2021 TCS NQT Programming Logic Questions
Suggested Articles:
Tcs (Https://Www.Faceprep.In/Tcs)
(https://www.faceprep.in/)
https://www.faceprep.in/tcs/tcs-nqt-programming-logic-questions/ 8/9
7/16/2021 TCS NQT Programming Logic Questions
Accenture Cocubes Articles
Login (https://www.faceprep.in/login/?rurl=/tcs/tcs-nqt-programming-logic-questions/)
Sign Up
Link copied to clipboard.
Explore Share away!
(https://www.faceprep.in/) Dismiss
(https://www.faceprep.in/accenture/) (https://www.faceprep.in/cocubes- (https://www.faceprep.in/articles/)
(https://www.faceprep.in/signup/?rurl=/tcs/tcs-nqt-programming-logic-questions/)
Tech Mahindra Mindtree Tests (https://www.faceprep.in/tests/)
exam/)
(https://www.faceprep.in/tech- (https://www.faceprep.in/mindtree/)
Videos
mahindra/)
SUBJECTS (https://www.faceprep.in/videos/)
Webinars
Quantitative Aptitude Python (https://www.faceprep.in/webinars/)
(https://www.faceprep.in/quantitative-(https://www.faceprep.in/python/)
Java (https://www.faceprep.in/java/) C (https://www.faceprep.in/c/)
aptitude/)
Data Structures Algorithms
(https://www.faceprep.in/data- (https://www.faceprep.in/algorithms/)
Verbal Ability Logical Reasoning
structures/)
(https://www.faceprep.in/verbal- (https://www.faceprep.in/logical-
ability/) reasoning/)
https://www.faceprep.in/tcs/tcs-nqt-programming-logic-questions/ 9/9