iGET

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

Q.41Medium

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

Q.42Medium

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

Q.43Easy

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

Q.44Medium

Which of the following will correctly compare two strings?

Q.45Medium

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

Q.46Easy

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

Q.47Medium

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

Q.48Hard

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

Q.49Hard

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

Q.50Medium

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

Q.51Easy

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

Q.52Medium

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

Q.53Easy

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

Q.54Easy

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

Q.55Easy

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

Q.56Medium

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

Q.57Medium

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

Q.58Medium

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

Q.59Medium

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

Q.60Medium

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