Pseudocode INPUT and OUTPUT

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

Pseudocode INPUT and OUTPUT

Name:
Date:
Class:

Quick Questions

Shade in the A or B circle for each question.

1. Which line reads a value from the user into a variable called Name?
A OUTPUT Name
B INPUT Name
2. Which line displays the message Hello on the screen?
A OUTPUT "Hello"
B INPUT "Hello"
3. Name holds the text Sam. Which line displays Sam on the screen?
A OUTPUT Name
B OUTPUT "Name"
4. What does OUTPUT "Name" (with quotes) display?
A The word Name
B The value stored in the variable Name
5. Which is the better order for a program that asks for a user's name?
A INPUT Name then OUTPUT "Enter your name"
B OUTPUT "Enter your name" then INPUT Name

Match the Pairs

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

Left columnRight column
1INPUT Name AThe quotes make this display the word Name instead of the value stored in the variable. To show the variable, write OUTPUT Name.
2OUTPUT "Hello" BINPUT needs a variable name to store the value in, not a string in quotes. It should be INPUT Name.
3Display the value stored in a variable called Name, not the word Name CDisplays the message Hello on the screen
4Ask the user a question first, then read their answer into Age DOUTPUT "Enter your age" INPUT Age
5INPUT "Name" EReads a value typed by the user and stores it in the variable Name
6OUTPUT "Name" FOUTPUT Name

Definitions

INPUT Name

Fill in the Blanks

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

1.
_____ Name
2.
______ "Hello"
3.
INPUT Name OUTPUT ____
4.
OUTPUT "Enter your name" _____ Name
5.
OUTPUT "Your name?" INPUT ____ OUTPUT Name

Spot the Error

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

Question 1
A OUTPUT "Enter your name"
B INPUT "Name"
C OUTPUT "Hello"
Question 2
A OUTPUT "Enter your age"
B INPUT Age
C OUTPUT "You are"
D OUTPUT "Age"
Question 3
A OUTPUT "Enter your name
B INPUT Name
C OUTPUT Name
Question 4
A input Name
B OUTPUT "Hello"
C OUTPUT Name
Question 5
A OUTPUT "Enter a score"
B INPUT Score
C PRINT Score

Answer Key

Pseudocode INPUT and OUTPUT
Section A: Quick Questions
Q1
B — INPUT Name
Q2
A — OUTPUT "Hello"
Q3
A — OUTPUT Name
Q4
A — The word Name
Q5
B — OUTPUT "Enter your name" then INPUT Name
Section B: Match the Pairs
Q1
INPUT Name → Reads a value typed by the user and stores it in the variable Name
Q2
OUTPUT "Hello" → Displays the message Hello on the screen
Q3
Display the value stored in a variable called Name, not the word Name → OUTPUT Name
Q4
Ask the user a question first, then read their answer into Age → OUTPUT "Enter your age" INPUT Age
Q5
INPUT "Name" → INPUT needs a variable name to store the value in, not a string in quotes. It should be INPUT Name.
Q6
OUTPUT "Name" → The quotes make this display the word Name instead of the value stored in the variable. To show the variable, write OUTPUT Name.
Section C: Definitions
Q1
INPUT Name — INPUT reads a value from the user into the variable Name. OUTPUT displays a value or message on screen, such as OUTPUT "Hello" or OUTPUT Name.
Section D: Fill in the Blanks
Q1
INPUT Name
Q2
OUTPUT "Hello"
Q3
INPUT Name OUTPUT Name
Q4
OUTPUT "Enter your name" INPUT Name
Q5
OUTPUT "Your name?" INPUT Name OUTPUT Name
Section E: Spot the Error
Q1
B — INPUT must be followed by a variable name, not a string in quotes. It should be INPUT Name so the value typed is stored in Name.
Q2
D — Quotes make OUTPUT display the word Age as text. To display the value stored in the variable, write OUTPUT Age with no quotes.
Q3
A — The prompt message is missing its closing quotation mark. It should be OUTPUT "Enter your name".
Q4
A — Cambridge pseudocode keywords are written in capitals. It should be INPUT Name.
Q5
C — Cambridge pseudocode uses OUTPUT to display a value, not PRINT. It should be OUTPUT Score.