Font size
WorksheetsOOP Module 3 Tutorial (Quiz)
Total questions: 10
Worksheet time: 20mins
Which option is correct for creating a package named s3cs ?
create package s3cs;
package s3cs;
define package 3cs;
s3cs;
Which is true about package?
packages can appear in a hierarchy.
package help to control the visibility of the program.
package helps to group related classes and interfaces.
All of the above
To use a class or a package from the library which keyword is used
include
package
import
export
A class member can be accessed only by a class in the same package. Which is the suitable access specifier?
public
default
private
protected
A class member cannot be accessed by any other class inside or outside the package. Which is the suitable access specifier?
private
public
default
protected
Which of the following help to access all the classes in the package p1?
import p1;
import p1.*;
import p1.all;
import p1.A;
Which of the following help to use class Sample from package adm? (choose all appropriate options)
import admSample;
import adm.Sample;
import Sample;
import adm.*;
Multiple inheritance in Java can be achieved using
class and interface
class
interface
package
Which of the following is false?
Any number of classes can implement an interface.
Any number of interfaces can implement a class.
An interface can extend another interface.
A claas can extend another class
Which of the following is true about interface?
Interface can contain abstract methods.
A class implementing an interface should define all the methods in that interface.
Interface is not used for creating objects.
All of the above
