Here Are 100 Quizzes / Multiple-Choice Questions (Mcqs) Based On
C PROGRAMMING
With Correct Answers For 2023
1. What is the primary purpose of the "#include" directive in C?
a) Define a macro
b) Include a header file (Correct)
c) Declare a variable
d) Define a function
3. Which data type is used to store a single character in C?
a) char (Correct)
b) int
c) float
d) double
4. What is the maximum value that can be stored in an "unsigned int" data type?
a) 32767
b) 65535 (Correct)
c) 2147483647
d) 4294967295
,5. What will be the output of the following code snippet?
printf("%d", sizeof(int));
a) 4 (Correct)
b) 2
c) 8
d) Compiler error
6. In C, the expression "x += 5" is equivalent to:
a) x = x + 5 (Correct)
b) x = x - 5
c) x = 5
d) x = 0
7. Which loop is guaranteed to execute at least once?
a) for
b) while
c) do-while (Correct)
d) if
8. What is the purpose of the "break" statement in C?
a) Terminate the current loop iteration
, b) End the program
c) Skip the current iteration and continue the next one
d) Exit the loop or switch statement (Correct)
9. Which function is used to allocate memory dynamically in C?
a) malloc (Correct)
b) new
c) alloc
d) allocate
10. What is the correct way to declare a pointer to an integer in C?
a) int *p;
b) pointer p;
c) int ptr;
d) int &p;
(Correct)
11. Which keyword is used to define a constant in C?
a) constant
b) define
c) const (Correct)
d) constexpr
, 12. What is the purpose of the "strcpy" function in C?
a) Convert a string to uppercase
b) Concatenate two strings
c) Compare two strings
d) Copy one string to another (Correct)
13. What is the output of the following code snippet?
int x = 5; printf("%d", x++);
a) 5
b) 6 (Correct)
c) 4
d) Compiler error
14. What is the size of the "double" data type in bytes?
a) 4
b) 8 (Correct)
c) 16
d) Depends on the system
15. Which of the following is NOT a valid way to initialize an array in C?
a) int arr[] = {1, 2, 3};
C PROGRAMMING
With Correct Answers For 2023
1. What is the primary purpose of the "#include" directive in C?
a) Define a macro
b) Include a header file (Correct)
c) Declare a variable
d) Define a function
3. Which data type is used to store a single character in C?
a) char (Correct)
b) int
c) float
d) double
4. What is the maximum value that can be stored in an "unsigned int" data type?
a) 32767
b) 65535 (Correct)
c) 2147483647
d) 4294967295
,5. What will be the output of the following code snippet?
printf("%d", sizeof(int));
a) 4 (Correct)
b) 2
c) 8
d) Compiler error
6. In C, the expression "x += 5" is equivalent to:
a) x = x + 5 (Correct)
b) x = x - 5
c) x = 5
d) x = 0
7. Which loop is guaranteed to execute at least once?
a) for
b) while
c) do-while (Correct)
d) if
8. What is the purpose of the "break" statement in C?
a) Terminate the current loop iteration
, b) End the program
c) Skip the current iteration and continue the next one
d) Exit the loop or switch statement (Correct)
9. Which function is used to allocate memory dynamically in C?
a) malloc (Correct)
b) new
c) alloc
d) allocate
10. What is the correct way to declare a pointer to an integer in C?
a) int *p;
b) pointer p;
c) int ptr;
d) int &p;
(Correct)
11. Which keyword is used to define a constant in C?
a) constant
b) define
c) const (Correct)
d) constexpr
, 12. What is the purpose of the "strcpy" function in C?
a) Convert a string to uppercase
b) Concatenate two strings
c) Compare two strings
d) Copy one string to another (Correct)
13. What is the output of the following code snippet?
int x = 5; printf("%d", x++);
a) 5
b) 6 (Correct)
c) 4
d) Compiler error
14. What is the size of the "double" data type in bytes?
a) 4
b) 8 (Correct)
c) 16
d) Depends on the system
15. Which of the following is NOT a valid way to initialize an array in C?
a) int arr[] = {1, 2, 3};