Question 1
The main purpose of cache memory is to:
Store data permanently.
Reduce the burden on the ALU.
Speed up access to frequently used data and instructions.
Manage memory allocation between processes.
The IIT Madras BS Introduction to C Programming (Intro to C Programming) Qualifier paper sat on 13 Apr 2025, in the January 2025 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.
The main purpose of cache memory is to:
Store data permanently.
Reduce the burden on the ALU.
Speed up access to frequently used data and instructions.
Manage memory allocation between processes.
Correct answer
Speed up access to frequently used data and instructions.
Identify the option that arranges the following memory types in descending order of size (from largest to smallest).
Secondary Memory (Hard Drive), Main Memory (RAM), Cache Memory, Registers
Main Memory (RAM), Secondary Memory (Hard Drive), Registers, Cache Memory
Main Memory (RAM), Secondary Memory (Hard Drive), Cache Memory, Registers
Secondary Memory (Hard Drive), Registers, Main Memory (RAM), Cache Memory
Correct answer
Secondary Memory (Hard Drive), Main Memory (RAM), Cache Memory, Registers
What is the minimum number of bits required for binary representation of (1912)10?
9
10
11
12
Correct answer
11
What is the decimal equivalents for the binary number 10011011?
155
153
154
160
Correct answer
155
What is the sum of the hexadecimal numbers AB, 3C and 4F as a decimal number?
270
140
310
80
Correct answer
310
The 16-bit binary representation of decimal number “-256” in 2's complement notation is__.
11111111 00000000
11111000 00000000
11111111 11111000
10000000 00000000
Correct answer
11111111 00000000
Consider the following code snippet.
What will be the value of x, y and z after executing the given code snippet?
x = 0, y = 4, z = 0
x = 1, y = 4, z = 1
x = 1, y = 3, z = 1
x = 0, y = 3, z = 0
Correct answer
x = 0, y = 3, z = 0
Which of the following statements correctly declares and initializes an integer variable named age in C?
int age = 25;
age = 25;
int *age = 25;
age = int(25);
Correct answer
int age = 25;
Shree is writing a program to calculate the product of the first 10 multiples of 4. He has written a code, but one statement is missing.
int i = 4;int product = 1;while(i <= 40){ product = product * i; ---- missing statement ----}printf("%d",product);i = i * 4
i = i + 1
i = i + 4
i = 4
Correct answer
i = i + 4
Which of the following special symbols is allowed in a variable name?
Correct answer
What will be the output if the user enters x = 4 and y = 10 in the following program?
#include <stdio.h>int main() { int x, y; scanf("%d %d", &x, &y); if (x >= 5) { if (y < 10) printf("Case 1"); else printf("Case 2"); } else { if (y == 10) printf("Case 3"); else printf("Case 4"); } return 0;}Case 1
Case 2
Case 3
Case 4
Correct answer
Case 3
Consider the following equation:
If all the variables are float, which of the following is a correct way to write the given equation in C language?
Correct answers
Consider the computations given below using the generalized memory model.
1. M[0] ← 7
2. M[1] ← 5
3. M[1] ← M[1] * M[1]
4. M[0] ← M[1] - M[0]
5. M[1] ← M[1] - M[0]
6. M[0] ← M[1] + M[0]
7. M[2] ← M[0]
What is the value of M[2] at the end of the computation?
Correct answer: 25
Consider the computations given below using the generalized memory model.
What is the value of R[3] at the end of the computation?
Correct answer: 3
Consider the below code segment
#include <stdio.h>
int main(){ int i = 2, j = 1; switch(i + j) { case 1: j++; case 2: j++; case 3: j++; case 4: j++; default: j++; } printf("%d",j); }What will be the output of the above program?
Correct answer: 4
Consider the C program given below.
#include <stdio.h>int main(){ for(int i=0; i<15; i++) { if(i%3==0) { continue; } printf("Hello\n"); } return 0;}How many times “Hello” gets printed?
Correct answer: 10