iGET

C Programming - MCQ Practice Questions

Practice free C Programming multiple-choice questions with detailed answers and explanations. Perfect for competitive exam preparation.

972 questions | 100% Free

Q.1Hard

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

Q.2Hard

Consider: int arr[3][4][5]. What is the size of arr[0][0]?

Q.3Hard

Which of the following is true about strcpy(dest, src)?

Q.4Hard

What is the main difference between char arr[] = "Test" and char *ptr = "Test"?

Q.5Hard

If ptr is a pointer to int array and ptr = arr, what does ptr[3] represent?

Q.6Hard

What is the correct way to safely copy strings in modern C?

Q.7Hard

In the declaration int *arr[10], what is arr?

Q.8Hard

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

Q.9Hard

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

Q.10Hard

What happens with this code? char *ptr; char str[] = "Programming"; ptr = str; ptr[2] = 'X';

Q.11Hard

What will the following code print? int arr[3] = {10, 20, 30}; int *p = arr; printf("%d %d", *p++, *++p);

Q.12Hard

How should dynamic 1D array of strings be declared for 5 strings of length 20?

Q.13Hard

What is the most efficient way to copy one array to another in C?

Q.14Hard

What is the relationship between pointer arithmetic and array indexing in C?

Q.15Hard

What potential issue exists with this code: char *ptr = "Hello"; ptr[0] = 'h';?

Q.16Hard

For a 3D array int arr[2][3][4], what is arr[1][2][3] equivalent to?

Q.17Hard

In string handling, what is the difference between fgets() and gets()?

Q.18Hard

Which of the following correctly declares a pointer to an array (not array of pointers)?

Q.19Hard

In what scenario would you use memcpy() instead of strcpy()?

Q.20Hard

What does the strspn() function do?

C Programming MCQs & Practice Tests – Free | iGET | iGET