Recording user prompts and INPUT values in a trace table

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

Recording user prompts and INPUT values in a trace table

Name:
Date:
Class:

Quick Questions

Shade in the A or B circle for each question.

1. A program runs OUTPUT "Enter your age". Where is this prompt recorded in the trace table?
A In the OUTPUT column
B In the Age variable column
2. The test data is 15. The program runs INPUT Age. What is recorded for this step?
A 15 is written in the OUTPUT column
B 15 is written in the Age column
3. Which step goes in the OUTPUT column of a trace table?
A OUTPUT "Enter a number"
B INPUT Number
4. Where do the values typed in by the user come from when you complete a trace table?
A The test data given in the question
B You choose any value you like each time
5. The program runs OUTPUT "Enter a mark" then INPUT Mark. The test data is 72. What is the correct trace table recording?
A OUTPUT column: 72; Mark column: Enter a mark
B OUTPUT column: Enter a mark; Mark column: 72

Match the Pairs

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

Left columnRight column
1OUTPUT "Enter age" AIn the trace table, write the prompt text Enter age in the OUTPUT column on this step. No variable column changes.
2INPUT Age (test data: 15) BINPUT Mark
3A prompt shown to the user is recorded in the OUTPUT column of the trace table CThe prompt text was written in the Mark variable column. A prompt is output, so it belongs in the OUTPUT column.
4The test value the user types is recorded in the column of the variable named in the INPUT DOUTPUT "Enter a mark"
5Step: INPUT Score (test data 40). Trace table: OUTPUT column = 40, Score column left empty EIn the trace table, write 15 in the Age column on this step. Nothing goes in the OUTPUT column.
6Step: OUTPUT "Enter a mark". Trace table: Mark column = Enter a mark, OUTPUT column left empty FThe typed value 40 was written in the OUTPUT column. It belongs in the Score column because INPUT assigns it to that variable.

Definitions

Trace table INPUT

Fill in the Blanks

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

1.
OUTPUT "Enter your age" _____ Age
2.
OUTPUT "Enter a score" INPUT _____ OUTPUT Score
3.
______ "Enter your name" INPUT Name
4.
OUTPUT "Enter a number" INPUT Num Total ← Total + ___
5.
DECLARE Age : _______ OUTPUT "Enter your age" INPUT Age

Spot the Error

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

Question 1
A DECLARE Score : INTEGER
B OUTPUT "Enter a score"
C Score ← INPUT
D OUTPUT Score * 2
Question 2
A OUTPUT "Enter first number"
B INPUT Num1
C OUTPUT "Enter second number"
D INPUT 7
E Total ← Num1 + Num2
Question 3
A INPUT "Enter a mark"
B INPUT Mark
C IF Mark >= 50 THEN
D OUTPUT "Pass"
E ENDIF
Question 4
A OUTPUT "Enter a name"
B INPUT Name
C OUTPUT "Hello Name"
Question 5
A OUTPUT Enter a number
B INPUT Num
C Double ← Num * 2
D OUTPUT Double

Answer Key

Recording user prompts and INPUT values in a trace table
Section A: Quick Questions
Q1
A — In the OUTPUT column
Q2
B — 15 is written in the Age column
Q3
A — OUTPUT "Enter a number"
Q4
A — The test data given in the question
Q5
B — OUTPUT column: Enter a mark; Mark column: 72
Section B: Match the Pairs
Q1
OUTPUT "Enter age" → In the trace table, write the prompt text Enter age in the OUTPUT column on this step. No variable column changes.
Q2
INPUT Age (test data: 15) → In the trace table, write 15 in the Age column on this step. Nothing goes in the OUTPUT column.
Q3
A prompt shown to the user is recorded in the OUTPUT column of the trace table → OUTPUT "Enter a mark"
Q4
The test value the user types is recorded in the column of the variable named in the INPUT → INPUT Mark
Q5
Step: INPUT Score (test data 40). Trace table: OUTPUT column = 40, Score column left empty → The typed value 40 was written in the OUTPUT column. It belongs in the Score column because INPUT assigns it to that variable.
Q6
Step: OUTPUT "Enter a mark". Trace table: Mark column = Enter a mark, OUTPUT column left empty → The prompt text was written in the Mark variable column. A prompt is output, so it belongs in the OUTPUT column.
Section C: Definitions
Q1
Trace table INPUT — A prompt is written in the OUTPUT column. The value the user types for an INPUT is written in that variable's column on that step, taken from the test data.
Section D: Fill in the Blanks
Q1
OUTPUT "Enter your age" INPUT Age
Q2
OUTPUT "Enter a score" INPUT Score OUTPUT Score
Q3
OUTPUT "Enter your name" INPUT Name
Q4
OUTPUT "Enter a number" INPUT Num Total ← Total + Num
Q5
DECLARE Age : INTEGER OUTPUT "Enter your age" INPUT Age
Section E: Spot the Error
Q1
C — The command is INPUT Score. The value typed from the test data is stored in Score, so it is written in the Score column on that step. Score ← INPUT is not valid pseudocode.
Q2
D — INPUT must be followed by a variable name, so it should be INPUT Num2. The test value (such as 7) is not written in the code. It goes in the Num2 column of the trace table.
Q3
A — A prompt shown to the user is an OUTPUT, so it should be OUTPUT "Enter a mark". Its text goes in the OUTPUT column of the trace table. INPUT is only for reading a value into a variable.
Q4
C — Name is inside the quotes, so it would print the word Name instead of the value typed. It should be OUTPUT "Hello ", Name. Then the OUTPUT column shows the test value that was stored in Name.
Q5
A — Prompt text must be in quotation marks so it is a string. It should be OUTPUT "Enter a number". The text in the quotes is what is written in the OUTPUT column.