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

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

Q.542Medium

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

Q.543Medium

Which pointer operation is NOT valid in C?

Q.544Medium

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

Q.545Easy

What does void *ptr represent?

Q.546Easy

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);

Q.547Hard

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

Q.548Hard

What is malloc(0) likely to return?

Q.549Easy

What is the output? char str[] = "ABC"; char *p = str; printf("%c", *(p+2));

Q.550Medium

Which of the following is correct about pointer assignment? int *p, *q; p = q; // What happens?

Q.551Medium

What is the output? int x = 5; int *const p = &x; x = 10; printf("%d", *p);

Q.552Hard

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

Q.553Hard

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

Q.554Medium

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

Q.555Easy

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

Q.556Medium

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

Q.557Medium

Which operation is NOT allowed on void pointers in C without explicit casting?

Q.558Medium

What is the difference between NULL and a wild pointer?

Q.559Medium

In the expression: int arr[5]; int *p = arr; What does p + 2 represent?

Q.560Medium

What is the purpose of the const keyword in: int * const p;?