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.
memcpy(dest, src, count) copies 'count' bytes from src to dest. strlen() and sizeof() may not give correct results for all data types.
Q.82Easy
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.83Medium
Consider the following code: int x = 5; int *ptr = &x; int **pptr = &ptr; printf("%d", **pptr); What is the output?
Answer: A
pptr is a pointer to pointer. **pptr dereferences twice: first to get ptr, then to get x's value which is 5.
Q.84Medium
What will be printed by the following code? #include<stdio.h> int main() { int arr[5] = {1, 2, 3, 4, 5}; int *p = arr; printf("%d %d", *(p+2), arr[2]); return 0; }
Answer: A
*(p+2) accesses the element at index 2 (value 3), and arr[2] also accesses index 2 (value 3). Both print 3.
Q.85Medium
What is the output of this code? #include<stdio.h> int main() { int a = 5, b = 10; a = a ^ b; b = a ^ b; a = a ^ b; printf("%d %d", a, b); return 0; }
Answer: B
This is a classic XOR swap algorithm. After three XOR operations, a and b exchange their values. Result: a=10, b=5.
Q.86Hard
Consider the following declaration: int (*func_ptr)(int, int, int); Which of the following function signatures can be correctly assigned to func_ptr?
Answer: A
func_ptr must point to a function that takes exactly 3 int parameters and returns int. Only option A matches this signature exactly.
Q.87Easy
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.88Easy
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.89Easy
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.90Medium
What will be the output of the following code? int x = 5; float y = x; printf("%f", y);
Answer: A
Implicit type conversion occurs from int to float. The value 5 is converted to 5.0 and printed as 5.000000 with %f format specifier.
Q.91Medium
Which of the following occupies maximum memory in a 64-bit system?
Answer: B
In a 64-bit system, long double typically occupies 16 bytes (128 bits), which is the maximum among these options.
Q.92Medium
What is the range of unsigned int in a 32-bit system?
Answer: B
Unsigned int uses all 32 bits for magnitude, giving range 0 to 2^32 - 1 (0 to 4,294,967,295).
Q.93Easy
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.94Medium
What is the difference between 'static' and 'extern' variables?
Answer: B
static restricts variable visibility to the current file; extern declares a variable defined elsewhere with global scope.
Q.95Medium
What is the output of the following code? int x = 10; int *p = &x; printf("%d", *p);
Answer: A
p is a pointer to x. *p dereferences the pointer, giving the value of x, which is 10.
Q.96Easy
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.97Hard
What will be the size of the following structure? struct test { char c; int i; float f; };
Answer: D
Size depends on compiler's padding and alignment rules. Typically 12 bytes with padding, but varies by system.
Q.98Medium
Which variable storage class has default initialization to 0?
Answer: C
Static variables are automatically initialized to 0 by the compiler.
Q.99Medium
What is the output of this code? float x = 25; printf("%f", x);
Answer: B
25 performs integer division (both operands are int), resulting in 2. This is then converted to float as 2.0.
Q.100Easy
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.