0% found this document useful (0 votes)
3 views2 pages

C Programming Quiz Questions

The document contains a C programming quiz with ten questions covering variable declaration, data types, output of code snippets, operator precedence, loop behavior, the break statement, the sizeof operator, the main function's return type, and basic arithmetic operations. Each question is followed by multiple-choice answers and the correct answer is provided. It serves as a study tool for individuals looking to test their knowledge of C programming.

Uploaded by

iswarnav
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views2 pages

C Programming Quiz Questions

The document contains a C programming quiz with ten questions covering variable declaration, data types, output of code snippets, operator precedence, loop behavior, the break statement, the sizeof operator, the main function's return type, and basic arithmetic operations. Each question is followed by multiple-choice answers and the correct answer is provided. It serves as a study tool for individuals looking to test their knowledge of C programming.

Uploaded by

iswarnav
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

C Programming Quiz Questions

1. What is the correct syntax to declare a variable in C?


A) int x;
B) x = int;
C) declare x as int;
D) integer x;
Answer: A

2. Which of the following is not a valid C data type?


A) int
B) float
C) boolean
D) char
Answer: C

3. What will be the output of the following code?


int x = 5;
printf("%d", x++);
A) 5
B) 6
C) Undefined
D) Compiler error
Answer: A

4. Which of the following operators has the highest precedence?


A) +
B) &&
C) *
D) =
Answer: C

5. What is the output of the following code snippet?


int a = 10;
if (a > 5)
printf("Yes ");
else
printf("No ");
A) Yes
B) No
C) Yes No
D) No Yes
Answer: A
6. Which loop will always execute at least once, regardless of the condition?
A) for
B) while
C) do-while
D) None of the above
Answer: C

7. What is the function of the break statement in loops?


A) Terminates the program
B) Ends the current loop and transfers control outside the loop
C) Skips the current iteration
D) Pauses the loop temporarily
Answer: B

8. In C, what does the sizeof() operator return?


A) Number of elements in an array
B) Memory size (in bytes) of a variable or data type
C) Length of a string
D) None of the above
Answer: B

9. What is the default return type of the main function in C?


A) int
B) void
C) float
D) char
Answer: A

10. What will be the output of the following code?


int a = 5;
int b = 6;
printf("%d", a + b);
A) 10
B) 11
C) 5
D) 6
Answer: B

You might also like