You are on page 1of 12

3/25/2021 Quiz 2-OOAD

Quiz 2-OOAD
Note: \\ denote line change in options given

* Required

1. Email address *

2. Which of the following is not an OOPS concept? * 1 point

Mark only one oval.

Inheritance

Polymorphism

Exception

Abstraction

https://docs.google.com/forms/d/1SWi4DdWWm-DmceyTP4j39SSh2Y5WbQEd3D-pB5242BE/edit 1/12
3/25/2021 Quiz 2-OOAD

3. Output of the following code? * 1 point

Mark only one oval.

Instance block, method, static block, and constructor

Method, constructor, instance block, and static block

Static block, method, instance block, and constructor

Static block, instance block, constructor, and method

4. What do understand by anonymous objects? * 1 point

Mark only one oval.

An object created by using the new keyword.

An object of a superclass created in the subclass.

An object without having any name but having a reference.

An object that has no reference

https://docs.google.com/forms/d/1SWi4DdWWm-DmceyTP4j39SSh2Y5WbQEd3D-pB5242BE/edit 2/12
3/25/2021 Quiz 2-OOAD

5. An empty interface i.e., without data members and methods is known as a 1 point

______. *

Mark only one oval.

Runnable Interface

Marker Interface

Abstract Interface

CharSequence Interface

6. Which of the following is correct? * 1 point

Mark only one oval.

Abstraction and Polymorphism features are the same

Inheritance and Encapsulation features are the same

Encapsulation and Polymorphism features are the same

Encapsulation and Abstraction features are same

7. Which of the following is incorrect? * 1 point

Mark only one oval.

A public member of a class can be accessed in all the packages.

A private member of a class cannot be accessed by the methods of the same class.

A private member of a class cannot be accessed from its derived class.

A protected member of a class can be accessed from its derived class

https://docs.google.com/forms/d/1SWi4DdWWm-DmceyTP4j39SSh2Y5WbQEd3D-pB5242BE/edit 3/12
3/25/2021 Quiz 2-OOAD

8. Consider the following code fragment . Robot r1 = new Robot(); 1 point

r1.setColor(Color.blue); Robot r2 = r1; r2.setColor(Color.red); After this code


is executed, what are the colors of r1 andr2 (in the order)? *

Mark only one oval.

Color.blue and Color.red

Color.blue and Color.blue

Color.red and Color.red

Color.red and Color.blue

9. Which of the following is not true about interfaces in java. * 1 point

Mark only one oval.

An interface can contain following type of members: 1) public, static, final fields (i.e.,
constants) 2) default and static methods with bodies

An instance of interface can be created.

A class can implement multiple interfaces.

Many classes can implement the same interface.

https://docs.google.com/forms/d/1SWi4DdWWm-DmceyTP4j39SSh2Y5WbQEd3D-pB5242BE/edit 4/12
3/25/2021 Quiz 2-OOAD

10. Output of the following code? * 1 point

Mark only one oval.

a=10

a=20

compilation error

run time error

https://docs.google.com/forms/d/1SWi4DdWWm-DmceyTP4j39SSh2Y5WbQEd3D-pB5242BE/edit 5/12
3/25/2021 Quiz 2-OOAD

11. Output of the following code? * 1 point

Mark only one oval.

True

False

12. Output of following code? * 1 point

Mark only one oval.

Compilation error

Runtime Error

200

None of the above

https://docs.google.com/forms/d/1SWi4DdWWm-DmceyTP4j39SSh2Y5WbQEd3D-pB5242BE/edit 6/12
3/25/2021 Quiz 2-OOAD

13. Output of following code? * 1 point

Mark only one oval.

9.0 \\ 9.0

9 \\ 9

Compilation error

Run time error

https://docs.google.com/forms/d/1SWi4DdWWm-DmceyTP4j39SSh2Y5WbQEd3D-pB5242BE/edit 7/12
3/25/2021 Quiz 2-OOAD

14. Output of following code? * 1 point

Mark only one oval.

I am a Person

I am a Student

I am Person and I am a Student

I am a Student and I am a Person

15. Which of the following is/are not true about constructors in Java? 1) 1 point

Constructor name should be same as class name. 2) If you don't define a


constructor for a class, a default parameterless constructor is
automatically created by the compiler. 3) The default constructor calls
super() and initializes all instance variables to default value like 0, null. 4) If
we want to parent class constructor, it must be called in first line of
constructor. *

Mark only one oval.

none of these

234

1234

https://docs.google.com/forms/d/1SWi4DdWWm-DmceyTP4j39SSh2Y5WbQEd3D-pB5242BE/edit 8/12
3/25/2021 Quiz 2-OOAD

16. Output of the following code? 1 point

Mark only one oval.

inside static block \\ a = 4 \\ inside constructor \\ a = 11

Compilation error

Run time error

inside static block \\ a = 10 \\ inside constructor \\ a = 11

https://docs.google.com/forms/d/1SWi4DdWWm-DmceyTP4j39SSh2Y5WbQEd3D-pB5242BE/edit 9/12
3/25/2021 Quiz 2-OOAD

17. Which of these keywords cannot be used for a class which has been 1 point

declared final? *

Mark only one oval.

abstract

extends

abstract and extends

none of the these

18. Output of following Code? * 1 point

Mark only one oval.

Compilation Error

https://docs.google.com/forms/d/1SWi4DdWWm-DmceyTP4j39SSh2Y5WbQEd3D-pB5242BE/edit 10/12
3/25/2021 Quiz 2-OOAD

19. Which of the following is FALSE about abstract classes in Java * 1 point

Mark only one oval.

If we derive an abstract class and do not implement all the abstract methods, then
the derived class should also be marked as abstract using 'abstract' keyword

Abstract classes can have constructors

A class can be made abstract without any abstract method

A class can inherit from multiple abstract classes.

20. Output of following code? * 1 point

Mark only one oval.

12

21

13

31

https://docs.google.com/forms/d/1SWi4DdWWm-DmceyTP4j39SSh2Y5WbQEd3D-pB5242BE/edit 11/12
3/25/2021 Quiz 2-OOAD

21. * 1 point

Mark only one oval.

This content is neither created nor endorsed by Google.

 Forms

https://docs.google.com/forms/d/1SWi4DdWWm-DmceyTP4j39SSh2Y5WbQEd3D-pB5242BE/edit 12/12

You might also like