Q. A register variable is stored in a Register. Where does a Register Present in a Computer?

  • (A) RAM ( Random Access Memory )
  • (B) ROM ( Read Only Memory )
  • (C) CPU (Central Processing Unit )
  • (D) DMA ( Direct Memory Access )
πŸ’¬ Discuss
βœ… Correct Answer: (C) CPU (Central Processing Unit )

Q. Variables of type auto, static and extern are all stored in?

  • (A) ROM
  • (B) RAM
  • (C) CPU
  • (D) Compiler
πŸ’¬ Discuss
βœ… Correct Answer: (B) RAM

Q. Which among the following is a Local Variable?

  • (A) register
  • (B) auto
  • (C) static
  • (D) extern
πŸ’¬ Discuss
βœ… Correct Answer: (B) auto

Q. Which among the following is a Global Variable?

  • (A) auto
  • (B) register
  • (C) static
  • (D) extern
πŸ’¬ Discuss
βœ… Correct Answer: (D) extern

Q. Choose a correct statement about static variable.

  • (A) A static global variable can be accessed in other files.
  • (B) A static global variable can be used only in a file in which it is declared.
  • (C) A static global variable can not be declared without extern keyword.
  • (D) Default value of a static variable is -1.
πŸ’¬ Discuss
βœ… Correct Answer: (B) A static global variable can be used only in a file in which it is declared.

Q. Choose right statement

Code:
register float a = 3.14f;
  • (A) Variable a is stored in CPU registers for fast access.
  • (B) Variable a is converted to int and then stored in a CPU register.
  • (C) register Storage Class is ignored and treated as auto float a = 3.14f;
  • (D) You get a compiler error as you can not store non integer value in a CPU register.
πŸ’¬ Discuss
βœ… Correct Answer: (C) register Storage Class is ignored and treated as auto float a = 3.14f;

Q. What is the difference between Declaration and Definition.?

  • (A) Declaration does allocate memory for a variable. Definition does allocate memory for a variable.
  • (B) Declaration does allocate memory for a variable. Definition does not allocate memory for a variable.
  • (C) Declaration does not allocate memory for a variable. Definition does allocate memory for a variable.
  • (D) Declaration does not allocate memory for a variable. Definition does not allocate memory for a variable.
πŸ’¬ Discuss
βœ… Correct Answer: (C) Declaration does not allocate memory for a variable. Definition does allocate memory for a variable.

Q. Choose a right statement.

  • (A) A non static global variable can not be used in included files.
  • (B) A non static global variable can be used or referred to inside included files.
  • (C) A non static global variable does not live till the end of program execution.
  • (D) None of the above
πŸ’¬ Discuss
βœ… Correct Answer: (B) A non static global variable can be used or referred to inside included files.

Q. Choose a right statement.

  • (A) Redeclaration of a variable is Ok.
  • (B) Redefinition of a variable is not Ok.
  • (C) Definition of a variable uses memory blocks.
  • (D) All of the above
πŸ’¬ Discuss
βœ… Correct Answer: (D) All of the above

Q. Choose a correct statement.

  • (A) Register variables are usually fast retrieving variables.
  • (B) Static variables are usually maintain their values between function calls.
  • (C) Auto variables release their memory after the block or function where they are declared.
  • (D) All of the above
πŸ’¬ Discuss
βœ… Correct Answer: (D) All of the above