WorksheetsTech Essentials — Chapter 9 Exam (Grade 6)
Total questions: 15
Worksheet time: 9mins
Which Python function is used to gather user input or responses?
input()
gather()
print()
ask()
The Python input function will return a string if the user enters text input and an integer if the user enters numeric input.
True
False
Boolean expressions can only have true or false answers.
True
False
What is "iteration"?
The act of repeating something.
The act of replacing something.
The act of branching decisions.
The act of sequential execution.
When a "for" loop ends, where does the program flow continue?
At the first non-indented statement after the loop body
Program flow resumes at the statement directly above the "for" keyword
The entire program halts immediately when the loop is done
for() loops, by design, will never end
In the code below, which statement(s) are part of the "for" loop body? sum = 0 # LINE 1 for index in range(0,10): # LINE 2 sum = sum + index # LINE 3 print(str(sum)) # LINE 4
LINE 3 only
LINES 2 and 3 only
LINE 1 and 4 only
LINES 1, 2, and 3 only
A "nested loop" is a loop within another loop.
True
False
Which of the following is a valid nested "for" loop in Python?
for i in range(1,5):\n for j in range(6,10):\n print(i)\n print(j)
for i in range(1,5):\n for j in range(6,10):\n print(i)\n print(j)
for i in range(1,5):\n print(i)\n print(j)
for i in range(1,5) and j in range(6,10):\n print(i)\n print(j)
What will be displayed on the screen when the following code is run? data = "count" result = "" for x in data: result = result + x + "#" print(result)
c#o#u#n#t#
count
#t
#####
How do you create nested loops in Blockly?
Place a "Repeat N times" block inside another "Repeat N times" block
You cannot do nested loops in Blockly, only in Python
Place one "Repeat N times" block, then place a second "Repeat N times" block after the first is finished
Place a "Repeat N times" block inside a "Print" block
Indentation is very important when creating "for" loops and "if" and "elif" statements in Python
True
False
Ms. Liao has a cat
True
False
What makes a program "interactive"?
When it provides extra output.
There's no such thing
When it asks for user input as well as providing output
When it only asks for input.
A (a) is most often associated with Blockly.
(a) is the healthcare robot in Big Hero 6.
