Disd043 - Programming With Java
Disd043 - Programming With Java
UNIVERSITY EXAMINATIONS
JANUARY - APRIL 2020 SEMESTER
INSTRUCTIONS TO CANDIDATES
a) SECTION A IS COMPULSORY.
b) SECTION B: ANSWER ANY OTHER THREE QUESTIONS.
NOTE: QUESTION ONE -40MARKS
Question One
a. With an example explain how a java programmer can implement the following concepts:
i. Variable; (2 Marks)
ii. Polymorphisim: (2 Marks)
iii. Inheritance; (2 Marks)
iv. Abstraction; (2 Marks)
v. Class and Object; (4 Marks)
b. State FIVE features of Java as a programming language that makes it one of the popular
programming language. (5 Marks)
c. State and Explain THREE types of access modifiers used in Java programming
language. (6 Marks)
d. Define the term comments as used in Java programming. (2 Marks)
e. Comments are important when used in programming. Support this statement.
(6 Marks)
f. The following Java program has been written using switch statement, rerwrite the
programm using Java if...else...elseif Statements. (6 Marks)
g. Most Java students confuse while loop with do...while loop, but are not the same. As a
Java programming student differentiate the TWO loops. (5 Marks)
a. There are TWO main control structures in Java. State and explain. (4 Marks)
b. Write a Java code to output all odd numbers between 0 to 100. (6 Marks)
c. Explain the following terms with examples as used in Java programming language:
i. Break; (3 Marks)
ii. Continue. (2 Marks)
d. PARAMETERS and ARGUMENT are Java keywords used by methods. State their
differences with an example in each. (5 Marks)
Question Four
a. FOR is a loop that is used in Java. Explain its use with an example. (5 Marks)
b. Define the term function as used in Java. (2 Marks)
c. State and explain TWO types of functions used in Java programming, with examples.
(6 Marks)
d. Explain with examples of how the following string manipulation methods are used:
i. length( ); (2 Marks)
ii. indexOf(); (3 Marks)
iii. + operator; (2 Marks)
Question five
a. Define what is an infinite loop in Java and illustrate with an example. (4 Marks)
b. Define the term typecasting as used in Java programming, with examples in each.
(6 Marks)
c. State and explain FOUR data types that are found in Java. (4 Marks)
d. Define the term array as used in Java. (2 Marks)
e. State and explain TWO types of array available in the Java programming language.
(4 Marks)
f. Differentiate the following terms as used in java programming inheritance. (2 Marks)
i. Subclass;
ii. Superclass.
g. State FOUR applications of Java language. (4 Marks)