uiz Space

May 2024 term · Introduction to C Programming · CS1101

Introduction to C Programming Qualifier: 1 September 2024 (May 2024 term)

The IIT Madras BS Introduction to C Programming (Intro to C Programming) Qualifier paper sat on 1 Sept 2024, in the May 2024 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
15
MSQ
1

Updated

Official paper: IIT M ES REATTEMPT AN EXAM QEF1 01 Sep 2024 · No negative marking.

Question 1

+4 marksOne correct option

Suppose you have two 8-bit binary numbers, A and B, represented as (00010101)2 and (00000110)2, respectively. Perform the subtraction A−B and determine the decimal equivalent of the result.

  1. A

    19

  2. B

    15

  3. C

    21

  4. D

    6

Show answer

Correct answer

  • B

    15

Question 2

+4 marksOne correct option

Consider the following algorithm where number n stored in register R1, and the final result stored in register R2.
1. R1 = n
2. R2 = 1
3. R2 = R2 * R1
4. R1 = R1 - 1
5. If R1 > 0, go to step 3, otherwise go to step 6.
6. Print(R2)
Which of the following statements represents the correct purpose of the given algorithm?

  1. A

    The algorithm calculates the sum of all numbers from 1 to n.

  2. B

    The algorithm calculates the power of 2 raised to n.

  3. C

    The algorithm calculates the nth Fibonacci number.

  4. D

    The algorithm calculates the factorial of the number n.

Show answer

Correct answer

  • D

    The algorithm calculates the factorial of the number n.

Question 3

+4 marksOne correct option

Consider the below C program.

c
#include <stdio.h>
int main() {
int n = 10;
int i = 0, j = 1;
while (i < n) {
printf("%d ", i);
i += j;
j++;
}
return 0;
}

What will be the output of the above program?

  1. A

    0 1 2 3 4 5 6 7 8 9

  2. B

    0 1 3 6

  3. C

    0 2 4 8

  4. D

    1 3 6 10

Show answer

Correct answer

  • B

    0 1 3 6

Question 4

+4 marksOne correct option

Consider the below C program.

c
#include <stdio.h>
int main() {
int x = 1, y = 2, z = 0;
if (z == 1)
y++;
x--;
if (x > 1)
x--;
z++;
printf("%d %d %d", x, y, z);
return 0;
}

What will be the output of the above program?

  1. A

    0 3 0

  2. B

    0 2 1

  3. C

    1 2 0

  4. D

    1 2 1

Show answer

Correct answer

  • B

    0 2 1

Question 5

+4 marksOne correct option

Consider the below C program.

c
#include <stdio.h>
int main() {
int x = 5, y = 3, z = 7;
int result = (x > y) && (y < z);
printf("%d\n", result);
return 0;
}

What will be the output of the above program?

  1. A

    0

  2. B

    1

  3. C

    2

  4. D

    3

Show answer

Correct answer

  • B

    1

Question 6

+3 marksOne correct option

Consider the following mathematical expression in C language:
result = (a + b) * (c - d) / (e * f);
Determine the number of primitive operations required to evaluate this expression.

  1. A

    5

  2. B

    6

  3. C

    4

  4. D

    7

Show answer

Correct answer

  • A

    5

Question 7

+3 marksOne correct option

Find the decimal equivalent for the unsigned binary representation (10100110)2.

  1. A

    168

  2. B

    166

  3. C

    170

  4. D

    162

Show answer

Correct answer

  • B

    166

Question 8

+3 marksOne correct option

Given an 8-bit binary number (11010100)2, what is its representation in two's complement notation?

  1. A

    (01101000)2

  2. B

    (00101111)2

  3. C

    (00101100)2

  4. D

    (10101000)2

Show answer

Correct answer

  • C

    (00101100)2

Question 9

+3 marksOne correct option

Find the hexadecimal equivalent of the binary representation (1101 1011 0011 1011 1110 1010)2.

  1. A

    DD3B7A

  2. B

    DBB6FA

  3. C

    DB6FAB

  4. D

    DB3BEA

Show answer

Correct answer

  • D

    DB3BEA

Question 10

+3 marksOne correct option

Given the ASCII value of the character '0' is 48 and the ASCII value of the character '9' is 57, what is the sum of the ASCII values of all characters from '0' to '9'?

  1. A

    435

  2. B

    535

  3. C

    430

  4. D

    525

Show answer

Correct answer

  • D

    525

Question 11

+3 marksOne correct option

Consider the below C program.

c
#include <stdio.h>
int main() {
int x = 5;
int y = 3;
int z = 2;
int result = x + y * z - x / z;
printf("%d\n", result);
return 0;
}

What will be the output of the above program?

  1. A

    5

  2. B

    5.5

  3. C

    9

  4. D

    9.5

Show answer

Correct answer

  • C

    9

Question 12

+3 marksOne correct option

Consider the below C program.

c
#include <stdio.h>
int main() {
int a = 10, b = 20, c = 30;
b++ > 20 ? a-- : ++c;
printf("%d %d %d", a, b, c);
return 0;
}

What will be the output of the above program?

  1. A

    10 20 30

  2. B

    9 21 31

  3. C

    10 21 31

  4. D

    10 20 31

Show answer

Correct answer

  • C

    10 21 31

Question 13

+2 marksOne correct option

Which of the following is true about the “sizeof” operator in C?

  1. A

    It returns the number of elements in an array.

  2. B

    It returns the size of a variable in bytes.

  3. C

    It returns the size of a variable in bits.

  4. D

    It returns the memory address of a variable.

Show answer

Correct answer

  • B

    It returns the size of a variable in bytes.

Question 14

+2 marksOne correct option

Which of the following is not a valid data type in C?

  1. A

    float

  2. B

    map

  3. C

    char

  4. D

    double

Show answer

Correct answer

  • B

    map

Question 15

+2 marksOne correct option

Which of the following is used to terminate a C statement?

  1. A

    Period (.)

  2. B

    Colon (:)

  3. C

    Comma (,)

  4. D

    Semicolon (;)

Show answer

Correct answer

  • D

    Semicolon (;)

Question 16

+3 marksOne or more correct options

Which of the following can be used as identifier(s) in C language?

Select all that apply.

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

Correct answers

  • A
  • E