Contents

Scope of Variables


How many scopes of variables in C++ program?
a) one  
b) two 
c) three
d) four

c

Explanation: local scope, Global scope, Static scope



The variables defined within a block are called….
a) global variable         
b) local variable
c) static variable          
d) none of these

b



The variables defined usually at the top of program before the main function are called….
a) global variable       
b) local variable
c) static variable          
d) none of these

a

The variables, which are preceded by the keyword static is called….
a) global variable         
b) local variable
c) static variable         
d) none of these

c



Which of the following is the correct format of static variables?
a) local variable-name;             
b) static variable-name;
c) variable-name local;             
d) variable-name static

b