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

Sbc 345: Computer Programming (Forensic Science Group)  Question Paper

Sbc 345: Computer Programming (Forensic Science Group)  

Course:Bachelor Of Science

Institution: Kenyatta University question papers

Exam Year:2012



KENYATTA UNIVERSITY
UNIVERSITY EXAMINATIONS 2011/2012
SECOND SEMESTER EXAMINATION FOR THE DEGREE OF BACHELOR
OF SCIENCE

DATE: TUESDAY 27TH MARCH 2012
TIME: 2.00 P.M. – 4.00 P.M.

INSTRUCTIONS
1.
Attempt question ONE and any other TWO questions
2.
Give examples where possible

QUESTION 1
(a) Define the following terms




(2 marks)
(i) Data Structure
(ii) Programming language
(b) What is the fundamental structure of an array?


(2 Marks)
(c) What is the exact output of any five(5) the program lines below?
(5 marks)


#include
main()
{
int n = 4, k = 2;
cout << ++n << endl;
cout << n << endl;
cout << n++ << endl;
cout << n << endl;
cout << -n << endl;
cout << n << endl;
cout << --n << endl;
cout << n << endl;
cout << n-- << endl;
}
(d) Why is main function special in c++??



(2 marks)
(e) What is run-time error, logical error and syntax error?

(3 marks)
Page 1 of 3
(f) What is compiler and linker?




(2 marks)
(g) You want to write a programme to indicate whether a number entered is odd. Write the
pseudocode necessary for the task



(4 marks)

QUESTION 2
(a) You want to write a computer programme that will be able to: get the height of the tallest
student and the height of the shortest student. Required:
i.
Identify at least Four(4) plausible variables


(4 marks)
ii.
Write a pseudocode for the same




(6 marks)
(b) Implement the algorithm using a C++ code




(6 marks)
(c) Show the output of pre- order, in- order and post- ordertraverse of the binary tree
above: A B C D E F G H I J
A
/ \
/ \
B C
/ \ / \
D E F G
/ \ \
H I J

i.
Show the output of :
i) pre-order
ii) in_order
iii) Post-order traversal of the binary tree below tree (4 Marks)


QUESTION 3

(a)
An employee pay system can be written using structured English as below
If the hours worked is greater than 40
- calculate the regular salary by multiplying the first 40 hours
by the rate of pay;
- calculate the overtime pay rate by multiplying the pay rate
by 1.5 ('time and a half');
- calculate the overtime salary by multiplying the hours over 40
by the overtime pay rate;
Page 2 of 3

- add the two salaries together to get the full salary
Else
- calculate the full salary by multiplying the hours worked
by the rate of pay;




Write a C++ code for the system.



(8 marks)
b)
List and discuss the problem solving phases in computing.
(12 marks)

QUESTION 4
(a)
In program development, the programmers need to select the program language to
implement the system after design. List and discus FOUR criteria you will use to
select a programming language.



(8 marks)








(4 marks)
(b)
Modular development of systems have been embraced by modern programmers. This
approach has been acknowledged to offer better software development to the
traditional monolithic approach. List and briefly explain four advantages of modular
approach to system development.





(8 marks)

(c)
Discuss any FOUR attributes of a good program algorithm

(4 marks)

QUESTION 5
(a)
The three basic program control structures include Selection; Sequence and
Iteration/Looping.
(i) Why do you think that these basic building blocks are popular with all
programming languages and programmers? Explain giving
appropriate examples




(6 marks)
(ii) Use algorithm to represent the three control structures
(6 marks)
(b)
Write a C++ code to demonstrate your understanding of:
(i) Finite loop;





(4 marks)
(ii) Infinite loop





(4 marks)






More Question Papers


Popular Exams


Mid Term Exams

End Term 1 Exams

End Term 3 Exams

Opener Exams

Full Set Exams



Return to Question Papers