Python Variable Names: MCQs Variables In Python

Python Variable Names. Multiple Choice Questions in Python Programming Language related to Variable Names. This section includes 10 Multiple Choice Questions on Variable Names. For detailed Multiple Choice Questions related to Python Programming Language visit Python MCQs

 

Python Variable Names

 

Which of the following cannot be a variable ??

a) __init__
b) in
c) it
d) on

 

Which of the following is an invalid statement ??

a) abc = 1,000,000
b) a b c = 1000 2000 3000
c) a,b,c = 1000, 2000, 3000
d) a_b_c = 1,000,000

 

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

a) unlimited length
b) all private members must have leading and trailing underscores
c) underscore and ampersand are the only two special characters allowed
d) none of the mentioned

 

All keywords in Python are in _________ ??

a) lower case
b) UPPER CASE
c) Capitalized
d) None of the mentioned

 

Which of the following is not a keyword ??

a) eval
b) assert
c) nonlocal
d) pass

 

Python Variable Names

 

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

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

 

Which of the following is an invalid variable ??

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

 

Which of the following is invalid ??
a) _a = 1
b) __a = 1
c) __str__ = 1
d) none of the mentioned

 

What is the maximum possible length of an identifier ??

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

 

Is Python case sensitive when dealing with identifiers ??

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

 

Read More

Leave a Comment

Your email address will not be published. Required fields are marked *

error: Content is protected !!