Indian Institute of Technology Madras
BS Degree Programme · Examination & Study Paper
Programming in C
File I/O & the preprocessor
Official Paper
Examination Instructions & Guidelines
- Solve on notebook/paper first before checking solutions.
- MCQ: Exactly 1 option is correct. Negative marking applies.
- Scientific calculator allowed for all calculations.
- Official answer key is sealed at the end of this sheet.
End Term · 31 Aug 2025 (FN)End Term
- Q1MCQ4 Marks·Choose one option

- A"New Content" is appended to the end, resulting in "Hello WorldNew Content".
- BThe file is cleared, and only "New Content" is written.
- CThe code will fail to open the file because it already exists.
- D"New Content" is inserted at the beginning, pushing "Hello World" to the end.
- Q2MCQ4 Marks·Choose one option

- A

- B

- C

- D

- A
- Q3MCQ4 Marks·Choose one option
What is the primary purpose of the C preprocessor?
- ATo execute the program's logic before the main function.
- BTo convert the source code into machine language.
- CTo process directives and modify the source code before compilation.
- DTo manage dynamic memory allocation during runtime.
- Q4MCQ4 Marks·Choose one option

- A25
- B23
- C17
- D15
End Term · 31 Aug 2025 (AN)End Term
- Q5MCQ4 Marks·Choose one option

- A

- B

- C

- D

- A
- Q6MCQ4 Marks·Choose one option

- A

- B

- C

- D

- A
- Q7MCQ4 Marks·Choose one option
When a macro is used in a C program, at what stage is its definition replaced into the code?
- A

- B

- C

- D

- A
- Q8MCQ4 Marks·Choose one option
Consider the below C program:
What will be the output of the given C program?- A16
- B10
- C7
- D12