What is the scope of a variable declared inside a function block?
Answer: C
Variables declared inside a block (including function blocks) have block scope and are accessible only within that block.
Q.42Easy
Which of the following is a storage class in C?
Answer: C
The storage classes in C are: auto, register, static, and extern. 'static' is one of them.
Q.43Easy
What is the difference between initialization and assignment in C?
Answer: B
Initialization assigns a value when the variable is declared (int x = 5;). Assignment changes the value later (x = 10;).
Q.44Easy
What is the size of a 'float' data type in C on most 32-bit systems?
Answer: B
On most 32-bit systems, float occupies 4 bytes (32 bits) of memory according to IEEE 754 standard.
Q.45Easy
What is the range of 'signed char' in C?
Answer: B
Signed char uses 8 bits with one bit for sign, giving range -128 to 127 (2^7 to 2^7-1).
Advertisement
Q.46Easy
What happens if you assign a double value to an int variable without casting?
Answer: B
Implicit conversion truncates decimal part. int x = 3.7; results in x=3 with no error.
Q.47Easy
What is the size of the 'char' data type in C on most modern systems?
Answer: A
The 'char' data type occupies 1 byte (8 bits) of memory on virtually all modern C systems, as per the C standard.
Q.48Easy
What is the difference between 'signed' and 'unsigned' char?
Answer: B
Signed char ranges from -128 to 127, while unsigned char ranges from 0 to 255. Both use 1 byte but interpret the bits differently.
Q.49Easy
Which data type would be most appropriate to store a person's age in a program?
Answer: C
Age is an integer value. Using 'int' is appropriate and memory-efficient. Floating-point types are unnecessary for this discrete value.
Q.50Easy
What is the output of: int a = 5, b = 2; printf("%d", a / b);
Answer: B
Both a and b are integers, so integer division is performed: 25 = 2 (remainder discarded).
Q.51Easy
In C programming, which of the following is NOT a fundamental data type?
Answer: C
string is not a fundamental data type in C. Fundamental types are int, float, double, char, and void. Strings are arrays of characters.
Q.52Easy
What is the size of a 'long long int' variable in C on a 64-bit system?
Answer: B
A 'long long int' is guaranteed to be at least 64 bits (8 bytes) by the C99 standard on all systems including 64-bit architectures.
Q.53Easy
Which keyword is used to declare a variable that cannot be modified after initialization?
Answer: C
The 'const' keyword declares a constant variable whose value cannot be modified after initialization. Attempting to modify it results in a compile-time error.
Q.54Easy
Which of the following variable declarations will occupy the LEAST memory?
Answer: C
char data type typically occupies 1 byte, which is the minimum. int is 4 bytes, float is 4 bytes, and double is 8 bytes on most systems.
Q.55Easy
In C programming, when you declare a variable as 'const int x = 5;', what happens if you try to modify it within the program?
Answer: B
The 'const' keyword creates a read-only variable. Once initialized, attempting to modify a const variable results in a compilation error (error: assignment of read-only variable). This is enforced at compile-time, not runtime.
Q.56Easy
What will be the output of the following C code?
int x = 5;
if (x > 3)
printf("A");
else
printf("B");
Answer: A
Since x = 5 and 5 > 3 is true, the if block executes and prints 'A'.
Q.57Easy
Which of the following is NOT a valid control flow statement in C?
Answer: B
foreach is not a standard C control flow statement. C has if-else, switch, for, while, do-while, and goto.
Q.58Easy
What is the output of this code?
for (int i = 0; i < 3; i++)
printf("%d ", i);
Answer: A
The loop runs from i=0 to i=2 (i < 3), printing '0 1 2 '.
Q.59Easy
What is the difference between 'break' and 'continue' in loops?
Answer: A
break terminates the loop entirely, while continue jumps to the next iteration without executing remaining statements.
Q.60Easy
Analyze the ternary operator: int x = (5 > 3) ? 10 : 20; What is the value of x?
Answer: A
Since 5 > 3 is true, the ternary operator returns 10, so x = 10.