CIT 202 Test1 - 2020-2021
CIT 202 Test1 - 2020-2021
CIT 202 Test1 - 2020-2021
SECTION A
1. Write a C++ program to input the length and breadth of a rectangle, compute the area,
perimeter and length of the diagonal of the rectangle. The program is also to output the
input values on one line and the computed values on a separate line.
2. With respect to the C++ declaration, : int n =7; int sum=5; write out the values of n and
sum after the following expressions is executed: (i) n++; (ii) sum *=6’ (iii) sum % n
SECTION B
4. Specify the header files in which the following functions are found: (i) stren (ii) atof (iii)
exit() (iv) floor (v) exp
5.
a
(i) Write one C++ statement to output n , assume a and n have been declared and
given initial values
(ii) Write C++ declarations for identifiers a, b, c, d and e which take string, Boolean,
floating-point, char and integer values respectfully
(iii) Write one C++ statement to read values into 2 variables x and y; assume x and y
have been declared as of type char and integer respectively
6. A function with two integer parameters a and b is required to compute the sum s and
product p of a and b via parameters. write the prototype of the function.
7. List 3 basic control structures for structured coding (b) what C++ statements are used for
multiple selection and post-test iteration.
SECTION C
8. Oi
i) Write a for-statement equivalent of the following C++ program segment:
11. List the 3 techniques involved in structured programming methodology and describe just
one of the techniques
12. A program is required to input exam scores of 100 students, compute and then output the
following
i) average score
ii) Highest score
iii) Median score
iv) the entire score in ascending order
Design the structure of the program, using Top-down design strategy
13. Write a program to output the sum of the first 10 integers using three (3) iteration control
structures
14. Write a program to input exam scores based on 100% then output the score and its grade,
using Bowen University grading system for your set.