Python MCQ’s | Variable Names 1

1.
Is Python case sensitive when dealing with identifiers?

a) yes
b) no
c) machine dependent
d) none of the mentioned

2.
What is the maximum possible length of an identifier?

a) 31 characters
b) 63 characters
c) 79 characters
d) none of the mentioned

3.
Which of the following is invalid?

a) _a = 1
b) __a = 1
c) __str__ = 1
d) none of the mentioned


4.
Which of the following is an invalid variable?

a) my_string_1
b) 1st_string
c) foo
d) _

5.
Why are local variable names beginning with an underscore discouraged?

a) they are used to indicate a private variables of a class
b) they confuse the interpreter
c) they are used to indicate global variables
d) they slow down execution

Visitor Counter

0060759