Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

java4

Total questions: 18

Worksheet time: 9mins

Name
Class
Date
1.
Which of these keyword is used to define interfaces in Java?
a)
interface
b)
INTF
c)
INTERFACE
d)
None of these
2.
Which of these can be used to fully abstract a class from its implementation?
a)
Objects
b)
Packages
c)
Interfaces
d)
None of these
3.
Which of these keyword is used by a class to use an interface defined previously?
a)
import
b)
extends
c)
implements
d)
IMPLEMENTS
4.
An interface in Java is like a 100%
a)
abstract class
b)
public class
c)
inner class
d)
anonymous class
5.
All interface variables are _____ by default in Java
a)
public
b)
final
c)
public & final
d)
None of these
6.
All interface methods are _____ by default in Java
a)
public
b)
abstract method
c)
public & abstract
d)
None of these
7.
Which of these keywords is used to define a package in Java?
a)
pkg
b)
Pkg
c)
Package
d)
package
8.
Which of these access specifiers can be used for a class so that its members can be acceessed by a different class in the different package?
a)
public
b)
protected
c)
private
d)
None of these
9.
Which of the following is the correct way of importing an entire package?
a)
import pkg.
b)
import Pkg.
c)
import pkg.*;
d)
import *;
10.
Which of the following package stores all the standard java classes?
a)
lang
b)
java
c)
util
d)
io
11.
What is the maximum number of Java class files that can be kept inside a single java package?
a)
8
b)
64
c)
128
d)
Unlimited
12.
Which of these access specifiers can be used for a class so that its members can be accessed by a different class in the same package?
a)
public
b)
protected
c)
Both A and B
d)
none of these
13.
Package is a mechanism to encapsulate a _________
a)
classes
b)
sub packages
c)
interfaces
d)
all of the above
14.
Packages that are inside another package are the
a)
packages
b)
nested packages
c)
util packages
d)
subpackages
15.
An ____ statement can be used to access the classes and interface of a different package from the current poackage.
a)
instanceOf
b)
import
c)
extends
d)
implements
16.
Which of the following package is used to includes utility classes like Calendar, Collection, Date?
a)
java.lang
b)
java.net
c)
java.awt
d)
java.util
17.
We cannot create an instance of _______
a)
nested class
b)
parent class
c)
abstract class
d)
anonymous class
18.
Types of polymorphism in java are
a)
compile time
b)
run time
c)
both A and B
d)
None of these