Beyond the two full programs in the Advanced Coding block, TCS NQT and TCS interviews also test programming fundamentals — pseudo-code reasoning, language basics, and data-structure concepts. This page covers both: quick-fire coding MCQs and practice problems.
Programming fundamentals MCQs
Click an option to check your answer instantly.
Select the correct description of the functions sizeof() and strlen() when applied to a string in C.
Which of the following is NOT a logical operator?
In a singly circular linked list, how many address (pointer) fields does each node have?
Coding practice problems
These problems are from recent TCS NQT drives. Attempt them in your preferred language before revealing the approach.
Luke has a bookshelf with n books, each with a height of ai. He walks from left to right, deciding for each book whether to leave it or place it on a new shelf. Books on the new shelf must be in strictly increasing order of height. Find the maximum number of books Luke can place on the new shelf.
Input: n = 6, heights = [5, 1, 3, 2, 4, 6]
Output: 4
One optimal pick is 1, 3, 4, 6 (or 1, 2, 4, 6).
- 1 ≤ n ≤ 10⁴
- 0 ≤ ai ≤ 10⁸
Given an array of integers, check whether it can be partitioned into two non-empty groups such that their average values are equal. Print true if possible, otherwise false.
Input: arr = [1, 2, 3, 4, 5, 6, 7, 8]
Output: true
[1, 4, 5, 8] and [2, 3, 6, 7] both average 4.5.
- Aim for roughly O(n · S) time and O(S) space, where S is the array sum.
For the full exam-style experience with a timer and hidden test cases, head to the Advanced Coding page and the PYQKart mock tests.



