wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

OOP Module 3 Tutorial (Quiz)

Total questions: 10

Worksheet time: 20mins

Name
Class
Date
1.

Which option is correct for creating a package named s3cs ?

a)

create package s3cs;

b)

package s3cs;

c)

define package 3cs;

d)

s3cs;

2.

Which is true about package?

a)

packages can appear in a hierarchy.

b)

package help to control the visibility of the program.

c)

package helps to group related classes and interfaces.

d)

All of the above

3.

To use a class or a package from the library which keyword is used

a)

include

b)

package

c)

import

d)

export

4.

A class member can be accessed only by a class in the same package. Which is the suitable access specifier?

a)

public

b)

default

c)

private

d)

protected

5.

A class member cannot be accessed by any other class inside or outside the package. Which is the suitable access specifier?

a)

private

b)

public

c)

default

d)

protected

6.

Which of the following help to access all the classes in the package p1?

a)

import p1;

b)

import p1.*;

c)

import p1.all;

d)

import p1.A;

7.

Which of the following help to use class Sample from package adm? (choose all appropriate options)

a)

import admSample;

b)

import adm.Sample;

c)

import Sample;

d)

import adm.*;

8.

Multiple inheritance in Java can be achieved using

a)

class and interface

b)

class

c)

interface

d)

package

9.

Which of the following is false?

a)

Any number of classes can implement an interface.

b)

Any number of interfaces can implement a class.

c)

An interface can extend another interface.

d)

A claas can extend another class

10.

Which of the following is true about interface?

a)

Interface can contain abstract methods.

b)

A class implementing an interface should define all the methods in that interface.

c)

Interface is not used for creating objects.

d)

All of the above