Question 1
4
5
6
7

The IIT Madras BS Programming in C (Programming in C) End Term paper sat on 10 May 2026, in the January 2026 term: 23 questions for 95 marks in 180 minutes. Every question is below with its answer. Take it as a timed mock test to be marked, or read it through first.
4
5
6
7
Correct answer
6
8
4
5
6
Correct answer
6
Consider the following C program:
What will be the output?
50
10
Garbage value
Compilation error
Correct answer
10
Consider the code:
What will be the value of c?
14
12
17
19
Correct answer
12
What is the correct way to access a structure member using a pointer to a structure?
Correct answer
We want to dynamically allocate memory at runtime for 10 integer elements and store the returned address in a pointer. Which of the following statements is correct?
Correct answer
Concatenates two tokens
Compares two tokens
Excludes a token
Multiplies two tokens
Correct answer
Concatenates two tokens
Consider the following C program:
What will be the output?
15
10
5
Garbage value
Correct answer
5
Correct answer
Consider the following code:
What will be the output?
Correct answer
What will be the output of the given code?
1 3 4 5
0 3 3 4
0 1 2 3
0 3 4 5
Correct answer
0 3 4 5
(A figure from the original paper is missing from the source site.)
Correct answer
Correct answer
Consider the C program below.
What will be the output of the above C program?
63
45
27
14
Correct answer
27
Consider the following C program:
Which of the following statements are correct?
Correct answers
Which of the following statements about arrays in C are correct?
Array elements are stored in contiguous memory locations.
Array size can be changed after declaration.
The array name acts like a pointer to the first element in most expressions.
Arrays can store elements of different data types.
Array indexing starts from 0.
Correct answers
Array elements are stored in contiguous memory locations.
The array name acts like a pointer to the first element in most expressions.
Array indexing starts from 0.
All members share the same memory location
Each member has its own separate memory
Only one member can hold a valid value at a time
Correct answers
All members share the same memory location
Only one member can hold a valid value at a time
Which of the following file modes delete the existing content of a file when opened?
"w"
"w+"
"r+"
"a"
Correct answers
"w"
"w+"
Consider the following computation steps:
1. R[0] = 2 2. R[1] = 3 3. R[1] = R[1] + R[0] 4. R[0] = R[0] + 1 5. If R[0] ≤ 5 go to step-3, otherwise, go to step-6 6. R[2] = R[1]
What is the final value of R[2] at the end of computation?
Correct answer: 17
Consider the following C program:
What will be the output printed on the screen?
Correct answer: 24
Consider the following C program:
What will be the output printed on the screen?
Correct answer: 30
Consider the following C code:
What will be the output?
Correct answer: 18
Consider the following C code snippet. What will be the output?
Correct answer: 7