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.1Easy

What is the correct way to declare a 1D array of 10 integers in C?

Q.2Easy

What will be the output of strlen("Hello") in C?

Q.3Easy

Which of the following is NOT a valid string initialization?

Q.4Easy

What does the following code do? strcpy(dest, src);

Q.5Easy

Consider a 2D array declared as: int matrix[3][4]. How many elements does it have?

Q.6Medium

What will be the output of the following code? char str[] = "Code"; printf("%c", str[2]);

Q.7Medium

What is the difference between char str[] = "Test" and char *str = "Test"?

Q.8Medium

Which function is used to reverse a string in C library?

Q.9Medium

What is the output of the following code? int arr[] = {10, 20, 30}; printf("%d", sizeof(arr)/sizeof(arr[0]));

Q.10Medium

What will be printed by: printf("%s", "Hello\0World");?

Q.11Medium

Consider: int *ptr = arr; where arr is an array. What does ptr[2] represent?

Q.12Medium

What will the following code output? char str[20]; strcpy(str, "Competitive"); strcat(str, " Exam"); printf("%s", str);

Q.13Medium

What is the time complexity of searching for an element in an unsorted array of size n?

Q.14Medium

What will be the output of this code? int arr[5]; for(int i=0; i<5; i++) arr[i] = i*i; printf("%d %d %d", arr[1], arr[2], arr[4]);

Q.15Hard

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

Q.16Hard

What will be output of the following code? char str[] = "GATE2025"; for(int i=0; str[i]!='\0'; i++) if(i%2==0) printf("%c", str[i]);

Q.17Easy

If an integer array arr[10] is declared globally in C, what will be the initial values of its elements?

Q.18Easy

In C, a string is internally represented as:

Q.19Easy

How much memory is allocated for char name[50] declaration?

Q.20Easy

What is the time complexity of accessing an element at index 5 in an array?