Dive into the world of C programming with this engaging quiz that tests your understanding of one of the most powerful and versatile programming languages. Whether you’re a novice or an experienced coder, these questions will challenge your knowledge and help you refine your skills. Ready to put your C programming knowledge to the test? Let’s get started!
We recommend that you do not leave the page that you are taking this quiz in. Stay honest 🙂
C Programming Quiz Questions Overview
1. What is the correct syntax to declare a variable in C?
int variable_name;
variable int_name;
int variable-name;
int variableName;
2. Which of the following is a correct comment in C?
// This is a comment
/* This is a comment */
# This is a comment
— This is a comment
3. Which function is used to print output to the screen in C?
print()
output()
printf()
write()
4. What is the output of the following code: printf(“%d”, 5 + 3);?
5
3
8
53
5. Which of the following is not a valid C data type?
int
float
char
real
6. What is the correct way to declare a constant in C?
const int MAX = 100;
constant int MAX = 100;
int const MAX = 100;
int MAX = const 100;
7. Which operator is used to access the value of a variable through its pointer?
&
*
->
.
8. What is the purpose of the ‘return’ statement in a function?
To exit the program
To exit the function and return a value
To declare a variable
To print a value
9. Which of the following loops will execute at least once?
for loop
while loop
do-while loop
None of the above
10. What is the size of an int data type in C?
2 bytes
4 bytes
8 bytes
Depends on the system
11. Which keyword is used to define a macro in C?
macro
define
const
typedef
12. Which function is used to read a string from the user in C?
scanf()
gets()
fgets()
read()
13. What is the correct syntax to declare a pointer in C?
int* ptr;
int ptr*;
int *ptr;
ptr int*;
14. Which of the following is used to allocate memory dynamically in C?
malloc()
alloc()
memalloc()
calloc()
15. What is the output of the following code: printf(“%d”, sizeof(char));?
1
2
4
8
16. Which of the following is not a storage class specifier in C?
auto
register
static
public
We recommend that you do not leave the page that you are taking this quiz in. Stay honest 🙂

















