TCS Programming Questions | TCS MCQs for Practice

TCS Programming Questions | TCS MCQs for Practice

TCS Programming Questions | TCS MCQs for Practice

TCS programming multiple-choice questions (MCQs) are an essential part of the latest TCS recruitment drive. Practicing these MCQs will help candidates prepare effectively for the exam.


TCS Programming Section – Overview

The TCS programming section consists of 10 MCQs, with a time duration of 20 minutes. This means candidates must answer each question in approximately 2 minutes.

Syllabus Breakdown:

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, user-defined functions.

Algorithms:

  • Basic search and sorting algorithms (tree traversal, dynamic programming, etc.)

Data Structures:

  • Array, Stack, Queue, Linked List, Trees, Hash Tables.

TCS Programming Questions – Question Types

TCS has officially released the types of questions expected in the programming MCQs section:

  • Identifying the functionality of a given C/pseudo-code.
  • Finding syntactic/semantic bugs in the code.
  • Conceptual programming questions.
  • Elementary algorithm-based questions.
  • Data structure-based questions.
  • Basics of C language.
  • Fundamentals of compiling, linking, and OS concepts.

TCS Programming Questions with Answers

1) Dynamic Programming – Knapsack Problem

Question: Eesha found a treasure trove with 7 items of varying values (in lakhs) and weights (in kgs). She can only carry 10 kgs. Using dynamic programming, what is the maximum value she can carry?

Answer: 25 lakhs


2) Default Return Type in C

Question: In C language, if a function’s return type is not explicitly defined, what data type does it default to?

Answer: int


3) Command-Line Arguments Syntax

Question: Which of the following is the correct syntax for command-line arguments?

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

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


4) Stack Operations

Question: Which operations are allowed on a stack?

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

Answer: a) Push, pop


5) Realloc() Function

Question: What is the purpose of the realloc() function?

a) Retrieve previously released memory.
b) Reallocate a file pointer.
c) Change the size of an array.
d) Change the size of dynamically allocated memory.

Answer: d) Change the size of dynamically allocated memory.


6) Invalid Data Type in C

Question: Which of the following is NOT a data type in C?

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

Answer: b) Big int


7) Best Data Structure for Image Viewer

Question: Eesha wants to develop an image viewer application that allows users to navigate forward and backward. Which data structure is best suited?

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

Answer: c) Linked List


8) Bubble Sort Output

Given an array [64, 34, 25, 12, 22, 11, 9], what will be the array after one pass of Bubble Sort?

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: b) 25 12 22 11 9 34 64


9) #define Usage

Question: What is #define used for in C?

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

Answer: b) Defining a macro


10) Queue Data Structure

Question: What type of data structure is a queue?

a) First-In-Last-Out
b) First-In-First-Out
c) Last-In-First-Out
d) Last-In-Last-Out

Answer: b) First-In-First-Out (FIFO)


11) Invalid Storage Class in C

Question: Which of the following is NOT a valid storage class in C?

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

Answer: b) Dynamic


12) Undo Feature in Text Editor

Question: Eesha is developing a text editor with an undo feature. Which data structure should she use?

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

Answer: a) Stack


Conclusion

Preparing for TCS programming questions is crucial for acing the recruitment process. The 2019 TCS Programming MCQs covered key topics like Data Structures, Algorithms, C, Java, and problem-solving skills, making it essential for candidates to practice thoroughly. By solving previous years’ questions and understanding the concepts behind them, aspirants can improve their coding proficiency and boost their chances of success in TCS placement exams.

TCS Programming Questions | TCS MCQs for Practice