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

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

Q.442Medium

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

Q.443Medium

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

Q.444Easy

How many times will the following loop execute? int arr[5]; for(int i=0; i<5; i++) arr[i]=0;

Q.445Medium

What is the difference between arr[5] and *arr when arr is an array?

Q.446Medium

Which statement about 2D arrays in C is correct?

Q.447Medium

What is the output? char str[6] = {'H','e','l','l','o'}; printf("%s", str);

Q.448Medium

Consider a 3D array: int arr[2][3][4]. How many elements total?

Q.449Hard

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

Q.450Hard

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

Q.451Hard

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

Q.452Hard

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

Q.453Easy

In C, when you declare an array like int arr[10], what does the array name 'arr' represent?

Q.454Easy

What is the size of the string 'Hello' when stored in a character array with null terminator?

Q.455Easy

Which of the following correctly initializes a 2D array of integers?

Q.456Easy

In the declaration char *str[5], what does the array represent?

Q.457Medium

What will be the result of accessing arr[10] when arr is declared as int arr[5]?

Q.458Medium

What is the difference between char str[20] and char *str in C?

Q.459Easy

How many elements can be stored in a 2D array declared as int matrix[4][5]?

Q.460Medium

What does strcpy(dest, src) do, and what is its main risk?