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

Which of the following will correctly compare two strings?

Q.22Medium

What is the correct syntax to concatenate two strings safely in modern C?

Q.23Medium

What does the following code do? char str[] = "HELLO"; for(int i = 0; str[i]; i++) str[i] = str[i] + 32;

Q.24Medium

Consider: char str[10]; strcpy(str, "Hello"); What is the state of memory after this?

Q.25Medium

What does strtok(str, delim) return on each call until the string ends?

Q.26Medium

What is the correct way to declare a pointer to a character array?

Q.27Medium

What happens when you try to modify a string literal in C? char *str = "Hello"; str[0] = 'J';

Q.28Medium

Which of the following correctly reverses a string in-place?

Q.29Medium

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

Q.30Medium

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

Q.31Medium

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

Q.32Medium

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

Q.33Medium

Which statement about 2D arrays in C is correct?

Q.34Medium

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

Q.35Medium

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

Q.36Medium

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

Q.37Medium

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

Q.38Medium

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

Q.39Medium

In a string comparison, strcmp('Apple', 'apple') returns:

Q.40Medium

What is the memory layout of a 2D array int arr[3][4] in C?