Quiz Space

September 2024 term · Programming in C · BSCS3005

Programming in C End Term: 22 December 2024, Set QDB1 (September 2024 term)

The IIT Madras BS Programming in C (Programming in C) End Term paper sat on 22 Dec 2024, in the September 2024 term, set QDB1: 25 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.

Questions
25
Marks
100
Duration
180 min
MCQ
18
MSQ
3
Numerical
4

Updated

Official paper: IIT M DEGREE AN EXAM QDB3 22 Dec 2024 · No negative marking.

Question 1

+3 marksOne correct option

Which of the following data types will result in the largest memory allocation?

  1. A

    int

  2. B

    char

  3. C

    double

  4. D

    float

Show answer

Correct answer

  • C

    double

Question 2

+3 marksOne correct option

What is the primary difference between a function declaration and a function definition in C?

  1. A

    A function declaration specifies the name, return type, and parameters of a function, while a function definition provides the implementation of the function.

  2. B

    A function declaration provides the implementation of the function, while a function definition specifies only the function signature.

  3. C

    Both are the same, they can be used interchangeably.

  4. D

    Function declarations are only required for recursive functions.

Show answer

Correct answer

  • A

    A function declaration specifies the name, return type, and parameters of a function, while a function definition provides the implementation of the function.

Question 3

+3 marksOne correct option

Which of the following is not a valid memory segment in C?

  1. A

    Code segment

  2. B

    Heap segment

  3. C

    Register segment

  4. D

    Data segment

Show answer

Correct answer

  • C

    Register segment

Question 4

+5 marksOne correct option
  1. A

    6

  2. B

    7

  3. C

    8

  4. D

    9

Show answer

Correct answer

  • A

    6

Question 5

+5 marksOne correct option
  1. A

    a = 5, b = 3, c = 2

  2. B

    a = 1, b = 4, c = 3

  3. C

    a = 2, b = 2, c = 3

  4. D

    a = 3, b = 2, c = 4

Show answer

Correct answer

  • D

    a = 3, b = 2, c = 4

Question 6

+5 marksOne correct option
  1. A

    Counts the number of odd numbers from 1 to n.

  2. B

    Counts the number of even numbers from 1 to n.

  3. C

    The sum of odd numbers from 1 to n.

  4. D

    The sum of even numbers from 1 to n.

Show answer

Correct answer

  • B

    Counts the number of even numbers from 1 to n.

Question 7

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

Correct answer

  • B

Question 8

+5 marksOne correct option
  1. A

    1

  2. B

    4

  3. C

    2

  4. D

    8

Show answer

Correct answer

  • C

    2

Question 9

+5 marksOne correct option
  1. A

    11

  2. B

    27

  3. C

    36

  4. D

    25

Show answer

Correct answer

  • A

    11

Question 10

+4 marksOne correct option
  1. A

    5

  2. B

    -5

  3. C

    15

  4. D

    Compilation error

Show answer

Correct answer

  • B

    -5

Question 11

+4 marksOne correct option
  1. A

    5

  2. B

    15

  3. C

    Compilation error

  4. D

    10

Show answer

Correct answer

  • A

    5

Question 12

+4 marksOne correct option
  1. A

    10

  2. B

    5

  3. C

    15

  4. D

    Compilation error

Show answer

Correct answer

  • C

    15

Question 13

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

Correct answer

  • B

Question 14

+4 marksOne correct option
  1. A

    1

  2. B

    2

  3. C

    3

  4. D

    4

Show answer

Correct answer

  • C

    3

Question 15

+4 marksOne correct option
  1. A

    arr[0]: 42, arr[1]: 3.14

  2. B

    arr[0]: Undefined Behavior, arr[1]: 3.14

  3. C

    arr[0]: 42, arr[1]: Undefined Behavior

  4. D

    arr[0]: 42, arr[1]: 0.00

Show answer

Correct answer

  • A

    arr[0]: 42, arr[1]: 3.14

Question 16

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

Correct answer

  • B

Question 17

+4 marksOne correct option

Which of the following best describes a macro in C?

  1. A

    A function stored in the stack memory.

  2. B

    A block of code replaced at runtime.

  3. C

    A block of code replaced during the preprocessing phase.

  4. D

    A predefined function in the C Standard Library.

Show answer

Correct answer

  • C

    A block of code replaced during the preprocessing phase.

Question 18

+4 marksOne correct option

Which of the following statements about conditional compilation is false?

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

Correct answer

  • B

Question 19

+3 marksOne or more correct options

Which of the following statements about pointers is/are true?

Select all that apply.

  1. A

    A pointer can be incremented to point to the next memory location of its type.

  2. B

    A pointer variable cannot be reassigned after initialization.

  3. C

    Dereferencing a pointer gives the value stored at the memory address it holds.

  4. D

    Dereferencing a pointer gives the memory address it holds.

Show answer

Correct answers

  • A

    A pointer can be incremented to point to the next memory location of its type.

  • C

    Dereferencing a pointer gives the value stored at the memory address it holds.

Question 20

+3 marksOne or more correct options

Which of the following statement(s) is/are true about arrays in C?

Select all that apply.

  1. A

    Arrays in C are zero-indexed.

  2. B

    The name of an array points to its first element in memory allocated for the array.

  3. C

    Arrays can hold elements of different data types.

  4. D

    Array elements are stored in contiguous memory locations.

Show answer

Correct answers

  • A

    Arrays in C are zero-indexed.

  • B

    The name of an array points to its first element in memory allocated for the array.

  • D

    Array elements are stored in contiguous memory locations.

Question 21

+3 marksOne or more correct options

Which of the following statement(s) is/are true about structures in C?

Select all that apply.

  1. A

    Structures can contain members of different data types.

  2. B

    The size of a structure is always the size of its largest member.

  3. C

    Structures can not be nested within other structures.

  4. D

    Members of a structure can be accessed using the dot operator.

Show answer

Correct answers

  • A

    Structures can contain members of different data types.

  • D

    Members of a structure can be accessed using the dot operator.

Question 22

+4 marksNumerical answer
Show answer

Correct answer: 15

Question 23

+4 marksNumerical answer
Show answer

Correct answer: 9

Question 24

+4 marksNumerical answer
Show answer

Correct answer: 8

Question 25

+4 marksNumerical answer
Show answer

Correct answer: 11