
Programming in C End Term: 31 August 2025, Set QDB3 (May 2025 term)
The IIT Madras BS Programming in C (Programming in C) End Term paper sat on 31 Aug 2025, in the May 2025 term, set QDB3: 24 questions for 100 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.
- 24
- 100
- 180 min
- 20
- 4
Show answer
Correct answer
Question 2
To exit the loop entirely and continue with the program statement immediately following the loop.
To restart the loop from the beginning.
To immediately proceed to the next iteration of the loop, skipping any remaining statements in the current iteration.
To execute a block of code only a fixed number of times.
Show answer
Correct answer
To immediately proceed to the next iteration of the loop, skipping any remaining statements in the current iteration.
Question 3
What is a potential risk of a recursive function that is not properly terminated with a base case?
It will cause a compile-time error.
It will always return an incorrect value.
It can lead to a stack overflow, as the function calls consume all available stack memory.
The program will terminate gracefully with a success message.
Show answer
Correct answer
It can lead to a stack overflow, as the function calls consume all available stack memory.
Question 4
What is the fundamental conceptual difference between "pass-by-value" and "pass-by-reference" for function parameters in C?
Pass-by-value is used for primitive types, while pass-by-reference is used for composite types.
In pass-by-value, a function works with a copy of the argument, whereas in pass-by-reference, it works with the original variable via its memory address.
Pass-by-value allows a function to modify the original variable, while pass-by- reference protects the original variable from modification.
The choice between pass-by-value and pass-by-reference is made automatically by the compiler based on the variable's type.
Show answer
Correct answer
In pass-by-value, a function works with a copy of the argument, whereas in pass-by-reference, it works with the original variable via its memory address.
Question 5
Show answer
Correct answer
Question 6
10 10
5 10
5 5
10 5
Show answer
Correct answer
10 10
Question 7
Show answer
Correct answer
Question 8
1
2
3
4
Show answer
Correct answer
4
Question 9
11 bytes.
12 bytes.
13 bytes.
14 bytes.
Show answer
Correct answer
12 bytes.
Question 10
{0, 0, 100, 0, 0, 0}
{100, 100, 100, 100, 100, 100}
{100, 0, 0, 0, 0, 0}
{0, 100, 0, 0, 0, 0}
Show answer
Correct answer
{0, 0, 100, 0, 0, 0}
Question 11
Show answer
Correct answer
Question 12
Show answer
Correct answer
Question 13
RED = 0, GREEN = 3, BLUE = 1
RED = 1, GREEN = 3, BLUE = 4
RED = 0, GREEN = 3, BLUE = 4
RED = 1, GREEN = 3, BLUE = 2
Show answer
Correct answer
RED = 0, GREEN = 3, BLUE = 4
Question 14
In C programming, which memory region is typically used for dynamic memory allocation?
Heap memory
Stack memory
Static memory
Code segment
Show answer
Correct answer
Heap memory
Question 15
Show answer
Correct answer
Question 16
Show answer
Correct answer
Question 17
When a macro is used in a C program, at what stage is its definition replaced into the code?
Show answer
Correct answer
Question 18
Consider the below C program:
What will be the output of the given C program?
16
10
7
12
Show answer
Correct answer
7
Question 19
(0,0), (0,2), (1,1), (1,3), (2,2), (2,3)
(0,0), (0,2), (0,3), (1,1), (2,2)
(0,0), (0,2), (1,1), (1,3), (2,2)
(0,1), (0,3), (1,1), (1,3), (2,2), (2,3)
Show answer
Correct answer
(0,0), (0,2), (1,1), (1,3), (2,2)
Question 20
Consider the following C code:
What is the output of the program?
5
101
10
111
Show answer
Correct answer
101
Question 21
Show answer
Correct answer: 19
Question 22
Show answer
Correct answer: 2
Question 23
Consider the following C code:
What will be the output of the given program?
Show answer
Correct answer: 9
Question 24
Show answer
Correct answer: 60