TCS Programming Questions 2018 | TCS Programming MCQs

TCS Programming questions (MCQs) are discussed here with solutions. These TCS programming MCQs were asked in the latest TCS drive. So practicing these can help you answer a lot of questions in the TCS drive. Check out latest TCS off campus drive details here.

TCS Programming Questions – Section Details

TCS programming concepts or programming questions section consists of 10 programming MCQs. The time duration of this section is 20 minutes. This means you should answer a question in a maximum of 2 minutes.

The syllabus for this section is as follows.

Programming Concepts:
Iteration, recursion, procedural vs OOp.
C Language: call by value/reference, basic and derived data types, storage class, scope and visibility, basics of pointers, basic header files, library functions, branching and looping, command line arguments, user-defined functions.

Basic search algorithms, basic sort algorithms (tree traversal, dynamic programming, etc)

Data Structures:
Array, Stack, Queue, List  (tree, hash table, etc)

TCS Programming Questions – Question Types

TCS has officially released a list of indicative question types asked in TCS Programming Mcqs section. The following are the expected question types for this section.

  • Given a code in C language/pseudo-code, Identify the functionality of the code.
  • Given a code in C language/pseudo-code, identify the bug (syntactic/ semantic) in the code.
  • Conceptual Questions in programming
  • Elementary algorithms based questions
  • Elementary data structures based questions
  • Questions based on basics of C language
  • Basic Concepts behind compiling, linking, OS

TCS Programming Questions with Answers

1)  Eesha was in a wonderland where she saw a treasure trove of seven items of various items (in lakhs) and weights (in kgs) as per the table given below.



12 4 10 6 8 5 11 7 14 3 5 10 5 12

She wanted to bring back the maximum value of items but she was not able to carry more than 10 kgs. Using dynamic programming, what is the maximum value of the items that she could carry back with her.

Answer: 26

2) In C language, if a function return type is not explicitly defined then it defaults to what data type?

Answer: Int

3) Which of the following syntax is correct for command -line arguments?

a) int main (char *argv[], int argc)
b) none of the three options
c) int main () { int argv, char *argc[]; }
d) int main(int var, char *varg[])

Answer: int main (int var,char *varg[])

4) The full set of operations allowed on a stack are

a) Push, pop
b) Push, pop, remove
c) Push, pop, add, remove
d) Push,pop,add,remove,substitute

Answer: push, pop

5) Realloc () function is used to:

a) Get back the memory that was released earlier using dree() function
b) Reallocate a file pointer when switching between files
c) Change the size of an array
d) Change the size of the dynamically allocated memory

Answer: change the size of dynamically allocated memory

6) Which of the below is NOT a data type in C language:

a) Signed int
b) Big int
c) Short int
d) Long int

Answer: Big int

7) Eesha wants to implement an image viewer application to view images in a given folder. The application will be able to display an image and will also know what its next and previous images are at any given point of time so that the user can so that the user can view next/previous image by pressing right/left keys on the keyboard. Which data structure is appropriate for Esha to use?

a) Tree
b) Queue
c) Linked list
d) Stack

Answer: Linked list

8) The pseudo code below sorts an array using bubble sort. Here A is the array and the” n” is the number of elements in it. Function swap exchanges the value of 2 given value.

tcs programming questions mcqs

This function is called with A and 7 as parameter where the array a initially contains the element 64, 34, 25,12, 22, 11, 9

a) 34 25 12 22 11 9 64
b) 25 12 22 11 9 34 64
c) 11 9 12 22 25 34 64
d) 12 11 9 22 25 34 64

Answer: 25 12 22 11 9 34 64

9) #define is used to

a) Define a variable
b) Define a macro
c) Define a function
d) Define a constant

Answer: Define a macro

10) What type of data structures are queues?

a) First in last out
b) First in first out
c) Last in first out
d) Last in last out

Answer: First in first out

11) Which of the following is NOT a valid storage class in C language?

a) Extern
b) Dynamic
c) Register
d) Auto

Answer: Dynamic

12) Eesha is developing a word processing software in which she wants to provide undo feature. The software will maintain all the sequential changes and at any point of time pressing control z will undo the latest change, what data structure should Eesha use for this?

a) Stack
b) Queue
c) Linked list
d) Array

Answer: Stack

13) #include
Main(int argc,char**argv)
Return 1;

The above program was run with the following command line parameters
Asha usha nisha easha
What was the output?

a) Nisha
b) Unable to run due to compilation error
c) No output,run time error
d) easha

Answer: easha

For more TCS Programming questions – Check here.