0% found this document useful (0 votes)
49 views3 pages

Ics 2104 Object Oriented Programming I

The document contains 5 questions about Java programming concepts like object oriented programming, control structures, methods, and the Greenfoot environment. It tests understanding of classes, inheritance, objects, encapsulation, import statements, methods, and actor and world classes in Greenfoot.

Uploaded by

Joash Macenton
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
49 views3 pages

Ics 2104 Object Oriented Programming I

The document contains 5 questions about Java programming concepts like object oriented programming, control structures, methods, and the Greenfoot environment. It tests understanding of classes, inheritance, objects, encapsulation, import statements, methods, and actor and world classes in Greenfoot.

Uploaded by

Joash Macenton
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

W1-2-60-1-6

JOMO KENYATTA UNIVERSITY


OF AGRICULTURE AND TECHNOLOGY

University Examinations 2016/2017


YEAR TWO SEMESTER TWO EXAMINATIONS FOR THE DEGREE OF
BACHELOR OF BUSINESS INFORMATION TECHNOLOGY

ICS 2104: OBJECT ORIENTED PROGRAMMING I


DATE: APRIL 2017 TIME: 2 HOURS
INSTRUCTIONS: ANSWER QUESTION ONE (COMPULSORY) AND ANY
OTHER TWO QUESTIONS

QUESTION ONE (30 MARKS)

a) Define the mandatory statement for JAVA syntax to rum without errors
(3 marks)

b) What is the function of the static keyword in JAVA syntax (2 marks)

c) JAVA has 4 access modifies, briefly describe the scope of each modifier
(4 marks)

d) List 6 primitive data types supported by JAVA programming (3 marks)

e) Using appropriate examples discuss the following OOP concepts;

i) Class (3 marks)
ii) Inheritance (3 marks)
iii) Object (3 marks)
iv) Eucapsulation (3 marks)

f) Write JAVA programs which will display the following;

i) The maximum value of data type integer (3 marks)

ii) The minimum value of data type double (3 marks)


QUESTION TWO (20 MARKS)

a) Briefly describe the functions of the following JAVA library classes:

i) import java.10.*; (2 marks)


ii) import java.awt.event.*; (2 marks)
iii) import java.math.*; (2 marks)
iv) import java.util.regex.*; (2 marks)
v) import java.util.scanner.*; (2 marks)

b) Write a JAVA programme that prompts a User to enter their three


names, first name, middle name and last name from the key board, and
then display the full name on the console window (10 marks)

QUESTION THREE (20 MARKS)

a) Write the syntax of the following control structures;

i) if statement (5 marks)
ii) switch statement (5 marks)

b) Write a JAVA programme that prompts a User to enter exam marks


from the keyboard, and display their grades. The program should be
able to check the following rules;

 Marks above 70 should return A


 Marks between 69-60 return B
 Marks between 59-50 return C
 Marks between 49-40 return D
 Marks below 39 return Fail (10 marks)

QUESTION FOUR (20 MARKS)

a) Differentiate between in built methods and user defined methods


(5 marks)

b) Write the syntax of a method in JAVA programming (5 marks)

c) Using appropriate examples, write JAVA programs which will


implement the following methods;

i) math.sqrt() (5 marks)
ii) math.ceil() (5 marks)
QUESTION FIVE (20 MARKS)

a) Greenfoot is a free environment for JAVA programming for creating 2D


animator, simulation and games. Differentiate between an actor class
and world class in Greenfoot for JAVA (5 marks)

b) Discuss the following Greenfoot inbuilt methods with respect to the


functionalities and type of parameter they accept;

i) isAtEdgcC) (3 marks)
ii) isTouching C) (3 marks)
iii) turn () (3 marks)
iv) remove Touching () (3 marks)
v) getRandomNumber() (3 marks)

You might also like