Cisy 111:Stctured Programming Question Paper
Cisy 111:Stctured Programming
Course:Computer Science
Institution: Kenya Methodist University question papers
Exam Year:2013
KENYA METHODIST UNIVERSITY
END OF 3''RD ''TRIMESTER 2013 (PT) EXAMINATION
FACULTY : COMPUTING & INFORMATICS
DEPARTMENT : COMPUTER SCIENCE AND BUSINESS INFORMATION
UNIT CODE : BBIT 222/CISY 111
UNIT TITLE : STRUCTURED PROGRAMMING
TIME : 2 HOURS
Instructions: Answer all questions in section A and any two from section B.
Question One
(i) Explain the three types of constructs that make important features f a structured program.
(6mks)
ii) Identify three important advantages of structured programming. (3mks)
(i) differentiate between realloc ( ) and free ( )
(5mks)
ii) Explain when one should use "cost" reference arguments in functions. (3mks)
Explain
Functions overloading.
(2mks)
Operator overloading.
(2mks)
(i) Explain the difference between structures and classes.
(3mks)
ii) Declare an alloy that contains the following nine densities for metal alloys:
1.5 2.8 4.6
5.7 7.9 8.3
8.6 8.8 8.9
Write a program that prompts the user for a density and prints the one closest below the entered density. (6mks)
Question Two
Write a function named "digit name" that takes an integer argument in the range from 1 to 9, inclusive and prints the English name for that integer on the computer screen. No newline character should sent to the screen following the digit name. the function should not return a value. If the argument is not in the required argument is not in the required range, the function should print "digit error" without the quotation marks but followed by the newline character thus for example, the statement digitname (8); should print eight on the screen. The statement digitname (o) should print digit error not the screen and place the cursor at the beginning of the next line. (15mks)
Question Three
Explain the following in C++
Structure
(4mks)
Reference variable
(2mks)
Explain passing objects by reference passing object by value and passing objects by pointer.
(9mks)
Question Four
(i) Explain the meaning of memory leaks.
(3mks)
ii) Explain the ways to avoid memory leaks. (3mks)
Write a program that prompts the user for integers. The program should then print:
The sum of the integers.
(2mks)
The average of the integers.
(2mks)
The sum of the square numbers
(2mks)
The sum of the cube of the numbers.
(3mks)
More Question Papers