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

Variables in C Programming

The document provides a quiz on variables in C programming, covering topics such as variable definition, valid names, initialization, declaration keywords, storage classes, and character types. Key answers include that a variable is a name for a memory location, valid names must follow specific rules, and the default storage class is 'auto'. It also clarifies that variable names can start with an underscore and identifies invalid variable types.

Uploaded by

Vijaya kumari
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)
55 views2 pages

Variables in C Programming

The document provides a quiz on variables in C programming, covering topics such as variable definition, valid names, initialization, declaration keywords, storage classes, and character types. Key answers include that a variable is a name for a memory location, valid names must follow specific rules, and the default storage class is 'auto'. It also clarifies that variable names can start with an underscore and identifies invalid variable types.

Uploaded by

Vijaya kumari
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

Variables

1.​ What is a variable in C?​


a) A constant value​
b) A name given to a memory location​
c) A loop​
d) A function​
Answer: b) A name given to a memory location​

2.​ Which of the following is a valid variable name?​


a) 1stvalue​
b) total%​
c) total_value​
d) int​
Answer: c) total_value​

3.​ What will be the value of an uninitialized local variable?​


a) 0​
b) NULL​
c) Garbage value​
d) -1​
Answer: c) Garbage value​

4.​ Which keyword is used to declare a variable in C?​


a) dim​
b) var​
c) int​
d) declare​
Answer: c) int​

5.​ How many times can a variable be declared in a scope?​


a) Only once​
b) Twice​
c) Any number of times​
d) Never​
Answer: a) Only once​
6.​ Which of the following is not a valid variable type?​
a) int​
b) float​
c) real​
d) char​
Answer: c) real​

7.​ What is the default storage class of a variable?​


a) auto​
b) static​
c) register​
d) extern​
Answer: a) auto​

8.​ Which variable type can store a single character?​


a) int​
b) float​
c) char​
d) double​
Answer: c) char​

9.​ Which of the following is NOT a correct variable name in C?​


a) total1​
b) _count​
c) value#1​
d) result​
Answer: c) value#1​

10.​ Can variable names start with an underscore in C?​


a) Yes​
b) No​
Answer: a) Yes

You might also like