iGET

C Programming - MCQ Practice Questions

Practice free C Programming multiple-choice questions with detailed answers and explanations. Perfect for competitive exam preparation.

978 questions | 100% Free

Q.1Hard

What is the difference between *p++ and (*p)++?

Q.2Hard

What does the following code do? int *p = (int*)malloc(sizeof(int)); *p = 5; free(p); p = NULL;

Q.3Hard

Which statement is true about void pointers?

Q.4Hard

What is the output? int x = 50; int *p = &x; int *q = p; q = NULL; printf("%d", *p);

Q.5Hard

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

Q.6Hard

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.7Hard

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

Q.8Hard

What is the relationship between arrays and pointers in C?

Q.9Hard

What will be the output? int arr[3][3] = {{1,2,3}, {4,5,6}, {7,8,9}}; int *p = (int *)arr; printf("%d", *(p+5));

Q.10Hard

What does realloc() do?

Q.11Hard

What is the primary use of const pointer (int * const p)?

Q.12Hard

Consider: int arr[] = {1,2,3,4,5}; int *p = arr + 2; What is arr - p?

Q.13Hard

What is malloc(0) likely to return?

Q.14Hard

What will be printed? int *p = (int*)malloc(5 * sizeof(int)); int *q = p; p = NULL; free(q);

Q.15Hard

What is the difference between arr and &arr if arr is an array? int arr[5];

Q.16Hard

In pointer to function: int (*ptr)(int, int); What does this declare?

Q.17Hard

What is the output of: printf("%p", NULL);?

Q.18Hard

For dynamic 2D array: int arr = (int)malloc(n * sizeof(int*)); What's missing?

Q.19Hard

What is the relationship between arrays and pointers?

Q.20Hard

Consider: const int *p; and int * const q; Which statement is true?