IDE function: translators

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

IDE function: translators

Name:
Date:
Class:

Quick Questions

Shade in the A or B circle for each question.

1. Which statement about a translator inside an IDE is correct?
A An IDE can include a built-in compiler or interpreter
B An IDE can only work with a separate translator program
2. A student clicks the Run button in an IDE and their code is translated and executed. What makes this possible?
A A separate translator the student must open first
B The built-in translator in the IDE
3. Which of these can be the built-in translator of an IDE?
A A compiler or an interpreter
B An assembler only
4. A programmer uses an IDE with a built-in translator. Which statement is true?
A They can translate their code without using separate software
B They must save the code and open a separate translator to run it
5. Many IDEs are made for one specific language, such as Python. What translator would a Python IDE usually include?
A One that translates every programming language
B One that translates Python code

Match the Pairs

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

Left columnRight column
1Run button in an IDE AUses the built-in translator to translate the source code and then run it, all from one click
2IDLE for Python BBuild button -> compiler -> executable file
3An IDE has a built-in translator, so the programmer does not need separate translator software CA language-specific IDE with a built-in interpreter that translates Python code line by line
4The built-in translator in an IDE can be a compiler that turns the whole program into machine code DWrite code in the editor -> click Run -> see the output
5Before using an IDE, I must install a separate compiler and run it by hand EThe built-in translator translates the code so it can be run, often from one button, and is not just a checker.
6The built-in translator in an IDE only checks the code and cannot run it FAn IDE already includes a built-in translator, so the programmer does not need separate translator software to translate the code.

Definitions

built-in translator

Fill in the Blanks

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

1.
ide.hasTranslator = True needsSeparate = _____
2.
program = load("game.py") ide.___(program)
3.
IF ide.hasTranslator ____ ide.run(code) ENDIF
4.
ide = PythonIDE() ide.__________ = "interpreter"
5.
separateNeeded = ___ ide.hasTranslator

Spot the Error

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

Question 1
A ide = "IDLE"
B translator = interpreter
C print(ide)
D print(translator)
Question 2
A ide = "Thonny"
B translator = "interpreter"
C built_in = False
D if built_in:
E print("Press Run")
Question 3
A ide = "Python IDE
B language = "Python"
C print(ide, language)
Question 4
A button = "Run"
B if button == "Run":
C print("Translating...)
D print("Program running")
Question 5
A kind == "language-specific"
B language = "Java"
C ide = "BlueJ"
D print(kind)

Answer Key

IDE function: translators
Section A: Quick Questions
Q1
A — An IDE can include a built-in compiler or interpreter
Q2
B — The built-in translator in the IDE
Q3
A — A compiler or an interpreter
Q4
A — They can translate their code without using separate software
Q5
B — One that translates Python code
Section B: Match the Pairs
Q1
Run button in an IDE → Uses the built-in translator to translate the source code and then run it, all from one click
Q2
IDLE for Python → A language-specific IDE with a built-in interpreter that translates Python code line by line
Q3
An IDE has a built-in translator, so the programmer does not need separate translator software → Write code in the editor -> click Run -> see the output
Q4
The built-in translator in an IDE can be a compiler that turns the whole program into machine code → Build button -> compiler -> executable file
Q5
Before using an IDE, I must install a separate compiler and run it by hand → An IDE already includes a built-in translator, so the programmer does not need separate translator software to translate the code.
Q6
The built-in translator in an IDE only checks the code and cannot run it → The built-in translator translates the code so it can be run, often from one button, and is not just a checker.
Section C: Definitions
Q1
built-in translator — A compiler or interpreter built into an IDE, so the programmer can translate and run code from one button without needing separate translator software.
Section D: Fill in the Blanks
Q1
ide.hasTranslator = True needsSeparate = False
Q2
program = load("game.py") ide.run(program)
Q3
IF ide.hasTranslator THEN ide.run(code) ENDIF
Q4
ide = PythonIDE() ide.translator = "interpreter"
Q5
separateNeeded = not ide.hasTranslator
Section E: Spot the Error
Q1
B — The built-in translator's name is text, so it needs quotes: translator = "interpreter". Without quotes Python looks for a variable called interpreter and gives an error.
Q2
C — An IDE includes a built-in translator, so built_in should be True. With False the program would never tell the user to press Run.
Q3
A — The string is missing its closing quote. It should be ide = "Python IDE".
Q4
C — The string is missing its closing quote. It should be print("Translating..."). The built-in translator runs when the Run button is pressed.
Q5
A — A single = assigns a value. The line should be kind = "language-specific". == only compares values and would cause an error here because kind has not been created yet.