IDE function: auto-correction

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

IDE function: auto-correction

Name:
Date:
Class:

Quick Questions

Shade in the A or B circle for each question.

1. Which IDE feature fixes a misspelt keyword such as 'pritn' and changes it to 'print'?
A Auto-completion
B Auto-correction
2. A student forgets a closing bracket and the IDE suggests adding ')'. What is this?
A Auto-correction suggesting a fix
B A run-time error reported by the interpreter
3. Auto-correction helps to reduce which type of error?
A Syntax errors
B Logic errors in the algorithm
4. What is the difference between auto-correction and auto-completion?
A Auto-correction finishes code you have started typing; auto-completion fixes mistakes
B Auto-correction fixes mistakes; auto-completion finishes code you have started typing
5. True or false: with auto-correction, the programmer can accept the suggested fix.
A True
B False

Match the Pairs

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

Left columnRight column
1pritn("Hi") changed to print("Hi") AAuto-correction only fixes simple mistakes, such as spelling or a missing bracket. It cannot fix logic errors or bad algorithms.
2print("Hi" with a suggested fix: add ) BAuto-correction fixes a misspelt keyword or function name without the programmer retyping it
3Auto-correction fixes simple typing mistakes, such as a misspelt keyword Cwhiel x < 5: -> while x < 5:
4Auto-correction is different from auto-completion: it repairs a mistake, while auto-completion finishes code being typed DAuto-correction suggests a fix for a missing bracket, and the programmer can accept it
5Claiming: auto-correction suggests the code that finishes the word you are typing EThis describes auto-completion, not auto-correction. Auto-correction fixes mistakes that have already been made.
6Claiming: auto-correction guarantees the program has no errors FAuto-correction: fro -> for | Auto-completion: fo -> for

Definitions

auto-correction

Fill in the Blanks

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

1.
# IDE fixes pritn to the correct word _____("Score: 10")
2.
# IDE fixes the missing closing bracket score = ___(input("Age: "))
3.
# IDE suggests changing fi to the keyword __ score > 5: print("Pass")
4.
total = 5 # IDE suggests fixing totl to the variable print(_____)
5.
# IDE offers a fix for rnage for i in _____(3): print(i)

Spot the Error

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

Question 1
A name = input('Name: ')
B age = int(input('Age: '))
C prnt('Hi ' + name)
Question 2
A total = 0
B for i in range(5):
C total = total + i
D print(total
Question 3
A score = 72
B iff score >= 50:
C print('Pass')
Question 4
A count = 3
B while count > 0:
C pritn(count)
D count = count - 1
Question 5
A items = ['pen', 'ruler']
B for item in items
C print(item)

Answer Key

IDE function: auto-correction
Section A: Quick Questions
Q1
B — Auto-correction
Q2
A — Auto-correction suggesting a fix
Q3
A — Syntax errors
Q4
B — Auto-correction fixes mistakes; auto-completion finishes code you have started typing
Q5
A — True
Section B: Match the Pairs
Q1
pritn("Hi") changed to print("Hi") → Auto-correction fixes a misspelt keyword or function name without the programmer retyping it
Q2
print("Hi" with a suggested fix: add ) → Auto-correction suggests a fix for a missing bracket, and the programmer can accept it
Q3
Auto-correction fixes simple typing mistakes, such as a misspelt keyword → whiel x < 5: -> while x < 5:
Q4
Auto-correction is different from auto-completion: it repairs a mistake, while auto-completion finishes code being typed → Auto-correction: fro -> for | Auto-completion: fo -> for
Q5
Claiming: auto-correction suggests the code that finishes the word you are typing → This describes auto-completion, not auto-correction. Auto-correction fixes mistakes that have already been made.
Q6
Claiming: auto-correction guarantees the program has no errors → Auto-correction only fixes simple mistakes, such as spelling or a missing bracket. It cannot fix logic errors or bad algorithms.
Section C: Definitions
Q1
auto-correction — An IDE feature that fixes, or suggests fixes for, simple mistakes like a misspelt keyword or a missing bracket. The programmer can accept the fix, so fewer syntax errors occur.
Section D: Fill in the Blanks
Q1
# IDE fixes pritn to the correct word print("Score: 10")
Q2
# IDE fixes the missing closing bracket score = int(input("Age: "))
Q3
# IDE suggests changing fi to the keyword if score > 5: print("Pass")
Q4
total = 5 # IDE suggests fixing totl to the variable print(total)
Q5
# IDE offers a fix for rnage for i in range(3): print(i)
Section E: Spot the Error
Q1
C — print is misspelt as prnt. This is a simple typing mistake that auto-correction would spot and suggest fixing to print('Hi ' + name), and the programmer can accept the fix.
Q2
D — The closing bracket is missing. Auto-correction can add the missing ) and so prevent a syntax error. The line should be print(total).
Q3
B — The keyword if is misspelt as iff. Auto-correction would suggest changing it to if, which stops a syntax error.
Q4
C — The letters in print are swapped. Auto-correction fixes or suggests fixes for typing mistakes like this. The line should be print(count).
Q5
B — The colon at the end of the for line is missing. This is a simple mistake that auto-correction can fix or suggest fixing, giving for item in items:.