Tip: Choose Save as PDF in the print dialog to download. Use A4 paper size.
Shade in the A or B circle for each question.
Draw a line connecting each item on the left to its match on the right.
| Left column | Right column | |
|---|---|---|
| 1def main(): greet() show_score() | AThe function names are missing brackets (), so greet and show_score are never called | |
| 2total = add_tax(price) | BOne function is doing several jobs (asking, printing and scoring), so it is not one job per function | |
| 3Each box in a hierarchy chart can become its own function | Cdef main(): get_name() play_game() main() | |
| 4A main() function calls the other functions to run the whole program | Ddef draw_board(): print('Board') | |
| 5def main(): greet show_score | EA function call that uses the result of another function (add_tax) to do one part of the job | |
| 6def play(): ask_name() print(score()) def ask_name(): name = input() print(name) add_points(name) | Fmain() calls two smaller functions, greet() and show_score(), so each does one job |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
def main(): — A function that calls other small functions, each doing one job, so the program is built in parts. Each box in a hierarchy chart can become one function.def main():
greet()
show_score()def main():
print("Start")
main()def square(n): return n * n
def area(s): return square(s)
print(area(4))def main():
score = get_score()
show_score(score)# Chart box: Calculate total
def calculate_total():
return 5 + 10