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? 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)?
What will be printed? char *str = "Hello"; printf("%c", str[1]);
Which of the following will correctly compare two strings?
What is the correct syntax to concatenate two strings safely in modern C?
Predict the output: int arr[3][3] = {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}}; printf("%d", arr[1][2]);
What does the following code do? char str[] = "HELLO"; for(int i = 0; str[i]; i++) str[i] = str[i] + 32;
In a dynamic 2D array created as: int arr = (int)malloc(rows * sizeof(int*)); What is the next step?
What will happen? char arr[5] = "Hello"; printf("%d", strlen(arr));
Consider: char str[10]; strcpy(str, "Hello"); What is the state of memory after this?
What is the output? int arr[] = {10, 20, 30, 40}; int *p = arr; printf("%d", p[2]);
What does strtok(str, delim) return on each call until the string ends?
What is the maximum size of a string that can be stored in char str[50]?
Which function is used to find the length of a string in C?
How many bytes does a 2D array int arr[3][4] occupy in memory?
What is the correct way to declare a pointer to a character array?
What happens when you try to modify a string literal in C? char *str = "Hello"; str[0] = 'J';
Which of the following correctly reverses a string in-place?
What is the output of the following code? char str[] = "GATE"; printf("%d", sizeof(str));
Consider: int arr[10]; int *ptr = arr; What does ptr[5] represent?