IDE function: run-time environment

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

IDE function: run-time environment

Name:
Date:
Class:

Quick Questions

Shade in the A or B circle for each question.

1. Which statement best describes the run-time environment of an IDE?
A It translates the program into a separate file that you must open outside the IDE
B It lets you run your program and see its input and output without leaving the IDE
2. A student clicks the run button in the IDE. What happens?
A The program starts running inside the IDE
B The IDE only checks the spelling of the comments
3. Where does a program's printed output usually appear in an IDE?
A In the output window or console
B In the code editor, replacing the source code
4. A program asks the user to type their age. How can a student test it inside the IDE?
A Close the IDE and ask the computer to guess the input
B Type test input into the console while the program runs
5. What does stepping through code let a programmer do?
A Run the program one line at a time and watch what happens
B Make the program run faster by skipping lines

Match the Pairs

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

Left columnRight column
1Run button AShows the program's output and lets the programmer type in test input while it runs
2Console window BThe run-time environment lets you run the program inside the IDE, so you do not need to leave it.
3The run-time environment lets a programmer enter test input and check the program reacts correctly, without leaving the IDE CStarts the program from inside the IDE so the programmer can see it work straight away
4The run-time environment can step through code one line at a time so the programmer can watch the program run DThis describes error diagnostics, not the run-time environment. The run-time environment runs the program and shows its input and output.
5To test my program I must close the IDE and run it in a separate application EStep 1: total = 0 | Step 2: total = total + 5
6The run-time environment is the part of the IDE that underlines syntax errors as you type Fage = int(input("Age: "))

Definitions

run-time environment

Fill in the Blanks

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

1.
name = _____("Enter name: ") print("Hello " + name)
2.
total = 5 + 3 _____(total)
3.
age = ___(input("Age: ")) print(age + 1)
4.
x = 1 x = x _ 1 # step: watch x become 2 print(x)
5.
# Press the ___ button to start print("Hello")

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 print("Hi" name)
D print(age + 1)
Question 2
A num = int(input("Number: ")
B total = num * 2
C print("Double:", total)
Question 3
A for i in range(3)
B print("Step", i)
C print("Done")
Question 4
A total = 0
B for n in [2, 4, 6]:
C total = total + n
D print("Total:", totl)
Question 5
A score = int(input("Score: "))
B if score >= 50:
C print("Pass")
D else
E print("Fail")

Answer Key

IDE function: run-time environment
Section A: Quick Questions
Q1
B — It lets you run your program and see its input and output without leaving the IDE
Q2
A — The program starts running inside the IDE
Q3
A — In the output window or console
Q4
B — Type test input into the console while the program runs
Q5
A — Run the program one line at a time and watch what happens
Section B: Match the Pairs
Q1
Run button → Starts the program from inside the IDE so the programmer can see it work straight away
Q2
Console window → Shows the program's output and lets the programmer type in test input while it runs
Q3
The run-time environment lets a programmer enter test input and check the program reacts correctly, without leaving the IDE → age = int(input("Age: "))
Q4
The run-time environment can step through code one line at a time so the programmer can watch the program run → Step 1: total = 0 | Step 2: total = total + 5
Q5
To test my program I must close the IDE and run it in a separate application → The run-time environment lets you run the program inside the IDE, so you do not need to leave it.
Q6
The run-time environment is the part of the IDE that underlines syntax errors as you type → This describes error diagnostics, not the run-time environment. The run-time environment runs the program and shows its input and output.
Section C: Definitions
Q1
run-time environment — An IDE feature that lets you run your program and see it work, including its input and output, without leaving the IDE. It has a run button, a console and can step through code.
Section D: Fill in the Blanks
Q1
name = input("Enter name: ") print("Hello " + name)
Q2
total = 5 + 3 print(total)
Q3
age = int(input("Age: ")) print(age + 1)
Q4
x = 1 x = x + 1 # step: watch x become 2 print(x)
Q5
# Press the Run button to start print("Hello")
Section E: Spot the Error
Q1
C — There is a comma missing between "Hi" and name. When you press Run, the console shows a syntax error. It should be print("Hi", name).
Q2
A — The closing bracket of int( is missing, so the program will not run and the console reports a syntax error. It should end with two closing brackets: )).
Q3
A — A for loop header needs a colon at the end. Without it the IDE cannot run or step through the loop. It should be for i in range(3):
Q4
D — The variable name is misspelt. The program starts running, then the console shows a run-time NameError because totl does not exist. It should be total.
Q5
D — The else keyword needs a colon after it. Running the program in the IDE would show a syntax error in the console. It should be else: