Get premium membership and access revision papers, questions with answers as well as video lessons.

Sce 119: Computer Programming I  Question Paper

Sce 119: Computer Programming I  

Course:Software Enigineering

Institution: Kenyatta University question papers

Exam Year:2010



KENYATTA UNIVERSITY
UNIVERSITY EXAMINATIONS 2010/2011
FIRST SEMESTER EXAMINATION FOR THE DEGREE OF BACHELOR OF SCIENCE SOFTWARE ENGINEERING
SCE 119: COMPUTER PROGRAMMING I

DATE: THURSDAY 2ND DECEMBER 2010

TIME: 2.00 P.M – 4.00 P.M

INSTRUCTIONS:

Answer Question One and Any Other Two questions

QUESTION 1

(a)
Differentiate the following:


i) High level languages and low level languages


ii) Modular and structured program


iii) Program and algorithm


iv) Compiler and programming language
(8 marks)



(b)
Describe any two user defined data types used by C++ programs.
(4 marks)
(c)
Write the mathematical expressions below as C++ statements:


i) x (a ?b) ?c



ii) x ? v (
2
a ?b )
(6 marks)
(d)
Write a program that generates odd numbers between 1 and 30 inclusive. The program
should also compute and display the square of each number.
(8 marks)
(c)
Write a program to evaluate the fuel consumption of a car. The mileage at the start and end
of the journey should be read, and also the fuel level in the tank at the start and end of the
journey. Calculate gallons of fuel used, kilometers traveled, and hence the overall fuel
consumption in kilometers traveled per gallon of fuel. Your program should display
computed values.
(4 marks)

Page 1 of 3

QUESTION 2
(a)
Briefly explain the following stages of program development:


i) Developing the outline into algorithm


ii) Transcription


iii) Testing and debugging
(6 marks)

(b)
Write a program that inputs three different numbers and outputs the smallest number.




(6 marks)
(c)
Write a C++ program that allows the user to enter and store the student score in three
subjects. The program then computes and displays the lowest score, the highest score,

sum and average score using a suitable format.
(8 marks)


QUESTION 3
(a)
Outline any three characteristics of a good algorithm.
(3 marks)
(b)
A program is required to calculate the average of a set of marks and to count the number of
failing marks. The program prompts the user the number of marks and reads the value
entered. The ;program then reads each mark and determines the failing marks as those below
40 counting each failing mark. Your program should display the sum, average and number
of failing marks.

Required:
(i) Draw a flowchart for your solution.
(8 marks)
(ii) Write the program that implements the above algorithm.
(9 marks)
Page 2 of 3



QUESTION 4

(a)
Differentiate the following set of terms:


(i) Actual parameters and Formal parameters


(ii) Function prototypes and function definition




(8 marks)


(b)
Write a program that uses four functions namely input, getGrade, output and main to read
in the average marks scored by a student and output the grade attained. The input function is
used to read the average mark (out of 100) for a student. This function should only accept
values that fall within the range 0-100. The mark is then passed as a parameter to the
getGrade function which uses it to assign a grade based on the following classification:


Mark
Grade


75 and above
A


60 and below 75
B


50 and below 60
C


40 and below 50
D


Below 40
E


The mark computed grade are the passed as parameters to the output function, which outputs
them appropriately. All functions input, getGRade and output are called from main.






(12 marks)


QUESTION 5

(a)
Discuss any three benefit of breaking ;program into functions.
(6 marks)

(b)
The following details are available for a student: Student Number, Name, Mark1, Mark2
and Mark3. Write a C program to include a structure called ‘Students’ to store the student
details and display the same along with average mark and “Pass”, if average mark is greater
than or equal to 50 or “Fail” otherwise the program should record details of as many students
as the user desires. The maximum number of students should not exceed 50.



(14 marks)


===================================================
Page 3 of 3






More Question Papers


Popular Exams



Return to Question Papers