uiz Space

January 2025 term · Programming in C · BSCS3005

Programming in C Quiz 1: 23 February 2025 (January 2025 term)

The IIT Madras BS Programming in C (Programming in C) Quiz 1 paper sat on 23 Feb 2025, in the January 2025 term: 16 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
16
Marks
50
Duration
120 min
MCQ
11
MSQ
2
Numerical
3

Updated

Official paper: IIT M DEGREE AN EXAM QDB2 23 Feb 2025 · No negative marking.

Question 1

+2 marksOne correct option

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

  1. A

    To store the results of computations

  2. B

    To store the address of the next instruction to execute

  3. C

    To manage input and output operations

  4. D

    To provide temporary data storage

Show answer

Correct answer

  • B

    To store the address of the next instruction to execute

Question 2

+2 marksOne correct option

What is the correct order of memory levels based on size (smallest to largest)?

  1. A

    Cache Memory → Registers → Main Memory → Secondary Memory

  2. B

    Registers → Cache Memory → Main Memory → Secondary Memory

  3. C

    Secondary Memory → Main Memory → Cache Memory → Registers

  4. D

    Main Memory → Cache Memory → Secondary Memory → Registers

Show answer

Correct answer

  • B

    Registers → Cache Memory → Main Memory → Secondary Memory

Question 3

+2 marksOne correct option

Which of the following operators in C have right-to-left associativity?

  1. A
  2. B
  3. C
  4. D
Show answer

Correct answer

  • A

Question 4

+4 marksOne correct option

Consider the generalized computation given below:
1. R[0] ← M[0]
2. R[1] ← M[1]
3. R[2] = R[1] - R[0]
4. If R[2] != 0, set R[1] = R[1] + 2 and go back to step 3. Otherwise, go to step 5.
5. R[2] = R[0] + R[1]
6. M[2] ← R[2]
For which value of M[0] and M[1], the computation will enter into an infinite loop?

  1. A

    M[0] = 5, M[1] = 3

  2. B

    M[0] = 7, M[1] = 3

  3. C

    M[0] = 8, M[1] = 2

  4. D

    M[0] = 10, M[1] = 3

Show answer

Correct answer

  • D

    M[0] = 10, M[1] = 3

Question 5

+4 marksOne correct option
  1. A

    Subtract values from R1 until R2 is zero

  2. B

    Increment R1 by the sum of values from R2 to 1

  3. C

    Multiply R1 by R2

  4. D

    Divide R1 by R2

Show answer

Correct answer

  • B

    Increment R1 by the sum of values from R2 to 1

Question 6

+4 marksOne correct option
  1. A

    10

  2. B

    15

  3. C

    0

  4. D

    5

Show answer

Correct answer

  • B

    15

Question 7

+4 marksOne correct option
  1. A
  2. B
  3. C
  4. D
Show answer

Correct answer

  • B

Question 8

+4 marksOne correct option
  1. A

    12

  2. B

    10

  3. C

    15

  4. D

    13

Show answer

Correct answer

  • A

    12

Question 9

+3 marksOne correct option

Convert the binary number 10101010 to its decimal equivalent.

  1. A

    170

  2. B

    180

  3. C

    160

  4. D

    175

Show answer

Correct answer

  • A

    170

Question 10

+3 marksOne correct option

Convert the hexadecimal number 0x7C5D to its equivalent decimal representation:

  1. A

    31835

  2. B

    31836

  3. C

    31837

  4. D

    31838

Show answer

Correct answer

  • C

    31837

Question 11

+3 marksOne correct option
  1. A

    25

  2. B

    15

  3. C

    30

  4. D

    20

Show answer

Correct answer

  • C

    30

Question 12

+3 marksOne or more correct options

Which of the following is true for an 8-bit 2's complement representation?

Select all that apply.

  1. A

    The rightmost bit represents the sign (0 for positive, 1 for negative).

  2. B

    The maximum positive number that can be represented is 127.

  3. C

    The minimum negative number that can be represented is -127.

  4. D

    There are 256 possible values that can be represented.

Show answer

Correct answers

  • B

    The maximum positive number that can be represented is 127.

  • D

    There are 256 possible values that can be represented.

Question 13

+2 marksOne or more correct options

Select all the valid variable names in C:

Select all that apply.

  1. A

    _123Var

  2. B

    Test-Name

  3. C

    1stValue

  4. D

    break

  5. E

    max_length

Show answer

Correct answers

  • A

    _123Var

  • E

    max_length

Question 14

+3 marksNumerical answer

Consider the generalized computation given below:
1. R[0] ← M[0]
2. R[1] ← M[1]
3. R[1] = R[1] - R[0]
4. R[0] = R[0] + R[1]
5. R[1] = R[0] - R[1]
6. M[2] ← R[1]
What will be the value of M[2] at the end of computation if M[0] = 4 and M[1] = 7?

Show answer

Correct answer: 4

Question 15

+3 marksNumerical answer

Find the minimum number of bits required to represent an instruction set where there are 16 unique instructions, and each instruction can take at most 3 operands.
● The first operand should be able to represent 32 registers.
● The second operand should be able to represent -63 to 63 in signed magnitude form. ● The third operand is a single flag (1-bit).

Show answer

Correct answer: 17

Question 16

+4 marksNumerical answer
Show answer

Correct answer: 17