What is the size of 'long long' data type in C99 standard?
Answer: C
C99 standard guarantees 'long long' to be at least 64 bits (8 bytes), but some systems may allocate more.
Q.82Medium
What will be printed: float f = 25; printf("%f", f);
Answer: B
25 performs integer division resulting in 2, which is then stored in float f. printf("%f") prints 2.000000 (default 6 decimal places).
Q.83Medium
What happens when you declare a variable without initializing it in C?
Answer: B
Uninitialized local variables contain garbage values (whatever was in memory). Only static/global variables are zero-initialized.
Q.84Medium
Which storage class specifier limits a variable's scope to the current file?
Answer: B
The 'static' keyword, when used at file scope, restricts the variable's visibility to that file only (internal linkage).
Q.85Medium
What will be the output: const int x = 10; x = 20; printf("%d", x);
Answer: C
const variables cannot be modified after initialization. Attempting to assign a new value causes a compilation error.
Advertisement
Q.86Medium
Which of these correctly represents a floating-point literal with exponent notation?
Answer: A
Correct exponent notation requires a digit before and after 'e'. 1.5e2 represents 1.5 × 10² = 150.0
Q.87Medium
What is the range of values for a signed short int?
Answer: B
Signed short int is typically 2 bytes (16 bits), providing a range from -2^15 to 2^15-1.
Q.88Medium
Which of the following is a valid declaration of a constant array?
Answer: D
Both declarations make the array elements constant. Option A initializes the array, while B declares it without initialization (valid at global scope).
Q.89Medium
In C, what is the difference between 'int' and 'unsigned int' in terms of range on a 32-bit system?
Answer: B
signed int reserves 1 bit for sign, giving range -2147483648 to 2147483647. unsigned int uses all 32 bits for magnitude, giving 0 to 4294967295.
Q.90Medium
Which storage class has both 'static' and 'auto' properties in certain contexts?
Answer: A
register requests compiler to store variable in CPU register for faster access but falls back to memory if unavailable, combining automatic allocation with optimization hints.
Q.91Medium
What is the output of:
int arr[3] = {1, 2, 3};
int *p = arr;
printf("%d %d", *p, *(p+2));
Answer: A
p points to arr[0] which is 1. p+2 points to arr[2] which is 3. Therefore output is '1 3'.
Q.92Medium
Consider a scenario where you need to store a variable that can hold values up to 10 billion. Which data type is most suitable?
Answer: C
int max is ~2.1 billion, long int varies (may be 32 or 64 bits). long long int guarantees 64 bits with max ~9.2 quintillion, sufficient for 10 billion.
Q.93Medium
What will be printed?
int x = 0;
if (x = 5)
printf("True");
else
printf("False");
Answer: A
x = 5 assigns 5 to x and evaluates to 5 (non-zero), which is true. So 'True' is printed.
Q.94Medium
What is the output?
for (int i = 1; i <= 5; i++) {
if (i == 3) break;
printf("%d ", i);
}
Answer: A
When i becomes 3, break is executed, exiting the loop. So only 1 and 2 are printed.
Q.95Medium
What does the following nested if-else produce?
int a = 10, b = 20;
if (a > b)
if (b > 0)
printf("X");
else
printf("Y");
Answer: B
The else clause pairs with the inner if. Since a > b is false, the else block executes printing 'Y'.
Q.96Medium
What is the output of this switch statement?
int x = 2;
switch(x) {
case 1: printf("One"); break;
case 2: printf("Two");
case 3: printf("Three"); break;
default: printf("Other");
}
Answer: B
Case 2 matches. Since there's no break after case 2, fall-through occurs to case 3, printing 'TwoThree'.
Q.97Medium
How many times will this loop execute?
for (int i = 0; i < 5; ++i) {
if (i == 2) continue;
if (i == 4) break;
}
Answer: C
Loop runs for i=0,1,2,3. When i=4, break is executed. The body executes 4 times (iterations for i=0,1,2,3).
Q.98Medium
What is printed by this code?
int x = 5;
while (x-- > 0)
printf("%d ", x);
Answer: B
x-- returns 5 first, then decrements to 4. Loop runs while x > 0, printing 4, 3, 2, 1, 0.
Q.99Medium
What is the output?
int n = 1;
do {
printf("%d ", n);
n++;
} while (n > 5);
Answer: A
The do-while executes once (prints 1), then n becomes 2. Since 2 > 5 is false, the loop exits.
Q.100Medium
Determine the output:
int i = 0;
while (i < 3) {
printf("%d ", i++);
}
Answer: A
i starts at 0. Loop prints i then increments: prints 0, then 1, then 2. When i becomes 3, condition fails.