Object Oriented Programming Exam - CP 215

THE UNIVERSITY OF DODOMA
COLLEGE OF INFORMATICS AND VIRTUAL EDUCATION
SCHOOL OF INFORMATICS

UNDERGRADUATE UNIVERSITY EXAMINATIONS
FIRST SEMESTER 2013/2014

CS 213: OBJECT ORIENTED PROGRAMMING IN JAVA

Date: February, 2014
Time Allocated: 3 Hours

Instructions:

  1. This question paper consists of six (6) questions.
  2. Answer Question One and any other four questions making a total of five questions answered.
  3. All University of Dodoma examination regulations apply.

Question One

a) Java is said to be simple, facilitates faster application development, scalable and platform independent. Briefly explain those four concepts. (8 marks)

b) There are many Java technologies, mention any three technologies providing their long forms. (3 marks)

c) Differentiate a class from an object. Is it possible for an object to access class variables and methods? Briefly explain. (2 marks + 2 marks + 5 marks)


Question Two

Write java programs that illustrate concepts of encapsulation, inheritance and polymorphism. (5 marks + 5 marks + 10 marks)


Question Three

Write java program(s) that illustrate concepts and usage of instance variables, instance methods, class variables and class methods. (5 marks + 5 marks + 5 marks + 5 marks)


Question Four

a) Briefly describe the mechanism of exception handling. (4 marks)

b) Write a skeleton program that illustrates exception handling technique. (6 marks)

c) From (b) above, one could spot a finally block of code. What is that block for? (3 marks)

d) Write a program that could potentially throw any type of known exceptions. (7 marks)


Question Five

a) What is an Applet? (2 marks)

b) Describe the Applet Life Cycle from the moment it loads in a web browser to the point it is terminated. (8 marks)

c) Write a simple Applet class and a corresponding HTML code that displays this string “I am in a UE” 40 pixel positions from the left and 25 pixel positions from the top. The containing boundary should have dimensions of 50 in height and 100 in width. (5 marks + 3 marks)

d) State the two ways how the applet can be executed. (2 marks)


Question Six

a) How can any datatype be converted into a String? (2 marks)

b) What are Type Wrapper Classes? (2 marks)

c) Write a program that accepts a double value using a Scanner class and converts it into a String. (8 marks)

d) Write a program that accepts String datum from the command line and converts that datum into an Integer datum. (8 marks)

[Hint: Use mechanism of exception handling where necessary]


END OF EXAMINATION PAPER