Programming:Pizza menu Flashcards

(60 cards)

1
Q

Which five Python programming constructs must be used to achieve full marks in the assessment?

A

Input, output, selection, iteration, and lists.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is the maximum number of pizzas allowed in a single order?

A

The maximum number is 20 pizzas.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

In Stage $1$ (Customer Details), which three pieces of information must the program request?

A

Name, address, and phone number.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

According to the revision guide, what data type should be used to store the phone number?

A

The phone number should be stored as a string.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Write the Python code to prompt a user for their address and store it in a variable called ‘address’.

A

address = input(“Enter your address: “)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is the primary purpose of Stage $2$ in the pizza programming task?

A

To display the menu options and prices clearly to the user.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Which data structure is used to store the menu items in the Stage $2$ example?

A

A list is used to store the menu items.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Write the Python loop used to print every item in a list named ‘menu’.

A

for item in menu: print(item)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

In Stage $3$, which three variables must be initialised before starting the ordering loop?

A

An empty list for orders, a total price, and a pizza counter.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is the initial value of the ‘total_price’ variable in Stage $3$?

A

The initial value is $0$.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What is the initial state of the ‘orders’ variable before any pizzas are added?

A

It is an empty list, written as $[]$.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Which programming construct is utilised in Stage $4$ to allow for multiple pizza orders?

A

Iteration (specifically a while loop).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What is the specific loop condition used in Stage $4$ to enforce the pizza limit?

A

while pizza_count < $20$:

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

In Stage $4$, what keyword is used to exit the ordering loop if the user types ‘stop’?

A

The ‘break’ keyword is used to exit the loop.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Which Python construct is used in Stage $5$ to process the user’s pizza choice?

A

Selection (if / elif / else statements).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What three tasks must be performed when a valid pizza choice is made in Stage $5$?

A

Add the item to the list, increase the total price, and increase the pizza count.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

What Python method is used to add a pizza name to the ‘orders’ list?

A

The .append() method is used.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

What should the program output if the user enters a pizza number that is not on the menu?

A

The program should print “Invalid choice”.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

In the Stage $5$ example, what is the price of a “Cheese & Tomato” pizza?

A

The price is $\pounds 7.50$.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

In the Stage $5$ example, what is the price of a “BBQ Chicken” pizza?

A

The price is $\pounds 7.90$.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

What is the price of a “Meat Feast” pizza as listed in the Stage $2$ menu?

A

The price is $\pounds 8.10$.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

What specific validation check must be performed in Stage $6$?

A

The program must prevent the user from ordering more than $20$ pizzas.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
23
Q

Under what condition is a discount applied to the total price in Stage $7$?

A

A discount is applied if the total price is over $\pounds 40$.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
24
Q

What percentage discount is applied for orders exceeding $\pounds 40$?

A

A $20\%$ discount is applied.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
Write the Python calculation to apply a $20\%$ discount to the variable 'total_price'.
total_price = total_price * $0.8$
26
Under what condition is a delivery charge added to the order?
A delivery charge is added if the total price is under $\pounds 7$.
27
What is the specific cost of the delivery charge in Stage $7$?
The delivery charge is $\pounds 1.50$.
28
Which five items must be included in the final Order Summary in Stage $8$?
Name, address, phone number, all pizzas ordered, and the final total.
29
How should the program display all the pizzas ordered in the final summary?
By using a for loop to iterate through the 'orders' list.
30
Write the Python code to print the final total with a pound sign (£) as shown in Stage $8$.
print("Total: \pounds", total_price)
31
What is the purpose of the 'pizza_count' variable?
To track the number of pizzas ordered and enforce the maximum limit.
32
In Stage $1$, which variable is used to store the user's telephone contact detail?
The 'phone' variable.
33
The process of repeating the pizza selection prompt until the user stops or hits a limit is called _____.
Iteration
34
What message should be printed if 'pizza_count' reaches the limit of $20$?
print("Maximum of $20$ pizzas reached")
35
Why is 'elif' used instead of multiple 'if' statements for the discount and delivery rules?
To ensure that only one rule (either the discount or the delivery charge) is applied to the total.
36
According to the Final Checklist, what must perform the price calculations?
The program must calculate the prices.
37
What is the final item on the Revision Checklist before submitting the re-test?
Ensure the summary is printed.
38
What information does 'choice' store in the Stage $4$ loop?
The pizza number entered by the user or the word "stop".
39
When applying the delivery charge, the new total is calculated as 'total_price = total_price + _____'.
1.5
40
In Stage $2$, the list containing pizza options is named _____.
menu
41
In the Stage $5$ code example, what happens to 'pizza_count' when choice "$1$" is selected?
It increases by $1$ ($pizza\_count += 1$).
42
Which stage of the program involves the 'input' command for name and phone number?
Stage $1$ (Customer Details).
43
Which stage handles the logic for applying a $20\%$ reduction to the bill?
Stage $7$ (Discount & Delivery).
44
How does the program identify the end of the ordering process by the user?
The user enters the string "stop".
45
In Stage $8$, what is the first line printed in the final output?
print("ORDER SUMMARY")
46
What mathematical operator is used to increment the 'total_price' in Stage $5$?
The addition assignment operator ($+=$).
47
In the menu list example, how is the price $\pounds 7.50$ stored?
It is stored as part of a string inside the list.
48
The prompt 'Enter pizza number or stop: ' is part of which programming stage?
Stage $4$ (Ordering Loop).
49
What specific checklist item confirms the program handles errors in pizza selection?
Validation included.
50
Stage $3$ requirement: 'A pizza counter' is initialised with the value _____.
0
51
To calculate a $20\%$ discount, the total_price is multiplied by _____.
0.8
52
Is the phone number requested as an integer or a string in Stage $1$?
It is requested as a string.
53
Which checklist item ensures that all ordered items are visible to the user at the end?
Summary printed.
54
In Stage $5$, which variable tracks the names of the pizzas the user has chosen?
The 'orders' list.
55
What programming construct is 'choice == "1"' an example of?
Selection (specifically a comparison within an if statement).
56
If the total_price is exactly $\pounds 40$, is the discount applied according to Stage $7$ rules?
No, it is only applied if the price is over $\pounds 40$.
57
What is the result of applying the delivery charge to a total of $\pounds 5.00$?
The total becomes $\pounds 6.50$.
58
Which stage ensures the user sees all options before they start ordering?
Stage $2$ (Display the Menu).
59
What character is used to separate the label and variable in the print statement 'print("Total: \pounds", total_price)'?
A comma.
60
The rule 'Under $\pounds 7 \rightarrow \pounds 1.50$ delivery charge' is found in which Stage?
Stage $7$.