This set of C Multiple Choice Questions & Answers (MCQs) focuses on “Automatic Variables – 1”.
Pre-requisite for this C MCQ set: Advanced C Programming Video Tutorial.
1. What is the scope of an automatic variable?
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
View Answer
Explanation: None.
2. Automatic variables are allocated space in the form of a __________
a) stack
b) queue
c) priority queue
d) random
View Answer
Explanation: None.
3. Which of the following is a storage specifier?
a) enum
b) union
c) auto
d) volatile
View Answer
Explanation: None.
4. If storage class is not specified for a local variable, then the default class will be auto.
a) True
b) False
c) Depends on the standard
d) None of the mentioned
View Answer
Explanation: None.
5. What will be the output of the following C code?
#include <stdio.h>
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
View Answer
Explanation: None.
6. Automatic variables are stored in ________
a) stack
b) data segment
c) register
d) heap
View Answer
Explanation: None.
7. What linkage does automatic variables have?
a) Internal linkage
b) External linkage
c) No linkage
d) None of the mentioned
View Answer
Explanation: None.
8. What will be the output of the following C code?
#include <stdio.h>
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
View Answer
Explanation: None.
Sanfoundry Global Education & Learning Series – C Programming Language.
To practice all areas of C language, here is complete set of 1000+ Multiple Choice Questions and Answers.
- Get Free Certificate of Merit in C Programming
- Participate in C Programming Certification Contest
- Become a Top Ranker in C Programming
- Take C Programming Tests
- Chapterwise Practice Tests: Chapter 1, 2, 3, 4, 5, 6, 7, 8, 9, 10
- Chapterwise Mock Tests: Chapter 1, 2, 3, 4, 5, 6, 7, 8, 9, 10
- Watch Advanced C Programming Videos
- Apply for Computer Science Internship
- Buy C Books
- Practice Computer Science MCQs
- Apply for C Internship