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

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

Q.2Easy

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

Q.3Easy

Which of the following is NOT a valid string initialization?

Q.4Easy

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

Q.5Easy

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

Q.6Medium

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

Q.7Medium

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

Q.8Medium

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

Q.9Medium

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

Q.10Medium

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

Q.11Medium

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

Q.12Medium

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

Q.13Medium

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

Q.14Medium

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

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

Q.16Easy

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

Q.17Easy

In C, a string is internally represented as:

Q.18Easy

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

Q.19Easy

What is the time complexity of accessing an element at index 5 in an array?

Q.20Medium

Which of the following correctly declares and initializes a 2D array?