TCS Ninja Programming MCQs: 11 Questions with Verified Answers
Practice 11 TCS Ninja NQT programming MCQs covering C language, pointer mechanics, and data structures. All answers re-derived from first principles for 2026.
The TCS Ninja NQT programming section covers C language mechanics, pointer operations, and data structure properties across 10 MCQs in 20 minutes.
TCS Ninja Programming Section: Format and Syllabus
This section is separate from the TCS NQT coding section that comes later in the test. Programming MCQs ask you to read code, trace output, spot bugs, or answer conceptual questions. You do not write code from scratch here.
TCS’s official syllabus for this section lists six question types:
- Identifying the functionality of a given C program or pseudocode
- Finding syntactic or semantic bugs in code
- Conceptual programming questions (storage classes, scope, identifiers)
- Elementary algorithm-based questions (sorting steps, search properties)
- Data structure questions (stack, queue, linked list operations)
- C language fundamentals (pointers, arrays, library functions, memory)
Twenty minutes for 10 questions is tighter than it looks if one question involves a multi-step loop or pointer trace. Reading code fast and accurately matters more than guessing.
This article focuses on Ninja-level questions: basic C mechanics, pointer declarations, and elementary data structure properties. For broader TCS NQT programming patterns including C storage classes, realloc, and Bubble Sort traces, see the companion article on TCS Programming MCQs and the 2026 NQT pattern. For the full TCS Ninja test pattern including section sequence and cutoff context, that article covers the complete picture.
C Language Fundamentals: MCQs 1–4
- Q1. How many times does the inner
printfexecute in the following code?
#include<stdio.h>
int main()
{
int x, y;
for(x=5; x>=1; x--)
{
for(y=1; y<=x; y++)
printf("%d\n", y);
}
}
-
a) 15
-
b) 11
-
c) 10
-
d) 13
-
Answer: a) 15. Trace the outer loop: when x=5, the inner loop runs 5 times; x=4 runs 4 times; x=3 runs 3; x=2 runs 2; x=1 runs 1. Total: 5 + 4 + 3 + 2 + 1 = 15.
-
Q2. Where are local variables stored in C?
- a) Disk
- b) Stack
- c) Heap
- d) Code segment
-
Answer: b) Stack. Local variables are allocated on the call stack when a function is entered and deallocated when the function returns. The heap is for dynamically allocated memory (
malloc/free); the code segment holds compiled instructions.
-
Q3. What will happen if, in a C program, a value is assigned to an array element whose subscript exceeds the declared size of the array?
- a) The element is set to 0.
- b) The compiler reports an error at compile time.
- c) The program may crash if important data gets overwritten.
- d) The array size grows to accommodate the element.
-
Answer: c). Standard C performs no runtime bounds checking. Writing past the array’s end is undefined behavior; if the overwritten region holds a return address or another variable’s value, the program can crash. Some compilers offer sanitizer flags to catch this, but standard C provides no such protection.
-
Q4. Which of the following special symbols is allowed in a C variable name?
- a)
*(asterisk) - b)
|(pipe) - c)
-(hyphen) - d)
_(low-line character)
- a)
-
Answer: d)
_. Valid C identifier characters are letters (a-z, A-Z), digits (0-9), and the_character. Asterisk, pipe, and hyphen are all invalid. Identifiers may not start with a digit.
Pointer and Array Operations: MCQs 5–8
-
Q5. What does the following declaration mean?
int (*ptr)[10];- a)
ptris an array of pointers to 10 integers - b)
ptris a pointer to an array of 10 integers - c)
ptris an array of 10 integers - d)
ptris a pointer to a pointer
- a)
-
Answer: b) ptr is a pointer to an array of 10 integers. The parentheses bind the
*first, makingptra pointer. The type it points to isint [10]. Compare this withint *ptr[10], which is an array of 10 int pointers (no parentheses, so the[10]binds before the*).
-
Q6. In C, if you pass an array as an argument to a function, what actually gets passed?
- a) The value of each element copied into the function
- b) The first element of the array
- c) The base address of the array
- d) The address of the last element
-
Answer: c) The base address of the array. C does not copy array contents when passing to a function. The function receives a pointer to the first element. Changes made to array elements inside the function affect the original array.
-
Q7. For
int arr[10], are the expressionsarrand&arrthe same?- a) Yes
- b) No
-
Answer: b) No.
arrdecays toint *and points to the first element.&arrhas typeint (*)[10]and points to the entire array. Both yield the same numeric address, but they have different types and behave differently in pointer arithmetic. Adding 1 toarradvances bysizeof(int)bytes; adding 1 to&arradvances bysizeof(int[10])bytes.
-
Q8. Which of the following should be used to obtain the remainder after dividing 3.14 by 2.1 in C?
- a)
rem = 3.14 % 2.1; - b)
rem = modf(3.14, 2.1); - c)
rem = fmod(3.14, 2.1); - d) Remainder cannot be obtained in floating-point division.
- a)
-
Answer: c)
rem = fmod(3.14, 2.1);The%operator works only on integers in C.modf()splits a floating-point number into its integer and fractional parts, not a modulo operation.fmod(x, y)computes the floating-point remainder of x divided by y, which is what the question asks.
Data Structures and Search: MCQs 9–11
-
Q9. Improper formation of which data structure can cause unintentional looping of a program that uses it?
- a) Linked list
- b) Array
- c) Queue
- d) Stack
-
Answer: a) Linked list. If a singly linked list is not properly terminated with a
NULLpointer, or if a node’snextfield mistakenly points back to a previous node in the list, traversal will loop indefinitely. Arrays, queues, and stacks have fixed-access patterns that do not produce this class of error.
-
Q10. Which of the following statements is FALSE?
- a) The time complexity of binary search is O(log n).
- b) A linear search requires a sorted list.
- c) A binary search can operate only on a sorted list.
- d) The time complexity of linear search is O(n).
-
Answer: b) A linear search requires a sorted list. Linear search scans every element from start to end; the input does not need to be sorted. Binary search is the algorithm that requires a sorted input. Statements a, c, and d are all correct.
- Q11. What is the output of the following program?
#include<stdio.h>
int main()
{
int a[5] = {5, 1, 15, 20, 25};
int i, j, m;
i = ++a[1];
j = a[1]++;
m = a[i++];
printf("%d, %d, %d", i, j, m);
return 0;
}
-
a) 2, 1, 15
-
b) 1, 2, 5
-
c) 3, 2, 15
-
d) 2, 3, 20
-
Answer: c) 3, 2, 15. Step-by-step trace:
- Initial state: a = 25
i = ++a[1]: pre-increment a[1] from 1 to 2; i takes that new value. Now i = 2, a[1] = 2.j = a[1]++: read a[1] (= 2) into j first (post-increment semantics), then increment a[1]. Now j = 2, a[1] = 3.m = a[i++]: i is 2, so read a[2] (= 15) into m, then increment i. Now m = 15, i = 3.printf: i = 3, j = 2, m = 15. Output: 3, 2, 15.
Programming Score and Your Hiring Track
TCS uses the overall NQT percentile to route candidates into three hiring tracks. The programming MCQ section contributes to that composite score.
| Track | CTC band | NQT context |
|---|---|---|
| TCS Ninja | ₹3.5-3.9 LPA | Baseline NQT; moderate programming accuracy is sufficient |
| TCS Digital | ₹7.0-7.5 LPA | Higher NQT cutoff; stronger programming section helps |
| TCS Prime | ₹9.0-11.0 LPA | Top NQT performance expected; AI skills now required |
The stakes for getting the programming section right have increased. TCS CHRO Sudeep Kunnumal stated at the AI Impact Summit in March 2026 that 60% of TCS’s FY26 fresher hires are AI-skilled, up from 10 to 15% three years ago. The Prime track is now effectively the AI-skilled entry tier; programming fundamentals remain the baseline for Ninja and Digital.
TCS also cut its FY27 fresher intake to around 25,000, down from 44,000 onboarded in FY26. Fewer seats, higher competition. The programming section is not the place to give away easy marks.
For the TCS NQT aptitude section worked questions, the format differs but the same composite-percentile logic applies.
The 11 MCQs above cover the topics TCS tests most consistently at the Ninja level. Once C fundamentals and pointer mechanics are solid, the next gap for Digital or Prime candidates is applied AI project experience. The 2026 AI roadmap for Indian engineering students maps what that preparation looks like inside a placement timeline. TinkerLLM at ₹299 is the hands-on entry point for building and shipping LLM-powered tools.
Primary sources
Frequently asked questions
How many programming MCQs are in the TCS Ninja NQT?
The TCS Ninja NQT programming section has 10 MCQs with a 20-minute time limit, roughly 2 minutes per question.
Is there negative marking in the TCS Ninja programming section?
TCS NQT does not apply negative marking in the programming MCQ section. An incorrect answer scores zero; unattempted questions also score zero.
What C topics does TCS Ninja test in the programming MCQ section?
TCS Ninja tests C language basics including loop traces, pointer declarations, array behavior, and storage classes. Elementary data structure concepts (stack, queue, linked list) and basic search and sort questions also appear regularly.
What is the difference between TCS Ninja and TCS Digital in the programming section?
Both tracks use the same NQT; the difference is the cutoff. Digital requires a higher composite NQT percentile than Ninja. A stronger programming section score lifts the composite and improves the chance of qualifying for Digital.
Does Python knowledge help in TCS Ninja programming MCQs?
The TCS NQT programming section uses C-language code and pseudocode. Python knowledge does not directly apply to reading and tracing C programs. Basic C pointer and array mechanics are what you need for this section.
What happens in C when you access an array element beyond its declared size?
Accessing an array element beyond its declared size in C is undefined behavior. The program may crash if it overwrites critical memory, or it may silently return garbage values. Standard C does not perform runtime bounds checking.
A self-paced playground for building with LLMs.
TinkerLLM is FACE Prep's sister property. A guided environment for shipping real LLM applications, the kind of project that earns a paragraph on your resume, not a line.
Try TinkerLLM (₹299 launch)