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

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

Q.2Medium

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

Q.3Medium

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

Q.4Medium

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

Q.5Medium

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

Q.6Medium

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

Q.7Medium

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

Q.8Medium

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

Q.9Medium

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

Which of the following correctly declares and initializes a 2D array?

Q.11Medium

What is the relationship between array name and pointer in C?

Q.12Medium

If str = "Hello", what is the value of str[5]?

Q.13Medium

In a 2D array int matrix[4][5], which statement about memory layout is true?

Q.14Medium

What is the output of sizeof(arr)/sizeof(arr[0]) when arr is declared as int arr[10]?

Q.15Medium

Which string function modifies the original string in-place?

Q.16Medium

What happens when you try to modify a string literal in C?

Q.17Medium

What is the time complexity of inserting an element at the beginning of an unsorted array?

Q.18Medium

Which function is used to find the first occurrence of a character in a string?

Q.19Medium

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

Q.20Medium

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