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
What will be the output of the following code? char str[] = "Code"; printf("%c", str[2]);
What is the difference between char str[] = "Test" and char *str = "Test"?
Which function is used to reverse a string in C library?
What is the output of the following code? int arr[] = {10, 20, 30}; printf("%d", sizeof(arr)/sizeof(arr[0]));
What will be printed by: printf("%s", "Hello\0World");?
Consider: int *ptr = arr; where arr is an array. What does ptr[2] represent?
What will the following code output? char str[20]; strcpy(str, "Competitive"); strcat(str, " Exam"); printf("%s", str);
What is the time complexity of searching for an element in an unsorted array of size n?
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]);
Which of the following correctly declares and initializes a 2D array?
What is the relationship between array name and pointer in C?
If str = "Hello", what is the value of str[5]?
In a 2D array int matrix[4][5], which statement about memory layout is true?
What is the output of sizeof(arr)/sizeof(arr[0]) when arr is declared as int arr[10]?
Which string function modifies the original string in-place?
What happens when you try to modify a string literal in C?
What is the time complexity of inserting an element at the beginning of an unsorted array?
Which function is used to find the first occurrence of a character in a string?
What will be the output? char arr[] = "ABC"; printf("%d", sizeof(arr));
Consider the code: int *p; int arr[5] = {10, 20, 30, 40, 50}; p = arr; What is *(p+2)?