250+ TOP MCQs on Automatic Variables and Answers

C helps anyone preparing for Samsung and other companies C interviews. One should practice these Objective Questions and answers continuously for 2-3 months to clear Samsung interviews on C Programming language.

Here is a listing of online C test questions on “Automatic Variables” along with answers, explanations and/or solutions:

1. Automatic variables are _________
a) Declared within the scope of a block, usually a function
b) Declared outside all functions
c) Declared with the auto keyword
d) Declared within the keyword extern
Answer: a
Clarification: None.

2. What is the scope of an automatic variable?
a) Exist only within that scope in which it is declared
b) Cease to exist after the block is exited
c) Exist only within that scope in which it is declared & exist after the block is exited
d) All of the mentioned
Answer: c
Clarification: None.

3. Automatic variables are allocated memory in ___________
a) heap
b) Data segment
c) Code segment
d) stack
Answer: d
Clarification: None.

4. What will be the x in the following C code?

  1.     #include 
  2.     void main()
  3.     {
  4.         int x;
  5.     }

a) automatic variable
b) static variable
c) register variable
d) global variable
Answer: a
Clarification: None.

5. Automatic variables are initialized to ___________
a) Zero
b) Junk value
c) Nothing
d) Both Zero & Junk value
Answer: b
Clarification: None.

6. Which of the following storage class supports char data type?
a) register
b) static
c) auto
d) all of the mentioned
Answer: d
Clarification: None.

7. A local variable declaration with no storage class specified is by default _________
a) auto
b) extern
c) static
d) register
Answer: a
Clarification: None.

contest

Leave a Reply

Your email address will not be published. Required fields are marked *