input keyword

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

input keyword

Name:
Date:
Class:

Quick Questions

Shade in the A or B circle for each question.

1. Which is the correct VCAA pseudocode statement to accept a value from the user?
A age <- input
B input age
2. Can the input keyword accept more than one variable at a time?
A No — input only works with one variable
B Yes — input a, b accepts two values at once
3. Where in a VCAA pseudocode algorithm should input statements appear?
A After the Algorithm header, before processing
B After the processing statements
4. Which of these correctly accepts two numbers from the user in VCAA pseudocode?
A input x, y
B INPUT X, Y
5. Which correctly uses input in a complete VCAA algorithm?
A Algorithm: add input a, b total <- a + b
B Algorithm: add total <- a + b input a, b

Match the Pairs

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

Left columnRight column
1input age AWrong — you cannot use <- with input. The correct form is `input score` with the keyword first and the variable name after it
2input a, b BAlgorithm: compute area input length, width area <- length * width print area
3The input keyword must appear before any processing that uses the input variables Cinput score if score > 50 then print "Pass" end if
4input accepts values from the user and stores them in named variables without needing the <- operator DAccepts a single value from the user and stores it in the variable named age
5score <- input EAccepts two values from the user in one statement, storing the first in a and the second in b
6INPUT name FWrong — VCAA pseudocode keywords are written in lowercase. The correct form is `input name` not `INPUT name`

Definitions

input

Fill in the Blanks

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

1.
_____ age
2.
input ______, height
3.
Algorithm: find average _____ a, b average <- (a + b) / 2
4.
Algorithm: check score input _____ if score > 50 then
5.
Algorithm: sum three _____ x, y, z total <- x + y + z

Spot the Error

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

Question 1
A Algorithm: greet user
B enter name
C print name
Question 2
A Algorithm: add numbers
B input a, b
C input total <- a + b
D print total
Question 3
A total <- a + b
B input a, b
C print total
Question 4
A Algorithm: compute product
B input x, y
C result <- x * y
D print results
Question 5
A Algorithm: temperature check
B INPUT temp
C if temp > 100 then
D print "Too hot"
E end if

Answer Key

input keyword
Section A: Quick Questions
Q1
B — input age
Q2
B — Yes — input a, b accepts two values at once
Q3
A — After the Algorithm header, before processing
Q4
A — input x, y
Q5
A — Algorithm: add input a, b total <- a + b
Section B: Match the Pairs
Q1
input age → Accepts a single value from the user and stores it in the variable named age
Q2
input a, b → Accepts two values from the user in one statement, storing the first in a and the second in b
Q3
The input keyword must appear before any processing that uses the input variables → Algorithm: compute area input length, width area <- length * width print area
Q4
input accepts values from the user and stores them in named variables without needing the <- operator → input score if score > 50 then print "Pass" end if
Q5
score <- input → Wrong — you cannot use <- with input. The correct form is `input score` with the keyword first and the variable name after it
Q6
INPUT name → Wrong — VCAA pseudocode keywords are written in lowercase. The correct form is `input name` not `INPUT name`
Section C: Definitions
Q1
input — A VCAA pseudocode keyword that accepts a value from the user and stores it in a named variable. Example: input age stores the user's entered value in the variable age
Section D: Fill in the Blanks
Q1
input age
Q2
input length, height
Q3
Algorithm: find average input a, b average <- (a + b) / 2
Q4
Algorithm: check score input score if score > 50 then
Q5
Algorithm: sum three input x, y, z total <- x + y + z
Section E: Spot the Error
Q1
B — `enter name` is not valid VCAA pseudocode. The correct keyword for accepting user input is `input`. The line should read `input name`. Line 1 is wrong.
Q2
C — `input total <- a + b` incorrectly mixes the input keyword with an assignment. `input` only accepts user values — calculation and assignment use <-. The correct statement is `total <- a + b` on its own line. Line 2 is wrong.
Q3
A — `total <- a + b` appears before `input a, b`, but a and b have not yet been given values. Input must come before any processing that uses those variables. Line 0 is wrong.
Q4
D — `print results` references a variable called `results` but the variable was assigned as `result` on line 2. Variable names must match exactly — `result` and `results` are different identifiers. Line 3 is wrong.
Q5
B — VCAA pseudocode keywords are written in lowercase. `INPUT` in all capitals is incorrect — the correct form is `input temp` in lowercase. Line 1 is wrong.