This set of C Multiple Choice Questions & Answers (MCQs) focuses on “Register Variables – 2”.
Pre-requisite for this C MCQ set: Advanced C Programming Video Tutorial.
1. When compiler accepts the request to use the variable as a register?
a) It is stored in CPU
b) It is stored in cache memory
c) It is stored in main memory
d) It is stored in secondary memory
View Answer
Explanation: None.
2. Which data type can be stored in register?
a) int
b) long
c) float
d) all of the mentioned
View Answer
Explanation: None.
3. Which of the following operation is not possible in a register variable?
a) Reading the value into a register variable
b) Copy the value from a memory variable
c) Global declaration of register variable
d) All of the mentioned
View Answer
Explanation: None.
4. Which among the following is the correct syntax to declare a static variable register?
a) static register a;
b) register static a;
c) Both static register a; and register static a;
d) We cannot use static and register together
View Answer
Explanation: None.
5. Register variables reside in ________
a) stack
b) registers
c) heap
d) main memory
View Answer
Explanation: None.
6. What will be the output of the following C code?
#include <stdio.h>
void main()
{
register int x = 0;
if (x < 2)
{
x++;
main();
}
}
a) Segmentation fault
b) main is called twice
c) main is called once
d) main is called thrice
View Answer
Explanation: None.
7. What will be the output of the following C code?
#include <stdio.h>
void main()
{
register int x;
printf("%d", x);
}
a) 0
b) Junk value
c) Compile time error
d) Nothing
View Answer
Explanation: None.
8. What will be the output of the following C code?
#include <stdio.h>
register int x;
void main()
{
printf("%d", x);
}
a) Varies
b) 0
c) Junk value
d) Compile time error
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.
If you find a mistake in question / option / answer, kindly take a screenshot and email to [email protected]
- Practice Computer Science MCQs
- Apply for Computer Science Internship
- Check C Books
- Watch Advanced C Programming Videos
- Practice BCA MCQs