Python Exam 1 - Tsvetkova
Is Python case sensitive when dealing with identifiers?
Yes
Which of the following is an invalid statement? Correct! A). a b c = 1000 2000 3000 B). abc = 1,000,000 C). a_b_c = 1,000,000 D). a,b,c = 1000, 2000, 3000
A) a b c = 1000 2000 3000
Which of the following cannot be a variable? A) in B) on C) it D) __init__
A) in
Why are local variable names beginning with an underscore discouraged? A) they are used to indicate a private variables of a class B) they are used to indicate global variables C) they confuse the interpreter D) they slow down execution
A) they are used to indicate a private variables of a class
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) none of the mentioned D) underscore and ampersand are the only two special characters allowed
A) unlimited length
What is the maximum possible length of an identifier? 1) None 2) 79 3) 31 4) 63
1) none
Which of the following is an invalid variable? A) my_string_1 B) 1st_string C) foo D) _
B) 1st_string
Which of the following is invalid? A) __str__ = 1 B) None of the mentioned C) _a = 1 D) __a = 1
B) none of the mentioned
Which of the following is not a keyword? A) pass B) assert C) eval D) nonlocal
C) eval
All keywords in Python are in A. UPPER CASE B. lower case C. Capitalized D. None of the mentioned
D. None of the mentioned