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

CSE1115 Mid 182

The document is a mid-exam paper for the course CSI 211: Object Oriented Programming at United International University, consisting of three main questions. It includes tasks such as writing code fragments, determining the truth of statements about abstract classes, and creating classes with specific attributes and methods. The exam assesses knowledge of Java programming concepts, including encapsulation, garbage collection, and inheritance.

Uploaded by

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

CSE1115 Mid 182

The document is a mid-exam paper for the course CSI 211: Object Oriented Programming at United International University, consisting of three main questions. It includes tasks such as writing code fragments, determining the truth of statements about abstract classes, and creating classes with specific attributes and methods. The exam assesses knowledge of Java programming concepts, including encapsulation, garbage collection, and inheritance.

Uploaded by

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

United International University

Department of Computer Science and Engineering


CSI 211: Object Oriented Programming Mid Exam : Summer 2018
Total Marks: 30 Time: 1 hour 45 minutes

There are THREE questions. Figures in the right-hand margin indicate full marks.

1. (a) Write a code fragment to create the following multidimensional integer array. (2)

(b) Indicate true or false by T/F. (2)


i. An abstract class must have at least one abstract method.
ii. An abstract class can have concrete methods.
iii. In java a class cannot implement multiple interfaces.
iv. In java a class cannot implement multiple abstract classes.
(c) Underline the error, and write the fixed code. You CANNOT add/delete any line. The fixed code should
produce the following output: Hello World (3)

(d) Explain what is wrong with this code. Fix the code. You CANNOT add/delete any line. (3)

2. (a) How many objects are eligible for garbage collection after executing the following code (show graphically)?(3)
(b) Write a complete Product class implementing encapsulation. The class has the following instance variables:
name, price. Use getter and setter methods in the class to set and get the values of the fields. However,
ensure that name and price cannot be changed from outside of the class. Write a constructor to initialize
the Product object with name only. (3)
(c) Write the output of the code. (4)

3. (a) Suppose youre building a software for a private organization. Now, write a class named Employee. It has
two attributes name and salary with types respectively String and Floating point number. The constructor
of Employee class initializes name and salary with this reference keyword. There is one method named
void printSalary(). The classes that extend Employee are PlatinumEmployee and SilverEmployee.
PlatinumEmployee class overrides printSalary() method by invoking parent method and also prints the
name and bonus amount which is 15% of the actual salary and finally prints the total salary by adding the
bonus amount. SilverEmployee class also overrides printSalary() in similar way except that the bonus
amount is 7% in this case. Write the code of these two classes also. (4)
(b) Write the output of the code. (3)

(c) Write the output of the code. (3)

You might also like