Quelpr

CAPE Computer Science Unit 1 · 2012 · Paper 2 · Question 6(b)(iii)

A grocery application requires storing product records containing an integer ID, integer quantity in stock, and floating-point price.

Write C code to put data in the item1 struct declared in (b)(ii) using any values.

The mark scheme is shown once you've answered.

Practise this question

Other parts of this question

  1. 6(a)Explain THREE ways in which good programming style can be maintained.[6 marks]
  2. 6(b)(i)Write a declaration for a C struct productRec that can store the record for each product.[2 marks]
  3. 6(b)(ii)Declare TWO variables, item1 and item2, that have the record structure declared in (b)(i).[1 mark]
  4. 6(b)(iv)Assuming two productRec structs, item3 and item4, are already loaded with data, write C code to exchange their values.[3 marks]
  5. 6(c)Write C code to read a 7-character uppercase string into a character array, print each vowel present in the string (or 'NO VOWELS' if none are present), and…[11 marks]

More practice: the rest of this paper · more Modular Programming and Data Structures questions · all CAPE Computer Science Unit 1 past papers