Contents

Why does the name of local variables start with an underscore discouraged?
a) To identify the variable
b) It confuses the interpreter
c) It indicates a private variable of a class
d) None of these

c

Explanation: Since there is no concept of private variables in Python language, the major underscore is used to denote variables that cannot be accessed from outside the class.


Which of the following is not a keyword in Python language?
a) val                                    
b) raise
c) try                                      
d) with

a

Explanation: "val" is not a keyword in python language.


Which of the following statements is correct for variable names in Python language?
a) All variable names must begin with an underscore.
b) Unlimited length
c) The variable name length is a maximum of 2.
d) All of the above

b

Which of the following declarations is incorrect in python language?
a) xyzp = 5,000,000
b) x y z p = 5000 6000 7000 8000
c) x,y,z,p = 5000, 6000, 7000, 8000
d) x_y_z_p = 5,000,000

b

Explanation: Spaces are not allowed in variable names.


Which of the following words cannot be a variable in python language?
a) _val                                  
b) val
c) try                                     
d) _try_

c

Explanation: "try" is a keyword.


Which of the following operators is the correct option for power(ab)?
a) a ^ b                                  
b) a**b
c) a ^ ^ b                                               
d) a ^ * b

b

Explanation: The power operator in python is a**b, i.e., 2**3=8.