You are on page 1of 3

Subject Unit Questions

Python Variable Names Is Python case sensitive when dealing with identifiers?
Python Variable Names What is the maximum possible length of an identifier?

Python Variable Names Which of the following is invalid?


Python Variable Names Which of the following is an invalid variable?

Why are local variable names beginning with an underscore


Python Variable Names discouraged?
Python Variable Names Which of the following is not a keyword?

Python Variable Names All keywords in Python are in

Python Variable Names Which of the following is true for variable names in Python?

Python Variable Names Which of the following is an invalid statement?


Option1 Option2 Option3 Option4
Yes No Machin dependent none of the mentioned
31 characters 63 characters 79 characters none of the mentioned

_a = 1 __a = 1 __str__ = 1 none of the mentioned


my_string_1 1st_string foo _
they confuse they are used to
they are used to indicate a private the indicate global they slow down
variables of a class interpreter variables execution
eval assert nonlocal pass

lower case UPPER CASE Capitalized None of the mentioned

all private
members
must have underscore and
leading and ampersand are the
trailing only two special
unlimited length underscores characters allowed none of the mentioned
a b c = 1000 a,b,c = 1000, 2000,
abc = 1,000,000 2000 3000 3000 a_b_c = 1,000,000
CorrectAnswer Explanation
a Case is always significant.
d Identifiers can be of any length.
All the statements will execute successfully but at the cost of
d reduced readability.
b Variable names should not start with a number.
As Python has no concept of private variables, leading
underscores are used to indicate variables that must not be
a accessed from outside the class.
a eval can be used as a variable
True, False and None are capitalized while the others are in
d lower case.

a Variable names can be of any length.

b Spaces are not allowed in variable names.

You might also like