National+5+pseudocode+practice+questions


 * Write the pseudocode for these algorithms**

**Easy**
A program should ask the user to enter a score in a test (out of 40). It should then display the percentage eg Please enter a score (out of 40) > 30 You scored 75%
 * Q1**

A program should ask the user to enter the number of letters in their first name. If the number of letters is less than 4 then it should display the message "You have a short name", otherwise it should display the message "You have a long name"
 * Q2**

A program should display the phrase "Forrester High School Computing" on screen 20 times
 * Q3**

A program should ask the user how many times they want to display the message "Forrester High School" on screen, and then display this message that number of times.
 * Q4**

Pseudocode Solutions (Easy)

**Medium**
A program should ask the user to enter their age. An acceptable age is an integer between 0 and 130. (hint: inpout validation)
 * Q1**

A program should ask the user to enter their rating for a film between 0 and 10. The program should then print out a word to describe the film depending on the rating, and based on the table below: 0-2: Rubbish 3-5: OK 6-8: Good 9-10: Excellent
 * Q2**

A program should Ask the user to enter their name. It should then use input validation to ensure that the name is no more than 10 characters in length. Make sure you use a predefined function
 * Q3**

A program is required to ask the user to input their house. Valid entries are: Using input validation, write the pseudocode for this program
 * Q4**
 * Burns
 * Telford
 * Redpath

A program is required to accept the test scores of 20 students (test is out of 100). It should count the number of students who have passed and display this. A pass is 50 or above
 * Q5**

Write the pseudocode for this program

A shop requires a program to calculate a receipt. It should:
 * Q6**
 * Ask the user to enter the number of items purchased
 * Repeat for each item asking the user to enter the item name, and price and display both
 * Total the price of all items
 * Ask the user if they have a loyalty card, and if so apply a 20% discount
 * Display the total price after any discount

Example Output: Coffee £1.25 Sugar £2.00 Bread £1.00 Sub Total: £4.25

Loyalty: Yes Discount: £0.85 Total: £3.40

A program is required to make a raffle draw. The program should:
 * Q7**
 * Ask the user to enter the names of 20 people
 * Store the names in an array
 * Randomly pick one of the 20 names from the array and display it

Pseudocode Solutions (Medium)

**Difficult**
A program should:
 * Q1**
 * ask the user to enter 25 survey results rating customer service (possible answers: 1, 2, 3, 4 or 5)
 * store a total for each answer the results in an array
 * display the total for each result 1-5
 * if any result <= 3 display a message “Very unpopular”
 * if any result >= 10 display a message “Very popular”

Sample output: 1: 10 votes (Very popular) 2: 2 votes (Very unpopular) 3: 7 votes 4: 5 votes 5: 1 votes (Very unpopular)

Write the pseudocode for this program

A program should:
 * Q2**
 * Pick a random number 1-10
 * Calculate that number squared
 * Ask the user what the square root of that random number squared is
 * Input validate the user answer until they get it correct
 * Display the number of attemps required to get it correct

Sample output: What is the square root of 25? >4

Wrong, try again. What is the square root of 25? >5

Correct – well done. You took 2 attempts

A program should: Ask the user for their name, and then reverse their name Sample output:
 * Q3**

What is your name? >Andy

Your name backwards is ydnA

HINT: MID function and concatenation

Pseudocode Solutions (Hard)