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
Which pointer operation is NOT valid in C?
What is the output? int arr[2][3] = {{1,2,3}, {4,5,6}}; int *p = (int*)arr; printf("%d", *(p+4));
What does void *ptr represent?
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);
Consider: int arr[] = {1,2,3,4,5}; int *p = arr + 2; What is arr - p?
What is malloc(0) likely to return?
What is the output? char str[] = "ABC"; char *p = str; printf("%c", *(p+2));
Which of the following is correct about pointer assignment? int *p, *q; p = q; // What happens?
What is the output? int x = 5; int *const p = &x; x = 10; printf("%d", *p);
What will be printed? int *p = (int*)malloc(5 * sizeof(int)); int *q = p; p = NULL; free(q);
What is the difference between arr and &arr if arr is an array? int arr[5];
What is the output? int arr[] = {10, 20, 30}; int *p = arr; printf("%d", sizeof(p));
What is the size of a pointer in a 64-bit system?
Consider the code: int x = 10; int *p = &x; int q = &p; What is the value of q?
Which operation is NOT allowed on void pointers in C without explicit casting?
What is the difference between NULL and a wild pointer?
In the expression: int arr[5]; int *p = arr; What does p + 2 represent?
What is the purpose of the const keyword in: int * const p;?
How does free() handle a NULL pointer?
Which scenario demonstrates a dangling pointer?