1. The following table contains several definitions of terms that are used in Computer Science. Letter Definition...
Question:
1. The following table contains several definitions of terms that are used in Computer Science. Letter Definition A Cleaning up data entered by removing non-standard characters B Hiding or removing irrelevant details from a problem to reduce complexity C Checking that the user is allowed to access the program D Breaking a complex problem down into smaller problems E Repeating elements of a program F Converting one data type to another, for example converting an integer to a real number (a) Write the letter of the definition that matches each keyword in each space. Decomposition .................. Abstraction .................. Input sanitisation .................. Casting .................. [4] (b) (i) Write a pseudocode statement to assign the value 7.3 to a variable with the identifier timer [1] (ii) State the most appropriate data type for the variable timer.
2 Dru writes the following program using a high-level language. 01 function newscore(a,b) 02 temp = a*b 03 temp = temp + 1 04 return temp 05 endfunction 06 score = 18 07 name = "Dru" 08 print (score) 09 print ("name") 10 print (newscore(score,2)) 11 print (score) (a) The following table contains the program code for each line where this program outputs values. State the values output by the program on each of the lines. Line Program code Value output 08 print (score) 09 print ("name") 10 print (newscore(score,2)) 11 print (score)
(b) Describe the advantages of writing the program in a high-level language instead of in assembly language.
(c) Describe how a character set is used to represent the string value stored in the variable name
3 A vending machine has the following options available. Item code Item name Price A1 Crisps, bacon flavour 0.75 A2 Crisps, salted 0.75 B1 Chocolate bar 0.90 C1 Apple pieces 0.50 C2 Raisins 0.85 Users insert coins into the vending machine and then enter the two character item code of their selection. If the user has inserted enough money, the vending machine will release the chosen item and output any change required. If the user enters an invalid item code then a suitable error message is displayed.
(a) The vending machine is tested before it is released.
(i) Explain the purpose of testing the vending machine
(ii) Describe the difference between iterative testing and final testing
(iii) Complete the following test plan for the vending machine. Code entered Money inserted Expected result B1 1 Chocolate bar served, 0.10 change given 0.85 Raisins served, no change given C1 Error - not enough money inserted C3 0.75
(b) The algorithm for one section of the vending machine program is shown in pseudocode. if money >= price then venditem() giveChange(money - price) else print("Error - not enough money inserted") endif (i) Give the identifier of one variable used in the algorithm. ...................................................................................................................................... [1] (ii) State how many parameters are passed into the giveChange() subroutine.
(c) Draw the vending machine algorithm in part (b) as a flowchart.
(d) When writing the program for the vending machine, maintainability was considered. (i) Identify two ways that the program in part (b) has been made more maintainable. 1 . ........................................................................................................................................... [2] (ii) Give one additional way that the maintainability of the program can be improved.
(e) The vending machine stores the quantity of items available in a database table called ITEMS. The current contents of ITEMS is shown: ItemCode ItemName Stock A1 Crisps, bacon flavour 6 A2 Crisps, salted 2 B1 Chocolate bar 12 C1 Apple pieces 18 C2 Raisins 7 Complete the following SQL statement to display the item code for all items that have fewer than 10 in stock. SELECT ................................................................................................................................... FROM .
(f) The vending machine can be in one of three states: on, off or suspended. A user can change the state of the vending machine by using the following algorithm. newstate = input("Enter the new state : ") switch newstate: case "on": statevalue = 1 case "off": statevalue = 2 case "suspended": statevalue = 3 default: print("Invalid state") endswitch Rewrite the algorithm to perform the same actions using IF statements in place of the switch statement.
(a) A radio station records an interview with a computer scientist using a computer and audio recording software. (i) Explain how sampling is used to store audio recordings.
A second interview with the computer scientist is recorded. Before this interview, the sampling frequency in the audio software is increased. (ii) Define what is meant by the term sampling frequency
(iii) Tick () two boxes to show the effects of increasing the sampling frequency. Data type of returned value Tick () two boxes The file size of the digital recording will be smaller. The file size of the digital recording will be larger. The quality of playback of the digital recording will be better. The quality of playback of the digital recording will be worse. [2] (b) The radio station uses a digital camera to take a photograph of the computer scientist for their website. The photograph is stored as a bitmap image. (i) Describe how bitmap images are represented in binary.
(ii) Explain why computers represent data in binary form
The image is compressed using lossy compression before being uploaded to the radio station's web server. The image will be used on the radio station's website. (iii) Describe one advantage and one disadvantage of using lossy compression on the image that will be used on the website.
Louise Creates a program to work out if a number entered by the user is odd or even. Her first attempt at this program is shown. 01 num = input("enter a number") 02 if num MOD 2 >= 0 then 03 print("even") 04 else 05 pritn("odd") 06 endif (a) The program contains a logic error on line 02. (i) State what is meant by a logic error.
(ii) Give a corrected version of line 02 that fixes the logic error.
(b) The program contains a syntax error on line 05. (i) State what is meant by a syntax error.
(ii) Give a corrected version of line 05 that fixes the syntax error.
4 Elliott plays football for OCR FC. He wants to create a program to store the results of each football match they play and the names of the goal scorers. Elliott wants individual players from the team to be able to submit this information. (a) (i) Define what is meant by abstraction.
(ii) Give one example of how abstraction could be used when developing this program.
(b) Describe two examples of defensive design that should be considered when developing this program. 1 .
The number of goals scored in each football match is held in an array called goals. An example of this array is shown. goals = [0, 1, 3, 0, 4, 5, 2, 0, 2, 1] Elliott wants to count how many matches end with 0 goals. (c) Complete the following pseudocode for an algorithm to count up how many matches with 0 goals are stored in the array and then print out this value. 01 nogoalscount = 0 02 for count = 0 to (goals.length-1) 03 if goals[..............................] == 0 then 04 nogoalscount ............................................................ 05 endif 06 next count 07 print(...................................................)
5. OCR Land is a theme park aimed at children and adults. Entrance tickets are sold online. An adult ticket to OCR Land costs 19.99, with a child ticket costing 8.99. A booking fee of 2.50 is added to all orders. (a) A function, ticketprice(), takes the number of adult tickets and the number of child tickets as parameters. It calculates and returns the total price to be paid. (i) Use pseudocode to create an algorithm for the function ticketprice().
Taxes And Business Strategy A Planning Approach
ISBN: 9780132752671
5th Edition
Authors: Myron Scholes, Mark Wolfson, Merle Erickson, Michelle Hanlon