0% found this document useful (0 votes)
5 views5 pages

C Programming Variable and Control Flow Quiz

This document contains an assignment for a Programming in C course, specifically focusing on various concepts and syntax related to C programming. It includes multiple-choice questions covering topics such as variable naming, keywords, expressions, typecasting, operators, control statements, and loops. The assignment aims to assess students' understanding of fundamental C programming principles.

Uploaded by

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

C Programming Variable and Control Flow Quiz

This document contains an assignment for a Programming in C course, specifically focusing on various concepts and syntax related to C programming. It includes multiple-choice questions covering topics such as variable naming, keywords, expressions, typecasting, operators, control statements, and loops. The assignment aims to assess students' understanding of fundamental C programming principles.

Uploaded by

himanshdagur02
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

School of Engineering & Technology

PROGRAMMING IN C & EDA-352


UNIT -2
ASSIGNMENT -2

1. Which of the following is not a valid C variable name?


a) int number;
b) float rate;
c) int variable_count;
d) int $main;

2. All keywords in C are in ____


a) LowerCase letters
b) UpperCase letters
c) CamelCase letters
d) None of the mentioned

3. Variable names in C cannot start with


a) A letter
b) An underscore
c) A digit
d) None of the mentioned

4. Which of the following is a valid C expression?


a) int my_num = 100,000;
b) int my_num = 100000;
c) int my num = 1000;
d) int $my_num = 10000;

5. Which of the following cannot be a variable name in C?


a) volatile
b) true
c) friend
d) export

6. Which keyword is used to prevent any changes in a variable?


a) immutable
b) mutable
c) const
d) volatile

7. What is the result of a logical or relational expression in C?


a) True or False
b) 0 or 1
c) 0 if false, any positive number if true
d) None of the mentioned

8. Which of the following typecasting is accepted by C language?


a) Widening conversions
b) Narrowing conversions
c) Widening & Narrowing conversions
d) None of the mentioned

9. Which operator has the highest precedence in C?


a) * (Multiplication)
b) () (Parentheses)
c) + (Addition)
d) = (Assignment)

10. Which statement is used to repeat execution until a condition is false?


a) if
b) else
c) while
d) switch

11. Conditional expressions use which operator in C?


a) ?:
b) &&
c) ||
d) ++

12. Which statement is used for multiple branch selection?


a) if-else
b) switch
c) for
d) goto

13. What does the break statement do in loops?


a) Exits from innermost loop or switch
b) Skips one iteration
c) Exits program
d) Repeats current iteration

14. Which statement transfers control unconditionally in C?


a) continue
b) break
c) goto
d) switch
15. In ‘for’ loop, which part is executed first?
a) Test condition
b) Initialization
c) Increment
d) Body

16. What is the output type for relational operators?


a) Boolean
b) Integer (1 for true, 0 for false)
c) Character
d) Float

17. Which operator is right associative in C?


a) Assignment (=)
b) Addition (+)
c) Multiplication (*)
d) Division (/)

18. Which is NOT a logical operator in C?


a) &&
b) ||
c) !
d) ++

19. The loop that checks the condition after executing the body is
a) for
b) while
c) do-while
d) switch
20. Which of the following leads to infinite loop if not handled properly?
a) If-else
b) Switch-case
c) For
d) While

You might also like