Quiz Space

September 2023 term · Programming in C · BSCS3005

Programming in C End Term: 24 December 2023, Set 4 (September 2023 term)

The IIT Madras BS Programming in C (Programming in C) End Term paper sat on 24 Dec 2023, in the September 2023 term, set 4: 26 questions for 101 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
26
Marks
101
Duration
180 min
MCQ
17
MSQ
7
Written
2

Updated

Official paper: IIT M ES FOUNDATION FN EXAM FEF2 24 Dec 2023 · No negative marking.

Question 1

+1 markOne correct option

THIS IS QUESTION PAPER FOR THE SUBJECT "FOUNDATION LEVEL : INTRODUCTION TO C PROGRAMMING (COMPUTER BASED EXAM)" ARE YOU SURE YOU HAVE TO WRITE EXAM FOR THIS SUBJECT? CROSS CHECK YOUR HALL TICKET TO CONFIRM THE SUBJECTS TO BE WRITTEN. (IF IT IS NOT THE CORRECT SUBJECT, PLS CHECK THE SECTION AT THE TOP FOR THE SUBJECTS REGISTERED BY YOU)

  1. A

    YES

  2. B

    NO

Show answer

Correct answer

  • A

    YES

Question 2

+4 marksOne correct option
Figure from the original question paper
  1. A

    Value of a is 30Value of a is 30

  2. B

    Value of a is 30Value of a is 10

  3. C

    Value of a is 10Value of a is 10

  4. D

    Value of a is 10Value of a is 30

Show answer

Correct answer

  • B

    Value of a is 30Value of a is 10

Question 3

+4 marksOne correct option
Figure from the original question paper
  1. A

    4

  2. B

    -1

  3. C

    8

  4. D

    36

  5. E

    6

Show answer

Correct answer

  • D

    36

Question 4

+4 marksOne correct option
Figure from the original question paper
  1. A

    Compile Time Error

  2. B

    3 5

  3. C

    3 3

  4. D

    5 3

  5. E

    5 5

Show answer

Correct answer

  • D

    5 3

Question 5

+4 marksOne correct option
Figure from the original question paper
  1. A

    It incremented the value pointed by ptr by 2.

  2. B

    It adds 1 to the value pointed to by ptr.

  3. C

    It modifies the address of ptr.

  4. D

    It does not modify the value pointed to by ptr.

Show answer

Correct answer

  • B

    It adds 1 to the value pointed to by ptr.

Question 6

+4 marksOne correct option

Consider an integer variable holding a value “0x89209899”. Suppose the available memory addresses are starting from the address “0x128” in a machine, which of the following stores this multibyte data in the little endian way?

  1. A
    Figure from the original question paper
  2. B
    Figure from the original question paper
  3. C
    Figure from the original question paper
  4. D
    Figure from the original question paper
Show answer

Correct answer

  • C
    Figure from the original question paper

Question 7

+4 marksOne correct option

Which of the following statements about array initialization in C is correct?

  1. A

    Arrays can only be initialized at the time of declaration.

  2. B

    Arrays can be initialized both at the time of declaration and later in theprogram.

  3. C

    Arrays can only be initialized with integer values.

  4. D

    The index of the first element in an array is always 1.

Show answer

Correct answer

  • B

    Arrays can be initialized both at the time of declaration and later in theprogram.

Question 8

+4 marksOne correct option
Figure from the original question paper
  1. A

    10

  2. B

    15

  3. C

    20

  4. D

    16

Show answer

Correct answer

  • B

    15

Question 9

+4 marksOne correct option
Figure from the original question paper
  1. A

    Matched

  2. B

    Not Matched

  3. C

    Compile Time Error

  4. D

    It generates no output

Show answer

Correct answer

  • A

    Matched

Question 10

+4 marksOne correct option
Figure from the original question paper
  1. A
    Figure from the original question paper
  2. B
    Figure from the original question paper
  3. C
    Figure from the original question paper
  4. D
    Figure from the original question paper
Show answer

Correct answer

  • C
    Figure from the original question paper

Question 11

+4 marksOne correct option
Figure from the original question paper
  1. A

    3

  2. B

    6

  3. C

    7

  4. D

    4

Show answer

Correct answer

  • C

    7

Question 12

+4 marksOne correct option

In a union, how is memory allocated for its members?

  1. A

    Each member gets its own separate memory space of a fixed, equal size.

  2. B

    Allocated memory is shared among all members, and the memory size is equalto the size of the largest member.

  3. C

    Allocated memory is shared among all members, and the memory size is equalto the size of the smallest member.

  4. D

    The size of the allocated memory is equal to the sum of the sizes of itsmembers.

Show answer

Correct answer

  • B

    Allocated memory is shared among all members, and the memory size is equalto the size of the largest member.

Question 13

+4 marksOne correct option
Figure from the original question paper
  1. A

    A pointer to an integer.

  2. B

    An array of integers.

  3. C

    An integer variable.

  4. D

    A constant integer.

Show answer

Correct answer

  • A

    A pointer to an integer.

Question 14

+4 marksOne correct option
Figure from the original question paper
  1. A
    Figure from the original question paper
  2. B
    Figure from the original question paper
  3. C
    Figure from the original question paper
  4. D
    Figure from the original question paper
Show answer

Correct answer

  • D
    Figure from the original question paper

Question 15

+4 marksOne correct option

Suppose you open a file in “a” mode, write 10 characters - ABCDEFGHIJ, and close it. You open it again using “w” mode, write 5 characters - KLMNO, and close it. What will be the content of the file when you open it in “r” mode?

  1. A

    ABCDEFGHIJ

  2. B

    ABCDE

  3. C

    ABCDEKLMNO

  4. D

    ABCDEFGHIJKLMNO

  5. E

    KLMNO

Show answer

Correct answer

  • E

    KLMNO

Question 16

+4 marksOne correct option
Figure from the original question paper
  1. A

    FCAF

  2. B

    FBAF

  3. C

    FBCF

  4. D

    FCBF

Show answer

Correct answer

  • B

    FBAF

Question 17

+4 marksOne correct option
Figure from the original question paper
  1. A

    22

  2. B

    54

  3. C

    15

  4. D

    20

Show answer

Correct answer

  • A

    22

Question 18

+4 marksOne or more correct options

Which of the following statements is/are true regarding functions in C?

Select all that apply.

  1. A

    A function is a block of code, which is only executed when it is invoked.

  2. B

    A function can be invoked multiple times in the same program.

  3. C

    A function cannot accept more than 2 parameters.

  4. D

    A function can not call itself

Show answer

Correct answers

  • A

    A function is a block of code, which is only executed when it is invoked.

  • B

    A function can be invoked multiple times in the same program.

Question 19

+4 marksOne or more correct options

Which of the following functions computes and returns the factorial of a given positive integer num?

Select all that apply.

  1. A
    Figure from the original question paper
  2. B
    Figure from the original question paper
  3. C
    Figure from the original question paper
  4. D
    Figure from the original question paper
Show answer

Correct answers

  • A
    Figure from the original question paper
  • C
    Figure from the original question paper

Question 20

+4 marksOne or more correct options

In C, which of the following are valid operations on pointer variables? (Select all that apply)

Select all that apply.

  1. A

    Dividing one pointer variable by another pointer variable.

  2. B

    Comparing two pointers variables for equality.

  3. C

    Incrementing/Decrementing a pointer variable (e.g. ptr++/ ptr–).

  4. D

    Multiplying two pointer variables.

Show answer

Correct answers

  • B

    Comparing two pointers variables for equality.

  • C

    Incrementing/Decrementing a pointer variable (e.g. ptr++/ ptr–).

Question 21

+4 marksOne or more correct options
Figure from the original question paper

Select all that apply.

  1. A
    Figure from the original question paper
  2. B
    Figure from the original question paper
  3. C
    Figure from the original question paper
  4. D
    Figure from the original question paper
Show answer

Correct answers

  • A
    Figure from the original question paper
  • C
    Figure from the original question paper

Question 22

+4 marksOne or more correct options
Figure from the original question paper

Select all that apply.

  1. A

    4 bytes

  2. B

    8 bytes

  3. C

    16 bytes

  4. D

    32 bytes

  5. E

    256 bits

  6. F

    128 bits

Show answer

Correct answers

  • D

    32 bytes

  • E

    256 bits

Question 23

+4 marksOne or more correct options
Figure from the original question paper

Select all that apply.

  1. A

    The function allocates memory for a 2D array at the time of compilation.

  2. B

    The function dynamically allocates memory for a 2D array.

  3. C

    The function does not initialize the elements of the 2D array.

  4. D

    The function initializes all the elements of the 2D array with 0.

Show answer

Correct answers

  • B

    The function dynamically allocates memory for a 2D array.

  • D

    The function initializes all the elements of the 2D array with 0.

Question 24

+4 marksOne or more correct options

Which of the following storage classes initialize a variable with the value 0, if not initialized explicitly?

Select all that apply.

  1. A

    auto

  2. B

    extern

  3. C

    register

  4. D

    static

Show answer

Correct answers

  • B

    extern

  • D

    static

Question 25

+4 marksWritten answer
Figure from the original question paper
Show answer

A written answer, not marked automatically.

Question 26

+4 marksWritten answer
Figure from the original question paper
Show answer

A written answer, not marked automatically.