©2024 TVET CDACC
061306T4CSC
COMPUTER SCIENCE LEVEL 6
ICT/OS/CS/CR/04/6/A
UNDERSTAND FUNDAMENTALS OF PROGRAMMING
July/August 2024
TVET CURRICULUM DEVELOPMENT, ASSESSMENT AND CERTIFICATION
COUNCIL (TVET CDACC)
WRITTEN ASSESSMENT
TIME: 3 HOURS
INSTRUCTIONS TO CANDIDATE
1. The paper consists of two sections: A and B.
2. Answer ALL questions in Section A and any Three from section B.
3. Marks for each question are indicated in the brackets.
4. A separate answer booklet will be provided.
5. Do not write on the question paper.
This paper consists of FOUR (4) printed pages.
Candidate should check the question paper to ascertain that all the pages are
printed as indicated and that no questions are missing.
Page 1 of 4
©2024 TVET CDACC
SECTION A: (40 Marks)
Answer ALL questions in this section
1. Consider the following java code fragment:
int x = 0, sum = 0;
while (x <= 5) {
sum = sum + x;
x++;
}
System.out.println("The sum is: " + sum);
Replace the while loop in the fragment above with a for loop that prints the same value of
‘sum’ variable. (4 Marks)
2. Explain TWO categories of data types used in a Java development environment.
(4Marks)
3. State FOUR applications of Object-Oriented Programming (OOP). (4 Marks)
4. Differentiate between source code and machine code. (3marks)
5. In order to be a good programmer, one needs to understand the difference between classes
and objects. Explain ONE such difference. (2 Marks)
6. Using an example, illustrate the difference between a derived class and a base class.
(4 Marks)
7. Distinguish between polymorphism and abstraction as used in object-oriented
programming. (4 Marks)
8. Mary has installed a new integrated development environment (IDE) for Java. List
THREE of the commonly used functional packages of the java standard library that will
be readily available for use with this package. (3 Marks)
9. Explain the difference between simple if and if else statements. (2 Marks)
10. State THREE types of variables that can used while developing a program in Java.
(3 Marks)
11. State TWO situations that may require you to use comments in programming. (2 Marks)
12. State TWO advantages of inheritance. (2 Marks)
13. Identify any THREE components of Java NetBeans Integrated Development Environment
(IDE). (3 Marks)
Page 2 of 4
©2024 TVET CDACC
SECTION B: (60 MARKS)
Answer any THREE questions in this section
14.
a. Kasarani NG-CDF deals with a lot of information from bursary applicants, road
network development projects, healthcare development projects among other
development activities in the constituency. The CDF committee would like to develop
a new computerised system to help them in managing their operations. Assuming that
you have been hired as the project manager to coordinate the exercise of coming up
with this new system, discuss SEVEN major phases of developing a system that you
will have to go through with your team. (14 Marks)
b. Explain THREE features of the Java programming language that provides a conducive
environment for software development. (6 Marks)
15.
a. You have been tasked to create a simple java program to sum up two numbers; a and
b. It should return the sum using a method called addNumbers. Write the code which
you would enter two numbers and return sum. (10 Marks)
c. Explain THREE types of operators used in Java to manipulate data and variables.
(6 Marks)
d. Explain TWO types of type casting used in Java. (4 Marks)
16.
a. Access modifiers are used to set the accessibility (visibility) of classes, interfaces,
variables, methods, constructors, data members, and the setter methods. Explain the
FOUR main types of access modifiers used in Java. (8 Marks)
Page 3 of 4
©2024 TVET CDACC
b. One of the skills required of a programmer is to be able to write code that has proper
working control structures. Debug the code provided below to make it functional.
(6 Marks)
public class CompareValues {
public static void ( Stringargs[] ) {
int a = 4
int b = 9
min == ( a<b ) ? a : b;
System.out.println( min );
c. One of the control structures used in programming is the switch statement which
observes certain rules. Write the general syntax of the switch statement as used in
Java. (6 Marks)
17.
a. Use a flowchart to explain the do...while loop. (6 Marks)
b. Write a simple java program to output temperature in Fahrenheit. Given Fahrenheit
temperature = (Temperature in degrees Celsius) × (9/5)) + 32. (6 marks)
c. Explain FOUR types of inheritance that one can use when programming using Java.
(8 Marks)
THIS IS THE LAST PRINTED PAGE.
Page 4 of 4