PCAP-31-03 practice question 16 of 25
Which of the following words can be used as a variable name? (Select two valid names)
Full set: 147 questionsAn identifier in Python must start with a letter or underscore and must not be a reserved keyword or a Boolean literal (Language Reference § 2.3). “true” and “For” satisfy the lexical rules and are not reserved; “for” is a keyword and “True” is the Boolean literal, so both are forbidden.
A – ‘for’ is a reserved keyword. B – ‘True’ is the Boolean constant, reserved and immutable.
1. Python Software Foundation. “Lexical Analysis”, § 2.3 Identifiers and keywords (https://docs.python.org/3/reference/lexicalanalysis.html#identifiers).
2. Stanford CS41, “Python Style & Idioms”, slide 6 – Reserved words list.
Keep practicing
Take the free PCAP-31-03 practice test
Ten exam-style questions with answers and explanations, plus the exam facts and study guides.
More questions
Other PCAP-31-03 practice questions
- Question 3How many elements will the list2 list contain after execution of the following snippet? l…
- Question 6Select the valid fun () invocations: (select two answers) def fun (a, b=0): return a*b
- Question 7Is it possible to safely check if a class object has a certain attribute0
- Question 10Which of the equations are True? (Select two answers)
- Question 13Which of the following lambda function definitions are correct? (Select two answers)
- Question 15Which of the following invocations are valid? (Select two answers)
