uiz Space

May 2026 term · Programming in C · BSCS3005

Programming in C Quiz 1: 19 July 2026 (May 2026 term)

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.

Questions
17
Marks
50
Duration
120 min
MCQ
9
Numerical
5
MSQ
3

Updated

Official paper: Programming in C 16 Jul 26 · No negative marking.

Question 1

+2 marksOne correct option

Which of the following best characterizes the C programming language?

  1. A

    High-level, object-oriented, interpreted

  2. B

    High-level, unstructured, compiled

  3. C

    Mid-level, structured, compiled

  4. D

    Low-level, procedural, interpreted

Show answer

Correct answer

  • C

    Mid-level, structured, compiled

Question 2

+2 marksOne correct option

What is the decimal equivalent of the hexadecimal number 3D?

  1. A

    51

  2. B

    63

  3. C

    61

  4. D

    77

Show answer

Correct answer

  • C

    61

Question 3

+2 marksOne correct option

What is the range of integer values that can be represented by an 8-bit signed integer using two's complement convention?

  1. A

    -127 to +127

  2. B

    -128 to +127

  3. C

    -255 to +255

  4. D

    0 to 255

Show answer

Correct answer

  • B

    -128 to +127

Question 4

+2 marksOne correct option

What is the purpose of the Program Counter (PC) in a CPU?

  1. A

    It performs arithmetic and logic operations.

  2. B

    It holds the address of the next instruction to be executed.

  3. C

    It stores temporary data for quick access.

  4. D

    It coordinates the flow of data between the CPU and memory.

Show answer

Correct answer

  • B

    It holds the address of the next instruction to be executed.

Question 5

+4 marksOne correct option

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?

  1. A

    (x - y) * (x - y - 1)

  2. B

    (x - y) * (2x - y)

  3. C

    (x - y) * (x - 2y)

  4. D

    (x - y) * (x - y)

Show answer

Correct answer

  • D

    (x - y) * (x - y)

Question 6

+4 marksOne correct option

What will be the output of the following code?

  1. A

    011334

  2. B

    0134

  3. C

    012123234

  4. D

    0112334

Show answer

Correct answer

  • A

    011334

Question 7

+4 marksOne correct option

What will be the output of the following code?

  1. A

    1 2 3 4 5 6 7 8 9

  2. B

    1 2 7 8

  3. C

    1 2 3 7 8

  4. D

    1 2 3 7 8 9

Show answer

Correct answer

  • B

    1 2 7 8

Question 8

+3 marksOne correct option

Trace the computation of the following C program fragment:

What are the final values of a, b, and c?

  1. A

    a = 1, b = 18, c = 24

  2. B

    a = 7, b = 15, c = 21

  3. C

    a = 10, b = 18, c = 24

  4. D

    a = 8, b = 15, c = 22

Show answer

Correct answer

  • A

    a = 1, b = 18, c = 24

Question 9

+3 marksOne correct option

Consider the following C code.

What will be the output?

  1. A

    5

  2. B

    12

  3. C

    9

  4. D

    10

Show answer

Correct answer

  • C

    9

Question 10

+3 marksNumerical answer

Consider the nested ternary expression:

What is the value of b after execution?

Show answer

Correct answer: 20

Question 11

+3 marksNumerical answer

What will be the output of the following code?

Show answer

Correct answer: 43

Question 12

+2 marksNumerical answer

What is the value of the integer variable result after executing the following C statement?

Show answer

Correct answer: 14

Question 13

+3 marksOne or more correct options

Which of the following CANNOT be used as valid variable names in C?

Select all that apply.

  1. A

    total_marks

  2. B

    1st_score

  3. C

    _final_value

  4. D

    if

  5. E

    price$

Show answer

Correct answers

  • B

    1st_score

  • D

    if

  • E

    price$

Question 14

+3 marksOne or more correct options

Which of the following statements about C's logical operators '&&' (AND) and '||' (OR) are correct, specifically regarding their short-circuit behavior?

Select all that apply.

  1. A

    The expression (A && B) always evaluates B if A is true.

  2. B

    The expression (A || B) always evaluates B if A is true.

  3. C

    If the first operand of '&&' is false, the second operand is not evaluated.

  4. D

    If the first operand of '||' is true, the second operand is not evaluated.

Show answer

Correct answers

  • A

    The expression (A && B) always evaluates B if A is true.

  • C

    If the first operand of '&&' is false, the second operand is not evaluated.

  • D

    If the first operand of '||' is true, the second operand is not evaluated.

Question 15

+2 marksOne or more correct options

Consider the following C program:

Which of the following statements about the output are true?

Select all that apply.

  1. A

    If the input is x = 5, y = 6, the output is R

  2. B

    If the input is x = -1, y = 15, the output is V

  3. C

    If the input is x = 0, y = 12, the output is U

  4. D

    If the input is x = 1, y = 7, the output is R

  5. E

    If the input is x = 0, y = 5, the output is U

Show answer

Correct answers

  • A

    If the input is x = 5, y = 6, the output is R

  • B

    If the input is x = -1, y = 15, the output is V

  • E

    If the input is x = 0, y = 5, the output is U

Question 16

+4 marksNumerical answer

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?

Show answer

Correct answer: 8

Question 17

+4 marksNumerical answer

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?

Show answer

Correct answer: 21