C questions in placement tests and university exams are rarely about syntax alone. Most of what you will find here is output prediction, pointer arithmetic, arrays and strings, structures and unions, storage classes, recursion, and file handling. The explanations walk through memory behaviour step by step, which is usually where the confusion sits rather than in the code itself.
In C, which of the following correctly declares a pointer to an integer?
Answer: A
The correct syntax is 'int *ptr;' where * indicates ptr is a pointer to int.
Q.22Easy
What will be the output of: printf("%d", 25);
Answer: B
Integer division truncates the result. 25 = 2 (not 2.5) because both operands are integers.
Q.23Easy
What will be the output of: int x = 10; printf("%d", x++);
Answer: A
x++ is post-increment. The current value (10) is printed first, then x is incremented to 11. So output is 10.
Q.24Easy
How many bytes does a 'long long' integer occupy in C (standard 32-bit system)?
Answer: C
'long long' is guaranteed to be at least 64 bits (8 bytes) as per C99 standard.
Q.25Easy
Which escape sequence represents a horizontal tab in C?
Answer: B
\t is the escape sequence for horizontal tab. \n is newline, \h and \s are not valid escape sequences.
Q.26Easy
What is the correct way to declare a two-dimensional array of integers with 3 rows and 4 columns?
Answer: A
2D array syntax is int arr[rows][columns]. So int arr[3][4] creates 3 rows and 4 columns.
Q.27Easy
What is the output of the following C program? #include<stdio.h> int main() { char str[] = "GATE"; printf("%d", sizeof(str)); return 0; }
Answer: B
sizeof(str) includes the null terminator. The string "GATE" has 4 characters plus 1 null terminator = 5 bytes.
Q.28Easy
Which of the following is NOT a fundamental data type in C?
Answer: C
C has 5 fundamental data types: int, float, double, char, and void. 'string' is not a fundamental type; it's created using char arrays.
Q.29Easy
What is the size of an 'int' variable in a 32-bit system?
Answer: B
In a 32-bit system, an int is typically 4 bytes (32 bits). However, the C standard only guarantees it's at least 2 bytes, so technically it's compiler-dependent. But in practice, 4 bytes is standard.
Q.30Easy
Which variable declaration is correct in C?
Answer: C
Variable names must start with a letter or underscore, followed by letters, digits, or underscores. Option C follows this rule correctly.
Q.31Easy
Which keyword is used to declare a variable that cannot be modified?
Answer: B
'const' keyword makes a variable constant and immutable after initialization.
Q.32Easy
Which of the following is a derived data type in C?
Answer: B
Derived data types are created from fundamental types. Arrays, pointers, structures, and unions are derived types.
Q.33Easy
How many bits are used to store a 'short int' in a standard C environment?
Answer: B
Standard C guarantees short int is at least 16 bits (2 bytes). Most systems use exactly 16 bits.
Q.34Easy
What is the range of values for a signed char in C?
Answer: B
A signed char occupies 1 byte (8 bits). With sign bit, it ranges from -128 to 127 (2^7 to 2^7-1).
Q.35Easy
Which keyword is used to modify a variable so that it cannot be changed?
Answer: B
The const keyword makes a variable read-only after initialization. Its value cannot be modified during program execution.
Q.36Easy
What is the size of the double data type in most 64-bit systems?
Answer: B
In standard C on 64-bit systems, double occupies 8 bytes and can store values with approximately 15-17 significant digits.
Q.37Easy
Which of the following variable names is INVALID in C?
Answer: C
Variable names cannot start with a digit in C. Valid names must begin with a letter (a-z, A-Z) or underscore (_).
Q.38Easy
What will be the result of sizeof(int) on a typical 32-bit system?
Answer: B
On 32-bit systems, int is typically 4 bytes (32 bits). However, the exact size is implementation-defined per C standard.
Q.39Easy
What is the default data type of a floating-point constant in C?
Answer: B
In C, floating-point constants like 3.14 are treated as double by default. To specify float, you need to use 3.14f suffix.
Q.40Easy
What is the range of unsigned char in C?
Answer: B
unsigned char is 1 byte (8 bits) without sign bit, giving range 0 to 2^8-1 = 0 to 255.