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

Object Oriented Programming Ii Question Paper

Object Oriented Programming Ii 

Course:Bachelor Of Science In Information Technology

Institution: Kca University question papers

Exam Year:2010



UNIVERSITY EXAMINATIONS: 2010/2011
FIRST YEAR STAGE EXAMINATION FOR THE DEGREE OF BACHELOR
OF SCIENCE IN INFORMATION TECHNOLOGY
BIT 2204: OBJECT ORIENTED PROGRAMMING II
DATE: DECEMBER 2010 TIME: 2 HOURS
INSTRUCTIONS: Answer question ONE and any other TWO questions
QUESTION ONE
(a)Differentiate between Applet and Application as used in Java programming (4 Marks)
(b)List Four reason that explain why Java programming is popular (4 Marks)
(c)JVM is an imaginary machine that is implemented by emulating it in software on a real machine.
Code for the JVM is stored in .class file extension, each of which contains code for at most one
public class.
(d)Describe FOUR tools that JVM implements (8 Marks)
(e)Differentiate the functional differences between Bytecode verifier and the class loader as used in
Java programming (4 Marks)
(f) When an object is created, instance variables are initialized with their respective default values.
What are the default values for the following instance types?
i. byte
ii. int
iii. float
iv. char (4 Marks)
(g) With examples Differentiate between type promotion and type casting (4 Marks)
QUESTION TWO
(a) Predict the output of the following program when the users enters 15.
(4 Marks)
(b) Describe with examples the syntax of the following program flow controls and advice when to use them
i. While :
ii. Do while
iii. Endless/finite for control construct
(9 Marks)
(c) Describe the following flow stubs
i. Continue
ii. Break
iii. Label
(6 Marks)
(d) Give two rules used form naming variables
(1 Mark)
QUESTION THREE
(a) Explain the difference between static and non-static member of a class.
(2 Marks)
(b)Define inner class in Java
(2 Marks)
(c) What is the relevance of the following keywords?
i). this:
ii). instanceof:
iii). Applet:
(6 Marks)
(d) Create a class named Monogram. Its main() method holds three character variables that hold your
first, middle, and last initials, respectively. Create a method to which you pass the three initials and
which displays the initials twice—once in the order first, middle, last, and a second time in
traditional monogram style (first, last, middle).
(6 Marks)
(e) When does a name clash occur?
(2 Marks)
(f) Briefly state the difference between static and dynamic modeling
(2 Marks)
4
QUESTION FOUR
a) Does garbage collection guarantee that a program will not run out of memory? Support your
answer
(3 Marks)
b) Create a class named Student. A Student has fields for an ID number, number of credit hours
earned, and number of points earned. (For example, many schools compute grade point averages
based on a scale of 4, so a three-credit-hour class in which a student earns an A is worth 12 points.)
Include methods to assign values to all fields. A Student also has a field for grade point average.
Include a method to compute the grade point average field by dividing points by credit hours
earned. Write methods to display the values in each Student field.
(6 Marks)
c) Write a class named ShowStudent that instantiates a Student object from the class you created.
Compute the Student grade point average, and then display all the values associated with the
Student.
(4 Marks)
d) Create a constructor method for the Student class you created. The constructor should initialize
each Student’s ID number to 9999 and his or her grade point average to 4.0. Write a program that
demonstrates that the constructor works by instantiating an object and displaying the initial values.
(6 Marks)
e) Define the term scope
(1 Mark)
QUESTION FIVE
a) What is the relevance of the following keywords as used Java Programming? Give examples to
support your answer.
i. new
ii. extends
iii. implements
iv.throws (8 Marks)
b) Create a class named Sweets. Its main() method holds an integer variable named numberofSweets
to which you will assign a value. Create a method to which you pass numberofSweets. The method
displays the sweets in dozens. For example, 40 sweets is 3 dozens and 4 left over.
5
(6 Marks)
c) Create a class named Shirt with data fields for collar size and sleeve length. Include a constructor
that takes arguments for each field. Also include a String class variable named material and
initialize it to “cotton”. Write a program TestShirt to instantiate 3 Shirt objects with different collar
sizes and sleeve lengths, and then display all the data, including material, for each shirt.
(6 Marks)






More Question Papers


Popular Exams



Return to Question Papers