Professional Documents
Culture Documents
TERM 3 OOP Prelim Lab Exam - Attempt Review
TERM 3 OOP Prelim Lab Exam - Attempt Review
TERM 3 OOP Prelim Lab Exam - Attempt Review
UGRD-CS6203-2113T /
Object-Oriented Programming /
Prelim Lab Exam
Question 1
Correct
class Person
{
private Person()
{
age = 24;
}
}
System.out.println(p.age);
}
a. Syntax Error
c. Compilation error
d. 24
Correct
Find the correct answer from the following two program -
a. The private
members can only be accessed using public
b. getter
and setter methods of super class are not shown in the example
c. The
derived class inherits all the members and methods
d. The
private members can’t be accessed only in its own class
Correct
{
public : class B
{
public : B(int i):
data(i)
{
}
int data;
}
};
class C: public A
{
};
b. Single level inheritance is used, with both enclosing and nested classes
Correct
Find the order of execution of constructors in Java Inheritance in the following bellow -
class Animal{
public Animal(){
System.out.println("Base Constructor");
}
}
System.out.println("Derived Constructor");
}
}
public class Program {
b. None
c. Random order
Correct
class A
{
void msg()
{
System.out.println("Hello Java");
}
}
class B
{
void msg()
{
System.out.println("Welcome you");
}
}
class C extends A, B
{
{
}
Jump to...