IDE function: auto-completion

Tip: Choose Save as PDF in the print dialog to download. Use A4 paper size.

IDE function: auto-completion

Name:
Date:
Class:

Quick Questions

Shade in the A or B circle for each question.

1. A programmer types 'pri' and the IDE shows a list including 'print'. Which IDE feature is this?
A Auto-completion
B Prettyprint
2. Which statement about auto-completion is correct?
A It offers a suggestion list while the programmer is typing
B It runs the program one line at a time to find errors
3. Why is auto-completion useful to a programmer?
A It translates the whole program into machine code
B It saves typing time because the name is finished for them
4. A variable is called totalScore. How does auto-completion help avoid mistakes?
A It changes totalScore to a shorter name automatically
B It suggests totalScore so it is not misspelt as totalScroe
5. Which describes the difference between auto-completion and auto-correction?
A Auto-completion suggests the rest of a name; auto-correction fixes a mistake that has already been typed
B Auto-completion fixes typing mistakes; auto-correction finishes names

Match the Pairs

Draw a line connecting each item on the left to its match on the right.

Left columnRight column
1pri AThe programmer has typed only the first letters, so the IDE shows a suggestion list that includes print.
2totalScore BAuto-completion only saves the programmer typing time and reduces spelling mistakes. It has no effect on how fast the program runs.
3Auto-completion reduces spelling mistakes in names because the programmer picks the name from the list instead of typing it all. CThis describes auto-correction, not auto-completion. Auto-completion suggests or finishes a name while you are still typing it.
4Auto-completion is different from auto-correction: it offers to finish what you are typing, while auto-correction fixes errors that were already typed. DA long variable name that auto-completion lets you finish by typing just a few letters and pressing Tab or Enter.
5Auto-completion automatically fixes pritn to print after you type it EAuto-completion: ran -> range Auto-correction: pritn -> print
6Auto-completion makes the program run faster when it is executed FplayerScore chosen from list, not typed as plyerScore

Definitions

auto-completion

Fill in the Blanks

Complete each line of code by filling in the missing parts.

1.
playerScore = 10 print(___________)
2.
_____("Hello")
3.
# The IDE shows a __________ list
4.
# Finishes a name as you type: # auto-__________
5.
word = "cloud" print(___(word))

Spot the Error

Shade in the letter of the line that contains an error.

Question 1
A score = 10
B total = scroe + 5
C print(total)
Question 2
A colour = 'red'
B size = 4
C print(color, size)
Question 3
A items = [1, 2, 3]
B count = len(items)
C print(cuont)
Question 4
A totl = 0
B for n in range(3):
C total = total + n
D print(total)
Question 5
A def greet(nmae):
B print('Hi ' + name)
C greet('Sam')

Answer Key

IDE function: auto-completion
Section A: Quick Questions
Q1
A — Auto-completion
Q2
A — It offers a suggestion list while the programmer is typing
Q3
B — It saves typing time because the name is finished for them
Q4
B — It suggests totalScore so it is not misspelt as totalScroe
Q5
A — Auto-completion suggests the rest of a name; auto-correction fixes a mistake that has already been typed
Section B: Match the Pairs
Q1
pri → The programmer has typed only the first letters, so the IDE shows a suggestion list that includes print.
Q2
totalScore → A long variable name that auto-completion lets you finish by typing just a few letters and pressing Tab or Enter.
Q3
Auto-completion reduces spelling mistakes in names because the programmer picks the name from the list instead of typing it all. → playerScore chosen from list, not typed as plyerScore
Q4
Auto-completion is different from auto-correction: it offers to finish what you are typing, while auto-correction fixes errors that were already typed. → Auto-completion: ran -> range Auto-correction: pritn -> print
Q5
Auto-completion automatically fixes pritn to print after you type it → This describes auto-correction, not auto-completion. Auto-completion suggests or finishes a name while you are still typing it.
Q6
Auto-completion makes the program run faster when it is executed → Auto-completion only saves the programmer typing time and reduces spelling mistakes. It has no effect on how fast the program runs.
Section C: Definitions
Q1
auto-completion — An IDE feature that suggests or finishes a keyword, function or variable name as you start typing it. It saves time and cuts spelling mistakes in names.
Section D: Fill in the Blanks
Q1
playerScore = 10 print(playerScore)
Q2
print("Hello")
Q3
# The IDE shows a suggestion list
Q4
# Finishes a name as you type: # auto-completion
Q5
word = "cloud" print(len(word))
Section E: Spot the Error
Q1
B — The variable name score is misspelled as scroe, so Python cannot find it. Auto-completion would suggest score after typing sc, which avoids this mistake. The line should be total = score + 5.
Q2
C — The variable was created as colour, but color was typed here, so the name does not exist. Picking colour from the auto-completion suggestion list would use the exact name. The line should be print(colour, size).
Q3
C — The variable count is misspelled as cuont, which causes a name error. Auto-completion suggests existing names as you type, so it cuts spelling mistakes like this. The line should be print(count).
Q4
A — The variable is created as totl, but total is used later, so the program fails. Auto-completion helps you type the same name each time. The line should be total = 0.
Q5
A — The parameter name is misspelled as nmae, but the body uses name. A suggestion list while typing would help keep the spelling the same. The line should be def greet(name):.