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

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

Q.42Easy

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

Q.43Medium

Which of the following will correctly compare two strings?

Q.44Medium

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

Q.45Easy

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

Q.46Medium

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

Q.47Hard

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

Q.48Hard

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

Q.49Medium

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

Q.50Easy

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

Q.51Medium

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

Q.52Easy

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

Q.53Easy

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

Q.54Easy

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

Q.55Medium

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

Q.56Medium

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

Q.57Medium

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

Q.58Medium

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

Q.59Medium

Consider: int arr[10]; int *ptr = arr; What does ptr[5] represent?

Q.60Medium

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