C Programming Questions and Answers on Automatic Variables for Freshers

https://www.computersprofessor.com/2017/12/c-programming-questions-and-answers-on_8.html
1. The scope of an automatic variable is:
a) Within the block it appears
b) Within the blocks of the block it appears
c) Until the end of program
d) Within the block it appears & Within the blocks of the block it appears
Answer: d
2. Automatic variables are allocated space in the form of a:
a) stack
b) queue
c) priority queue
d) random
Answer: a
3. Which of the following is a storage specifier?
a) enum
b) union
c) auto
d) volatile
Answer: c
4. Default storage class if not any is specified for a local variable, is auto
a) true
b) false
c) Depends on the standard
d) None of the mentioned
Answer: a
5. What is the output of this C code?
#include
void foo(auto int i);
int main()
{
foo(10);
}
void foo(auto int i)
{
printf("%d\n", i );
}
a) 10
b) Compile time error
c) Depends on the standard
d) None of the mentioned
b) Compile time error
c) Depends on the standard
d) None of the mentioned
Answer: b
6. Automatic variables are stored in
a) stack
b) data segment
c) register
d) heap
Answer: a
7. What linkage does automatic variables have?
a) Internal linkage
b) External linkage
c) No linkage
d) None of the mentioned
Answer: c
8. What is the output of this C code?
#include
int main()
{
auto i = 10;
const auto int *p = &i;
printf("%d\n", i);
}
a) 10
b) Compile time error
c) Depends on the standard
d) Depends on the compiler
b) Compile time error
c) Depends on the standard
d) Depends on the compiler
Answer: a
9. Automatic variables are variables that are
a) Declared within the scope of a block, usually a function
b) Declared outside all functions
c) Declared with auto keyword
d) Declared within the keyword extern
Answer: a
10. Automatic variables
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) Only 1
Answer: c
11. Automatic variables are allocated memory in
a) heap
b) Data segment
c) Code segment
d) stack
Answer: d
12. What is the output of this C code?
#include
void main()
{
int x;
}
here x is
a) automatic variable
b) static variable
c) register variable
d) global variable.
a) automatic variable
b) static variable
c) register variable
d) global variable.
Answer: a
13. Automatic variables are initialised to
a) Zero
b) Junk value
c) Nothing
d) Both Zero & Junk value
Answer: b
14. Which of the following storage class supports char data type?
a) register
b) static
c) auto
d) all of the mentioned
Answer: d
15. The variable declaration with no storage class specified is by default:
a) auto
b) extern
c) static
d) register
Answer: a