C859 PYTHON SYNTAX FREQUENTLY TESTED ACTUAL
EXAM QUESTIONS WITH CORRECT ANSWERS
Question 1.
ANSWER
inserts variable data in a string
Question 2.
break
ANSWER
loop command that stops iteration prematurely
Question 3.
ANSWER
reassignment operator, subtracts
Question 4.
mylist[:3]
ANSWER
slices list beginning with first element and including through the third element.
Index position 3 is not included in selection.
Question 5.
>
ANSWER
greater than
, Question 6.
read()
ANSWER
reads data from open file
Question 7.
1.2
ANSWER
float
Question 8.
myPhone = (877, 435, 7948)
ANSWER
creates a tuple
Question 9.
for city in cities:
ANSWER
iterates over items within a list
Question 10.
def myfunction():
ANSWER
syntax for function declaration
Question 11.
sorted()
ANSWER
returns copy of list ordered smallest to largest
EXAM QUESTIONS WITH CORRECT ANSWERS
Question 1.
ANSWER
inserts variable data in a string
Question 2.
break
ANSWER
loop command that stops iteration prematurely
Question 3.
ANSWER
reassignment operator, subtracts
Question 4.
mylist[:3]
ANSWER
slices list beginning with first element and including through the third element.
Index position 3 is not included in selection.
Question 5.
>
ANSWER
greater than
, Question 6.
read()
ANSWER
reads data from open file
Question 7.
1.2
ANSWER
float
Question 8.
myPhone = (877, 435, 7948)
ANSWER
creates a tuple
Question 9.
for city in cities:
ANSWER
iterates over items within a list
Question 10.
def myfunction():
ANSWER
syntax for function declaration
Question 11.
sorted()
ANSWER
returns copy of list ordered smallest to largest