Question 1
Which of the following best characterizes the C programming language?
High-level, object-oriented, interpreted
High-level, unstructured, compiled
Mid-level, structured, compiled
Low-level, procedural, interpreted

The IIT Madras BS Programming in C (Programming in C) Quiz 1 paper sat on 19 Jul 2026, in the May 2026 term: 17 questions for 50 marks in 120 minutes. Every question is below with its answer. Take it as a timed mock test to be marked, or read it through first.
Which of the following best characterizes the C programming language?
High-level, object-oriented, interpreted
High-level, unstructured, compiled
Mid-level, structured, compiled
Low-level, procedural, interpreted
Correct answer
Mid-level, structured, compiled
What is the decimal equivalent of the hexadecimal number 3D?
51
63
61
77
Correct answer
61
What is the range of integer values that can be represented by an 8-bit signed integer using two's complement convention?
-127 to +127
-128 to +127
-255 to +255
0 to 255
Correct answer
-128 to +127
What is the purpose of the Program Counter (PC) in a CPU?
It performs arithmetic and logic operations.
It holds the address of the next instruction to be executed.
It stores temporary data for quick access.
It coordinates the flow of data between the CPU and memory.
Correct answer
It holds the address of the next instruction to be executed.
Consider the computations given below using the generalized memory model. M[0] ← x1. M[1] ← y2. M[2] ← M[0] – M[1]3. M[1] ← M[2] * M[1]4. M[0] ← M[2] * M[0]5. M[2] ← M[0] – M[1]6. M[3] ← M[2]7. What is the value of M[3] at the end of the execution?
(x - y) * (x - y - 1)
(x - y) * (2x - y)
(x - y) * (x - 2y)
(x - y) * (x - y)
Correct answer
(x - y) * (x - y)
What will be the output of the following code?
011334
0134
012123234
0112334
Correct answer
011334
What will be the output of the following code?
1 2 3 4 5 6 7 8 9
1 2 7 8
1 2 3 7 8
1 2 3 7 8 9
Correct answer
1 2 7 8
Trace the computation of the following C program fragment:
What are the final values of a, b, and c?
a = 1, b = 18, c = 24
a = 7, b = 15, c = 21
a = 10, b = 18, c = 24
a = 8, b = 15, c = 22
Correct answer
a = 1, b = 18, c = 24
Consider the following C code.
What will be the output?
5
12
9
10
Correct answer
9
Consider the nested ternary expression:
What is the value of b after execution?
Correct answer: 20
What will be the output of the following code?
Correct answer: 43
What is the value of the integer variable result after executing the following C statement?
Correct answer: 14
Which of the following CANNOT be used as valid variable names in C?
total_marks
1st_score
_final_value
if
price$
Correct answers
1st_score
if
price$
Which of the following statements about C's logical operators '&&' (AND) and '||' (OR) are correct, specifically regarding their short-circuit behavior?
The expression (A && B) always evaluates B if A is true.
The expression (A || B) always evaluates B if A is true.
If the first operand of '&&' is false, the second operand is not evaluated.
If the first operand of '||' is true, the second operand is not evaluated.
Correct answers
The expression (A && B) always evaluates B if A is true.
If the first operand of '&&' is false, the second operand is not evaluated.
If the first operand of '||' is true, the second operand is not evaluated.
Consider the following C program:
Which of the following statements about the output are true?
If the input is x = 5, y = 6, the output is R
If the input is x = -1, y = 15, the output is V
If the input is x = 0, y = 12, the output is U
If the input is x = 1, y = 7, the output is R
If the input is x = 0, y = 5, the output is U
Correct answers
If the input is x = 5, y = 6, the output is R
If the input is x = -1, y = 15, the output is V
If the input is x = 0, y = 5, the output is U
Consider the following generalized computation:
Step 1: R0 ← M[0]
Step 2: R1 ← M[1]
Step 3: R3 ← R0 MOD 2
Step 4: IF R3 = 0 THEN GOTO Step 7, Otherwise GOTO Step 5
Step 5: R2 = R0 + R1
Step 6: GOTO Step 8
Step 7: R2 = R0 * R1
Step 8: M[2] ← R2
If M[0] = 5 and M[1] = 3, what is the value of M[2] at the end of the computation?
Correct answer: 8
Consider the following assembly program (anything after ; is a comment).
If initially n=6, what will be the final value stored in R2 at the end of the program?
Correct answer: 21