Question 1
Which of the following components is primarily responsible for performing arithmetic and logical operations in a computer?
Arithmetic Logic Unit (ALU)
Control Unit
Memory Unit
Input Unit

The IIT Madras BS Programming in C (Programming in C) End Term paper sat on 13 Sept 2026, in the May 2026 term: 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.
Which of the following components is primarily responsible for performing arithmetic and logical operations in a computer?
Arithmetic Logic Unit (ALU)
Control Unit
Memory Unit
Input Unit
Correct answer
Arithmetic Logic Unit (ALU)
A 4-byte integer 0x89ABCDEF is stored beginning at memory address 4000 in a Little-Endian system.
Which value will be stored at address 4002?
0x89
0xAB
0xCD
0xEF
Correct answer
0xAB
Consider the following C program.
What will be the output?
16
24
32
Garbage value
Correct answer
32
Which of the following statements about typedef in C is correct?
It creates a new data type.
It creates an alias (another name) for an existing data type.
It allocates memory for a variable.
It is used only with structures.
Correct answer
It creates an alias (another name) for an existing data type.
Which of the following file opening modes allows reading and writing while preserving the existing file contents?
Correct answer
Consider the following C program.
What will be the output?
24
14
16
12
Correct answer
16
Consider the following computation steps.
What is the final value stored in R[3]?
Correct answer: 36
Consider the following C program.
(ASCII value of 'B' is 66.) What will be the output?
Correct answer: 84
Consider the following C program.
What will be the output?
Correct answer: 15
Consider the following generalized memory computations.
What is the final value stored in M[3]?
12
18
14
21
Correct answer
14
The decimal equivalent of the following 8-bit signed two's complement number is
-14
-16
-18
242
Correct answer
-14
Consider the following C code.
What will be the output?
4
5
6
7
Correct answer
5
Consider the following recursive function.
What will be the output?
12
16
20
28
Correct answer
16
Consider the following C program.
What will be the output?
A
G
U
E
Correct answer
A
Consider the following C program.
What will be the output?
6
8
10
14
Correct answer
8
Which stage of the C compilation process is responsible for expanding macros and processing header files?
Linking
Loading
Preprocessing
Execution
Correct answer
Preprocessing
Consider the following C program.
What will be the output?
10 15
15 20
15 15
20 20
Correct answer
15 15
Which preprocessor directive is used to include the contents of another source or header file into the current program?
Correct answer
Consider the following C program.
What will be the output?
5
8
13
Compilation Error
Correct answer
8
Which of the following statements are correct regarding character encoding?
ASCII uses 7 bits.
UTF-8 is backward compatible with ASCII.
Every UTF-8 character occupies exactly 8 bits.
Unicode supports a much larger character set than ASCII.
Correct answers
ASCII uses 7 bits.
UTF-8 is backward compatible with ASCII.
Unicode supports a much larger character set than ASCII.
Consider the following C program.
What will be the output printed on the screen?
Correct answer: 27
Consider the following C program.
What will be the output?
Correct answer: 16
Consider the following C program.
What will be the output?
Correct answer: 17
Consider the following C program.
What will be the output?
Correct answer: 48
Which of the following statements about pointers are correct?
A pointer variable stores the address of another variable.
Pointer arithmetic depends on the data type of the pointer.
Dereferencing a NULL pointer is safe.
Two pointers can point to the same memory location.
Correct answers
A pointer variable stores the address of another variable.
Pointer arithmetic depends on the data type of the pointer.
Two pointers can point to the same memory location.