Quelpr

Procedural Programming Constructs in C · CAPE Computer Science Unit 1

13 past-paper questions on Procedural Programming Constructs in C, part of Programming, from every CAPE Computer Science Unit 1 paper on Quelpr.

  1. 5(b)4 marks· CAPE Computer Science Unit 1 · 2009 · Paper 2Write a C function that takes two distinct integer parameters, a and b, and returns the larger integer.
  2. 5(b)2 marks· CAPE Computer Science Unit 1 · 2010 · Paper 2How does a character variable differ from a string variable?
  3. 5(c)6 marks· CAPE Computer Science Unit 1 · 2011 · Paper 2Write a C function which accepts an integer array and an integer variable indicating the size of the array, and returns the sum of all numbers in the array that are NOT greater than 100.
  4. 6(d)11 marks· CAPE Computer Science Unit 1 · 2011 · Paper 2Write a C program that prompts the user for THREE integers, determines the type of triangle represented according to the given rules, and prints the result or 'No triangle is represented.'
  5. 6(e)(ii)4 marks· CAPE Computer Science Unit 1 · 2011 · Paper 2Modify the code in 6(e)(i) so that the specified triangular number pattern output is generated.
  6. 6(c)11 marks· CAPE Computer Science Unit 1 · 2012 · Paper 2Write 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 count and print the number of occurrences of the letter 'A'.
  7. 5(b)4 marks· CAPE Computer Science Unit 1 · 2013 · Paper 2Write a function swap that accepts an integer array and two valid integers pos1 and pos2 representing locations in the array, and swaps the contents of these two locations.
  8. 5(d)8 marks· CAPE Computer Science Unit 1 · 2013 · Paper 2Write a program that prompts the user to enter an integer r and prints r!, where 0! = 1 and r! = r(r-1)(r-2)...1 for r > 0.
  9. 6(d)(iii)3 marks· CAPE Computer Science Unit 1 · 2013 · Paper 2Write C code to read two values representing the purchases of Andrew and Jamie from the keyboard. Andrew pays full price while Jamie receives a 10% discount. Adjust each customer's balance according to their purchases.
  10. 5(c)6 marks· CAPE Computer Science Unit 1 · 2014 · Paper 2Write a C function which accepts an integer array and an integer variable indicating the size of the array. The function should return a count of the numbers in the array that are LESS THAN 20.
  11. 6(d)6 marks· CAPE Computer Science Unit 1 · 2014 · Paper 2Write a C program that accepts two values, price and tax (both of type float). The program applies tax to price and prints the old price and the new price in an appropriate message. Note that tax is given as a…
  12. 6(e)4 marks· CAPE Computer Science Unit 1 · 2014 · Paper 2Write C code to read four integers and print their average. (Do not write an entire program.)
  13. 5(d)9 marks· CAPE Computer Science Unit 1 · 2015 · Paper 2Write a C program that takes a lowercase string from the user and checks whether it is a palindrome.