iGET

C Programming - MCQ Practice Questions

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.

972 questions | 100% Free

Q.501Easy

What is the size of a pointer variable on a 32-bit system?

Q.502Easy

Consider: int x = 10; int *p = &x; What does the expression *p represent?

Q.503Easy

Which operator is used to get the address of a variable?

Q.504Easy

What will be printed by the code: char *ptr = "Hello"; printf("%c", *ptr);

Q.505Medium

A void pointer can be used to store addresses of variables of any data type. However, it must be cast before dereferencing. Which statement about void pointers is FALSE?

Q.506Medium

Consider the code: int arr[] = {5, 10, 15, 20}; int *ptr = arr; ptr++; What does ptr now point to?

Q.507Medium

Which of the following best describes a dangling pointer situation?

Q.508Medium

Consider: int x = 5; int *p = &x; int q = &p; What is the value of q?

Q.509Medium

Which memory allocation function does NOT initialize allocated memory to zero?

Q.510Medium

Consider: int arr[5] = {1, 2, 3, 4, 5}; int *p = arr; What is the value of *(p+2)?

Q.511Medium

A function needs to modify a variable in the calling function. Which parameter passing method is appropriate?

Q.512Medium

Consider: void func(int *arr, int size); This function prototype suggests that func will:

Q.513Medium

What will be the output of: int x = 10; int *p = &x; printf("%p", p); (assuming typical system output)

Q.514Hard

In a function that returns a pointer, which of the following is UNSAFE?

Q.515Hard

Consider: int *p = (int *)malloc(5 * sizeof(int)); for(int i=0; i<5; i++) *(p+i) = i*10; Which statement correctly deallocates this memory?

Q.516Hard

A programmer uses a pointer variable but forgets to initialize it before dereferencing. Which type of error will occur?

Q.517Easy

What is the size of a pointer variable in a 64-bit system?

Q.518Easy

What does the & operator do when used with a variable?

Q.519Easy

What is the output of the following code?
int x = 20;
int *p = &x;
printf("%d", *p);

Q.520Easy

Which of the following is a void pointer?