0% found this document useful (0 votes)
111 views5 pages

Term 3 OOP Prelim Lab Exam - Attempt Review1

Ian Nichole Salcedo is inviting you to a scheduled Zoom meeting. Topic: Ian Nichole Salcedo's Personal Meeting Room Join Zoom Meeting https://us04web.zoom.us/j/2375579101?pwd=TJ6MUaykm00zZzHw4lVu0NzgB-RRs5.1 Meeting ID: 237 557 9101 Passcode: N4br0Q

Uploaded by

Nicolas Salcedo
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)
111 views5 pages

Term 3 OOP Prelim Lab Exam - Attempt Review1

Ian Nichole Salcedo is inviting you to a scheduled Zoom meeting. Topic: Ian Nichole Salcedo's Personal Meeting Room Join Zoom Meeting https://us04web.zoom.us/j/2375579101?pwd=TJ6MUaykm00zZzHw4lVu0NzgB-RRs5.1 Meeting ID: 237 557 9101 Passcode: N4br0Q

Uploaded by

Nicolas Salcedo
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/ 5

Home / My courses /

UGRD-CS6203-2113T /
Object-Oriented Programming /
Prelim Lab Exam

Started on Thursday, 4 November 2021, 9:30 PM


State Finished
Completed on Thursday, 4 November 2021, 9:44 PM
Time taken 13 mins 34 secs
Marks 20.00/50.00
Grade 40.00 out of 100.00

Question 1
Correct

Mark 10.00 out of 10.00

Which among the following is correct for the


following code?
class A


    public : class B

    {
        public : B(int i):
data(i)
        {

        }
        int data;

    }
};
class C: public A

{
     class D:public A::B{ };
};

a. Multi-level inheritance is used, with nested classes

b. Single level inheritance is used, with nested classes

c. Single level inheritance is used, with both enclosing and nested classes

d. Multi-level inheritance is used, with nested classes

Your answer is correct.


Question 2
Incorrect

Mark 0.00 out of 10.00

Find the correct answer from the following two program -  

a. 
The
private members can’t be accessed only in its own class

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 only be accessed using public

Your answer is incorrect.

Question 3
Incorrect

Mark 0.00 out of 10.00

Check the program and find out if it will run properly?


class A 


 void msg() 

 { 
    System.out.println("Hello Java"); 
  } 


class B 


  void msg() 
  { 

     System.out.println("Welcome you"); 
  } 
 } 

class C extends A, B 

 public static void main(String args[]) 

 { 
   C obj = new C(); 

   obj.msg();//Now which msg() method would be called? 


  } 

 }

a. Got syntax error


b. Got compile time error

c. Was able to run properly

d. Displayed the final output

Your answer is incorrect.


Question 4
Correct

Mark 10.00 out of 10.00

What is the output of the following Java code?


class Person 


    private int age; 

    
    private Person() 
    { 

        age = 24; 
    } 

public class Test 


    public static void main(String[] args) 


    { 
        Person p = new Person(); 

        System.out.println(p.age); 
    } 

a. Run Time Error

b. Syntax Error

c. Compilation error

d. 24

Your answer is correct.


Question 5
Incorrect

Mark 0.00 out of 10.00

Find the order of execution of constructors in Java Inheritance in the following bellow -
class Animal{

public Animal(){
System.out.println("Base Constructor");

}
}
class Cat extends Animal{

public Cat(){
System.out.println("Derived Constructor");
}

}
public class Program {

public static void main(String[] args) {


Cat c = new Cat();   
}

a. None

b. Random order

c. Base to derived class

d. Derived to base class


Your answer is incorrect.

◄ Prelim Lab Quiz 2

Jump to...

Midterm Lab Quiz 1 ►

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy