MODEL QUESTION PAPER
Department of Computer Science & Engineering
THE NATIONAL INSTITUTE OF ENGINEERING, MYSURU – 8
(An Autonomous Institute under VTU, Belagavi)
Third Semester
BCS306A Object Oriented Programming with Java
Time: 3 Hrs Max. Marks: 100
Note: Answer all the questions
Q. No. Cognt. COs Questions Marks
Level
1.a) L2 CO1 Describe different syntax of array allocation in JAVA. Write a Java 10
program to implement the addition of two matrixes.
b) L3 CO1 Demonstrate the working of enhanced for loop with an example 10
program.
2.a) L3 CO2 Illustrate different types of constructors. Include passing of object as 10
parameter to constructors.
b) L3 CO2 Write a JAVA program demonstrating Method overloading. 6
c) L2 CO2 Explain use of this keyword in JAVA. 4
OR
2.d) L3 CO2 Write a Java program with class Rectangle with the data fields width, 8
length, area and color. The length, width and area are of double type
and color is string type. The methods are setLength, setWidth,
setColor and find_area. Create two objects of Rectangle and compare
and color. If area and color both are same for the objects then display
Matching Rectangles, otherwise display Non matching
Rectangles.
e) L2 CO2 Example two uses of super keyword with example. 4
f) L3 CO2 Demonstrate the working of final class in JAVA. 8
3.a) L3 CO2 With respect to the below code, complete the blanks to obtain the 8
following output.
class Animal {
String type;
Animal (__________) {
[Link] = ________;
}}
class Dog extends Animal {
String breed;
Dog (__________) {
super (__________);
[Link] = ________; }
void display () {
[Link]("Type: " + ________ + ", Breed: " + ________);
}}
public class Main {
public static void main (String[] args) {
Dog dog = new Dog (________, _________);
[Link]();
}}
OUTPUT:
Type: Mammal, Breed: Golden Retriever
b) L2 CO2 List and explain the types of Inheritance. 4
c) L3 CO2 Write a Java program that creates a class hierarchy for employees of 8
a company. The base class should be Employee, with subclasses
Manager, Developer. Each subclass should have properties such as
name, address, salary, and job title. Implement methods for
calculating bonuses, generating performance reports, and managing
projects.
4.a) L3 CO2 Demonstrate the working of interface in JAVA with example 10
program.
b) L2 CO2 Explain the concept of importing packages in Java. 10
OR
4.c) L3 CO2 How do you create user-defined exception class? Explain with a 10
program.
d) L2 CO2 Explain different access modifiers in inter and intra package 10
visibility.
5.a) L3 CO2 What is multithreading? Write a program to create multiple threads 10
in JAVA.
b) L3 CO2 Explain in detail the different ways of creating threads with example 10
program.
---***---