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.
What does the & operator do when used with a variable?
Answer: B
The & (address-of) operator returns the memory address of the variable.
Q.162Easy
What is the output of the following code? int x = 20; int *p = &x; printf("%d", *p);
Answer: B
The * operator dereferences the pointer p, accessing the value it points to, which is 20.
Q.163Easy
Which of the following is a void pointer?
Answer: B
void* is a generic pointer that can hold addresses of any data type and requires explicit typecasting when used.
Q.164Easy
What is the output of the following code? int x = 5; int *p = &x; int **q = &p; printf("%d", **q);
Answer: A
q is a pointer to pointer p. **q dereferences p twice, giving the value of x which is 5.
Q.165Easy
What will be the size of the pointer variable on a 64-bit system? int *ptr;
Answer: B
On a 64-bit system, all pointers are 8 bytes regardless of the data type they point to.
Q.166Easy
What is the output? int arr[] = {10, 20, 30}; int *p = arr; printf("%d %d", *(p+1), arr[1]);
Answer: A
p+1 points to second element (20). arr[1] is also 20. Both print the same value.
Q.167Easy
What does void *ptr represent?
Answer: A
void* is a generic pointer. It can be cast to any other pointer type. No arithmetic can be done directly.
Q.168Easy
What is the output? void swap(int *a, int *b) { int temp = *a; *a = *b; *b = temp; } int x = 5, y = 10; swap(&x, &y); printf("%d %d", x, y);
Answer: B
swap() exchanges values through pointers. x becomes 10, y becomes 5 after function call.
Q.169Easy
What is the output? char str[] = "ABC"; char *p = str; printf("%c", *(p+2));
Answer: C
p+2 points to str[2] which is 'C'. Note: str[3] is null terminator.
Q.170Easy
What is the size of a pointer in a 64-bit system?
Answer: C
In 64-bit systems, pointers are 8 bytes (64 bits) regardless of the data type they point to.
Q.171Easy
How does free() handle a NULL pointer?
Answer: B
free(NULL) is safe in C and does nothing. This is by design to prevent errors when freeing pointers.
Q.172Easy
What is the result of: int x = 5; int *p = &x; int *q = p; if p == q?
Answer: B
Both p and q point to same address of x, so p == q evaluates to true (1).
Q.173Easy
What happens with: int arr[10]; int *p = arr; *p = 5; printf("%d", arr[0]);?
Answer: B
p points to arr[0]. *p = 5 modifies arr[0]. Printing arr[0] displays 5.
Q.174Easy
What is the output of the following code? int x = 10; int *p = &x; int **q = &p; printf("%d", **q);
Answer: A
q is a pointer to pointer p. **q dereferences q twice: first to get p, then to get the value of x which is 10.
Q.175Easy
Consider the declaration: const int *p; and int * const q; Which statement is TRUE?
Answer: B
const int *p means p can change but the data it points to cannot. int * const q means q cannot change but the data it points to can be modified.
Q.176Easy
What is the primary issue with this code? int *p; *p = 10;
Answer: B
p is declared but not initialized to point to any valid memory location. Dereferencing an uninitialized pointer causes undefined behavior.
Q.177Easy
What is the primary difference between a structure and a union in C?
Answer: A
In structures, each member gets its own memory space. In unions, all members share the same memory location, so only one member can hold a value at a time.
Q.178Easy
What will be the output of sizeof(union test) if union has members: int a, char b, float c?
Answer: A
Union size equals the size of its largest member. Here, both int and float are 4 bytes (largest), so sizeof(union test) = 4 bytes.
Q.179Easy
Which keyword is used to define a structure in C?
Answer: B
The 'struct' keyword is used to define structures in C. 'class' is used in C++ and Java.
Q.180Easy
What is the size of the following structure? struct point { int x; int y; float z; };
Answer: B
int x = 4 bytes, int y = 4 bytes, float z = 4 bytes. Total = 12 bytes (no padding in this case on most systems).