Week 3: Create 10 Quiz questions and answers

Ace your homework & exams now with Quizwiz!

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

Answer: b

Which of the following is an invalid variable? a) my_string_1 b) 1st_string c) foo d) _

Answer: b

All keywords in Python are in _________ a) lower case b) UPPER CASE c) Capitalized d) None of the mentioned

Answer: d

What is the maximum possible length of an identifier? a) 31 characters b) 63 characters c) 79 characters d) none of the mentioned

Answer: d

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

Answer: d

Is Python case sensitive when dealing with identifiers? a) yes b) no c) machine dependent d) none of the mentioned

Answer: a

Which of the following is not a keyword? a) eval b) assert c) nonlocal d) pass

Answer: a

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

Answer: a

Why are local variable names beginning with an underscore discouraged? a) they are used to indicate private variables of a class b) they confuse the interpreter c) they are used to indicate global variables d) they slow down execution

Answer: a

Which of the following cannot be a variable? a) __init__ b) in c) it d) on

Answer: b


Related study sets

Chapter 18- Genetics of Viruses and Bacteria

View Set

Chapter 42: Caring for Clients with Eye Disorders

View Set