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

Which function is used to find the first occurrence of a character in a string?

Q.422Medium

What will be the output?
char arr[] = "ABC";
printf("%d", sizeof(arr));

Q.423Medium

Consider the code: int *p; int arr[5] = {10, 20, 30, 40, 50}; p = arr; What is *(p+2)?

Q.424Easy

What will be printed?
char *str = "Hello";
printf("%c", str[1]);

Q.425Medium

Which of the following will correctly compare two strings?

Q.426Medium

What is the correct syntax to concatenate two strings safely in modern C?

Q.427Easy

Predict the output:
int arr[3][3] = {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}};
printf("%d", arr[1][2]);

Q.428Medium

What does the following code do?
char str[] = "HELLO";
for(int i = 0; str[i]; i++) str[i] = str[i] + 32;

Q.429Hard

In a dynamic 2D array created as: int arr = (int)malloc(rows * sizeof(int*)); What is the next step?

Q.430Hard

What will happen?
char arr[5] = "Hello";
printf("%d", strlen(arr));

Q.431Medium

Consider: char str[10]; strcpy(str, "Hello"); What is the state of memory after this?

Q.432Easy

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

Q.433Medium

What does strtok(str, delim) return on each call until the string ends?

Q.434Easy

What is the maximum size of a string that can be stored in char str[50]?

Q.435Easy

Which function is used to find the length of a string in C?

Q.436Easy

How many bytes does a 2D array int arr[3][4] occupy in memory?

Q.437Medium

What is the correct way to declare a pointer to a character array?

Q.438Medium

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

Q.439Medium

Which of the following correctly reverses a string in-place?

Q.440Medium

What is the output of the following code?
char str[] = "GATE";
printf("%d", sizeof(str));