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.381Easy

Consider the function declaration: void func(int x); and later in the code: int result = func(5);. What will be the compilation result?

Q.382Hard

In a recursive function implementing factorial calculation, the base case is missing. What is the most likely consequence during execution?

Q.383Easy

What is the correct way to declare a 1D array of 10 integers in C?

Q.384Easy

What will be the output of strlen("Hello") in C?

Q.385Easy

Which of the following is NOT a valid string initialization?

Q.386Easy

What does the following code do? strcpy(dest, src);

Q.387Easy

Consider a 2D array declared as: int matrix[3][4]. How many elements does it have?

Q.388Medium

What will be the output of the following code?
char str[] = "Code";
printf("%c", str[2]);

Q.389Medium

What is the difference between char str[] = "Test" and char *str = "Test"?

Q.390Medium

Which function is used to reverse a string in C library?

Q.391Medium

What is the output of the following code?
int arr[] = {10, 20, 30};
printf("%d", sizeof(arr)/sizeof(arr[0]));

Q.392Medium

What will be printed by: printf("%s", "Hello\0World");?

Q.393Medium

Consider: int *ptr = arr; where arr is an array. What does ptr[2] represent?

Q.394Medium

What will the following code output?
char str[20];
strcpy(str, "Competitive");
strcat(str, " Exam");
printf("%s", str);

Q.395Medium

What is the time complexity of searching for an element in an unsorted array of size n?

Q.396Medium

What will be the output of this code?
int arr[5];
for(int i=0; i<5; i++) arr[i] = i*i;
printf("%d %d %d", arr[1], arr[2], arr[4]);

Q.397Hard

Consider a 2D array int matrix[3][3]. If we access matrix as a 1D array, how many total elements can we access?

Q.398Easy

If an integer array arr[10] is declared globally in C, what will be the initial values of its elements?

Q.399Easy

In C, a string is internally represented as:

Q.400Easy

How much memory is allocated for char name[50] declaration?