ExamBank Scot · N5 Computing Science question bank · All N5 Computing Science questions
3 marks · Fixed and conditional loops
State the type of loop shown in the design above. The design is tested. For the following inputs state the total displayed. Inputs Total displayed Number of trees – 2 Type of tree – cherry Size of tree – small Type of tree – pear Size of tree – medium The garden centre is considering selling orange trees for £23·00. Explain why the design does not need to be changed. A garden centre requires a program to calculate the price of apple, pear and cherry trees being sold. The design is shown below. Fruit Tree Price Calculator Ask user for Set total Display Start loop for number of trees to 0·00 total each tree being purchased Ask user to Ask user to Add Is type Is size enter type enter size treePrice = apple? = large? of tree of tree to total Yes No Yes No Set treePrice Set treePrice Is size Is type to 5·00 to treePrice * 2 = medium? = pear? Yes No Yes Set treePrice Set treePrice Set treePrice to to 18·00 to 23·00 treePrice * 1·5
Fixed Unconditional 50 Ignore additional working in answer as question involves testing a design. As orange tree is not an apple or pear tree it would still be set to £23 Do not accept “Same price as cherry tree” without explanation.