Quelpr

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

Determine the exact output produced by the given C program.

This question uses a figure or table from the paper — you'll see it when you practise.

The mark scheme is shown once you've answered.

Practise this question

Other parts of this question

  1. 6(a)(i)Briefly describe the declarative programming paradigm.[2 marks]
  2. 6(a)(ii)Briefly describe the imperative (procedural) programming paradigm.[2 marks]
  3. 6(a)(iii)Briefly describe scripting languages.[2 marks]
  4. 6(c)(i)Write a declaration for a C struct fruitRec to store a fruit's ID (int), cost price (float), selling price (float), and quantity in stock (int).[2 marks]
  5. 6(c)(ii)Declare two variables, apple and pear, of type struct fruitRec.[1 mark]
  6. 6(c)(iii)Write C code to populate the apple struct variable with sample data.[2 marks]
  7. 6(c)(iv)Assuming two fruitRec variables pine and mango are populated, write C code to swap their cost price and selling price values.[2 marks]
  8. 6(c)(v)Assuming two fruitRec variables a and b are populated, write C code to compute and display the total expected profit from selling both fruits.[3 marks]

More practice: the rest of this paper · more Algorithm Verification and Development questions · all CAPE Computer Science Unit 1 past papers