Question 7
OCR Computer Science June 2017 Paper 1AS11 marks
On the specification
- (a)
- 1.3 Exchanging data
- (b)
- 1.4 Data types, data structures and algorithms
- (c)
- 2.2 Problem solving and programming1.4 Data types, data structures and algorithms
Question text
7 A company releases an Internet connected fridge. Users can email messages to the fridge and it puts them on its display. (a) The fridge uses the TCP/IP stack. Explain what is meant by the term ‘TCP/IP stack’. [3] (b) The fridge uses the ASCII character set. Give one disadvantage of the fridge using ASCII rather than Unicode. [1] When the fridge receives a message it takes the string and stores it in a queue called words. For example REMEMBER TO TAKE CHARLIE TO THE DENTIST THIS AFTERNOON becomes a queue: words=["REMEMBER","TO","TAKE","CHARLIE","TO","THE","DENTIST", "THIS","AFTERNOON"] words.remove() then returns the next item in the queue for example temp=words.remove() assigns temp the value "REMEMBER" and leaves words as ["TO","TAKE","CHARLIE","TO","THE","DENTIST","THIS","AFTERNOON"] The display has four lines; each can show a maximum of 20 characters including spaces. If a word can’t fit on a line a new line is started. Examples R E M E M B E R T O T A K E C H A R L I E T O T H E D E N T I S T T H I S A F T E R N O O N G E T S O M E M O R E C H O C O L A T E P L E A S E The contents of the display are stored in a 2D array of characters called display. The procedure updateDisplay receives the queue words which holds the message and writes the message to the display. (c) Write the procedure updateDisplay. Credit will be given for the readability of your code. You can assume: • Messages contain no punctuation. • All messages will fit on the display. • The previous message is removed before the procedure is run. global array display[20,4] procedure updateDisplay(words) endprocedure [7]