C MCQ set number 00714

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

Answer

Answer: a [Reason:] None.

2. Which data type can be stored in register?
a) int
b) long
c) float
d) all of the mentioned

Answer

Answer: d [Reason:] 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

Answer

Answer: d [Reason:] 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

Answer

Answer: d [Reason:] None.

5. Register variables reside in
a) stack
b) registers
c) heap
d) main memory

Answer

Answer: b [Reason:] None.

6. What is the output of this C code?

  1.     #include <stdio.h>
  2.     void main()
  3.     {
  4.         register int x = 0;
  5.         if (x < 2)
  6.         {
  7.             x++;
  8.             main();
  9.         }
  10.     }

a) Segmentation fault
b) main is called twice
c) main is called once
d) main is called thrice

Answer

Answer: a [Reason:] None.

7. What is the output of this C code?

  1.     #include <stdio.h>
  2.     void main()
  3.     {
  4.         register int x;
  5.         printf("%d", x);
  6.     }

a) 0
b) Junk value
c) Compile time error
d) Noting

Answer

Answer: b [Reason:] None.

8. What is the output of this C code?

  1.     #include <stdio.h>
  2.     register int x;
  3.     void main()
  4.     {
  5.         printf("%d", x);
  6.     }

a) Varies
b) 0
c) Junk value
d) Compile time error

Answer

Answer: d [Reason:] None.

ed010d383e1f191bdb025d5985cc03fc?s=120&d=mm&r=g

DistPub Team

Distance Publisher (DistPub.com) provide project writing help from year 2007 and provide writing and editing help to hundreds student every year.