Вы находитесь на странице: 1из 2

CONFIDENTIAL 1 CS/MAY 2020/CSC404/TEST 1

UNIVERSITI TEKNOLOGI MARA


TEST 1

COURSE : PROGRAMMING II
COURSE CODE : CSC404
EXAMINATION : MAY 2020
TIME : 1 HOUR 15 MINUTES

INSTRUCTIONS TO CANDIDATES

1. This question paper consists of PART B (2 questions)

2. Answer ALL question in English.





















DO NOT TURN THIS PAGE UNTIL YOU ARE TOLD TO DO SO
This examination paper consists of 1 printed page

© Hak Cipta Universiti Teknologi MARA CONFIDENTIAL


CONFIDENTIAL 2 CS/MAY 2020/CSC404/TEST 1

PART B (20 MARKS)

QUESTION 1

a) Write a function named addTwo() that will receive three pointers of floats. It will add the
numbers pointed to by the first two floats and store the summation in the location pointed
to by the third pointer. Display the summation value.
(3 marks)

b) Compute the following equation:


!
1 1 1 1 1
!
=1+ + + +⋯+ !
𝑖 4 9 16 𝑛
!!!

i) Write a function named formula() to compute the numbers and return the
summation to the main() function.

ii) In main() function, prompt the user to input n value and display the result of the
summation.
(7 marks)

QUESTION 2

Sarah is working at Burgertory, a homegrown burger bar. She can prepare 12 burgers
within 2 minutes. The administration department wants to make a survey on how long it
takes Sarah to prepare 600 burgers. Write a complete C++ program that assist the
administration to prepare the following report:

Hour Minute Number of burger


0 2 12
0 4 24
0 6 36
… … …
… … …
… … …

[Hint: Declare one-dimensional array to store number of burger, hour and minute each.]
(10 marks)

END OF QUESTION PAPER

© Hak Cipta Universiti Teknologi MARA CONFIDENTIAL

Вам также может понравиться