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.41Medium

What will be the output? int a[] = {10, 20, 30}; int *p = a; printf("%d", *(p+2));

Q.42Medium

What does calloc() do that malloc() doesn't?

Q.43Medium

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

Q.44Medium

Which statement correctly declares a pointer to a pointer?

Q.45Medium

What will be printed? int x = 100, y = 200; int *p = &x; int *q = &y; p = q; printf("%d", *p);

Q.46Medium

What is the primary disadvantage of using free() without proper checks?

Q.47Medium

What will be the output? char *str = "Hello"; printf("%c", *(str+1));

Q.48Hard

What is the relationship between arrays and pointers in C?

Q.49Hard

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

What does realloc() do?

Q.51Medium

What is the output? void func(int *arr) { arr[0] = 100; } int main() { int a[5] = {1,2,3,4,5}; func(a); printf("%d", a[0]); }

Q.52Medium

Which of the following is valid pointer arithmetic in C?

Q.53Hard

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

Q.54Easy

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

Q.55Medium

Which of the following correctly declares a pointer to a function that takes two integers and returns an integer?

Q.56Easy

What will be the size of the pointer variable on a 64-bit system? int *ptr;

Q.57Easy

What is the output? int arr[] = {10, 20, 30}; int *p = arr; printf("%d %d", *(p+1), arr[1]);

Q.58Medium

What happens when you try to modify a string literal through a pointer? char *str = "Hello"; str[0] = 'J';

Q.59Medium

Consider the code: int *p = NULL; int *q = malloc(sizeof(int)); free(q); free(q); What is the issue here?

Q.60Medium

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

C Programming MCQs & Practice Tests – Free | iGET | iGET