wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Packages + java-visual

Total questions: 84

Worksheet time: 28mins

Name
Class
Date
1.

Which of the following classes is part of the java.awt package?

a)

System

b)

String

c)

ArrayList

d)

Button

2.

Which of the following packages is the default package in the image?

a)

default package

b)

Hellojava

c)

rest

d)

SpringJSONRest Test

3.

Which of the following statements about packages in Java is NOT true?

a)

Packages are used to organize Java classes and interfaces.

b)

Packages can be used to control access to Java classes and interfaces.

c)

Packages can be used to prevent name clashes between Java classes and interfaces.

d)

Packages are a required part of the Java language.

4.

Which line of code indicates to the compiler that the Person class belongs to the personpackage package?

a)

package personpackage;

b)

public class Person

c)

private String firstName;

d)

public String getFirstName()

5.

Which of the following classes is part of the java.lang package?

a)

System

b)

String

c)

ArrayList

d)

Button

6.

Which of the following is the most common type of built-in package in Java?

a)

java.lang

b)

java.util

c)

java.awt

7.

Which of the following packages is not a sub-package of java.util?

a)

concurrent

b)

logging

c)

collections

d)

concurrency.concurrent

8.

Which of the following is the default package in Java?

a)

java

b)

lang

c)

util

d)

awt

9.

Which of the following is the name of the folder in the image?

a)

animals

b)

Animals

c)

animal

d)

animals.class

10.

Which of the following classes is part of the java.util package?

a)

Date

b)

Calendar

c)

Object

d)

Applet

11.

What is the name of the class that is being tested?

a)

ClassOne

b)

ClassTwo

c)

Testing

d)

package_name

12.

Which of the following is the default package in Java?

a)

default package

b)

Hellojava

c)

rest

d)

SpringJSONRest Test

13.

Which of the following packages is the root package in Java?

a)

java

b)

lang

c)

util

d)

awt

14.

Which of the following classes is part of the java.lang package?

a)

System

b)

String

c)

ArrayList

d)

Button

15.

Which of the following is the name of the package that contains the Dodecahedron and Icosahedron classes?

a)

geometry

b)

default package

c)

java.lang

d)

java.util

16.

Which of the following is the name of the package that contains the Geekyshows.java file?

a)

geekyshows

b)

default package

c)

hellojava

d)

rest

17.

Which of the following is the name of the sub-package of java.util that contains the ArrayList class?

a)

collection

b)

collections

c)

list

d)

array

18.

Which of the following is the name of the package that contains the Mobile and Laptop classes?

a)

gadget

b)

default package

c)

mainn

d)

rest

19.

Which of the following is the name of the package that contains the Shapes.java file?

a)

shapes

b)

default package

c)

hellojava

d)

rest

20.

Which of the following is the name of the package that contains the Circle and Rectangle classes?

a)

shapes

b)

default package

c)

hellojava

d)

rest

21.

Which of the following is the name of the package that contains the Person class?

a)

personpackage

b)

default package

c)

java.util

d)

java.lang

22.

Which of the following is the name of the interface that is implemented by the Circle and Rectangle classes?

a)

Shape

b)

GeometricObject

c)

Colorable

d)

Cloneable

23.

Which of the following is the name of the package that contains the NonPackagedClass.java file?

a)

default package

b)

hellojava

c)

rest

d)

classes

24.

Which of the following is the name of the class that is part of the java.util package and is used to represent a list of elements?

a)

ArrayList

b)

LinkedList

c)

Set

d)

Map

25.

Which of the following is the name of the class that is used to represent a geometric object?

a)

Circle

b)

Rectangle

c)

Shape

d)

GeometricObject

26.

Which of the following is the name of the method that is used to get the name of the package that a class belongs to?

a)

getPackageName()

b)

getPackage()

c)

packageName()

d)

package()

27.

Which of the following is the name of the package that contains the HumanResources class?

b)

default package

c)

hellojava

d)

rest

28.

Which of the following is the name of the package that contains the org.xtext.example.mydsl.myDsl class?

a)

org.xtext.example.mydsl

b)

myDsl

c)

default package

d)

hellojava

29.

Which of the following is the name of the package that contains the AbstractMap.java class?

a)

java.util

b)

default package

c)

collections

d)

map

30.

Which of the following is the name of the class that is used to represent a geometric object with a radius?

a)

Circle

b)

Rectangle

c)

Shape

d)

GeometricObject

31.

Which of the following is the name of the class that is used to represent a geometric object with four sides?

a)

Rectangle

b)

Square

c)

Circle

d)

Triangle

32.

Which of the following is the name of the sub-package of java.util that contains the ArrayList class?

a)

collection

b)

collections

c)

list

d)

array

33.

Which of the following is the name of the class that is used to represent a geometric object with no sides?

a)

Point

b)

Line

c)

Circle

d)

Rectangle

34.

Which of the following is the name of the package that contains the New Java Package window?

a)

default package

b)

com.baeldung

c)

hellojava

d)

rest

35.

What is the text on the laptop screen?

a)

Java Packages

b)

Built-in Packages

c)

User-Defined Packages

36.

Which of the following is the most common type of predefined package in Java?

a)

Java.lang [Image shows Java.lang package with 5 classes and 7000 methods]

b)

Java.util [Image shows Java.util package with 8 classes and 7 lakh methods]

c)

Java.io [Image shows Java.io package with 2 classes and 150 sub-packages]

d)

Java.applet [Image shows Java.applet package with 1 class]

37.

Which of the following is a predefined package in Java?

a)

java [Image shows java package]

b)

lang [Image shows lang package]

c)

rmi [Image shows rmi package]

d)

security [Image shows security package]

38.

Which of the following classes is part of the java.lang package?

a)

Math [Image shows Math class]

b)

String [Image shows String class]

c)

Object [Image shows Object class]

d)

Process [Image shows Process class]

39.

What is the name of the directory that contains the files ClassOne.class, ClassOne.java, ClassTwo.class, and ClassTwo.java?

a)

package_name [Image shows that package_name is a folder, not a directory.]

b)

package_one [Image shows that package_one is a folder, not a directory.]

c)

src [Image shows that src is a directory, and it contains the files ClassOne.class, ClassOne.java, ClassTwo.class, and ClassTwo.java.]

d)

eclipse_workbench [Image shows that eclipse_workbench is a folder, not a directory.]

40.

What are the two types of packages in Java?

a)

Built-in Packages [Image shows Built-in Packages]

b)

User-Defined Packages [Image shows User-Defined Packages]

c)

Public Packages [Image does not show Public Packages]

d)

Private Packages [Image does not show Private Packages]

41.

Which of the following directories is used to store the source code of the project?

a)

mycorp [Image shows mycorp directory]

b)

STC [Image shows STC directory]

c)

com.mycorp [Image shows com.mycorp directory]

d)

entity [Image shows entity directory]

42.

Which of the following is a type of package in Java?

a)

Inbuilt Packages [Image shows Inbuilt Packages]

b)

User-Defined Packages [Image shows User-Defined Packages]

c)

Public Packages [Image does not show Public Packages]

d)

Private Packages [Image does not show Private Packages]

43.

What is the name of the package that contains the MyClass class?

a)

com [Image shows com folder]

b)

foo [Image shows foo folder]

c)

bar [Image shows bar folder]

d)

com.foo.bar [Image shows MyClass class inside com.foo.bar folder]

44.

What is the name of the package that contains the UserManager class?

a)

com.zodizo [Image shows com.zodizo folder]

b)

model [Image shows model folder inside com.zodizo folder]

c)

UserManager [Image shows UserManager class inside model folder]

d)

None of the above

45.

What is the error message in the image?

a)

The package info.sample.arm does not match the expected package in the implementation file. [Image shows error message "The package info.sample.arm does not match the expected package in the implementation file"]

b)

The package info.sample.arm is not a valid Java package.

c)

The package info.sample.arm is not imported in the project.

d)

The class Arm is not defined in the package info.sample.arm.

46.

What is the name of the package that contains the Arm class?

a)

info.sample.arm [Image shows Arm class inside info.sample.arm package]

b)

info.sample [Image shows info.sample folder, but Arm class is not inside info.sample folder]

c)

sample [Image does not show Arm class inside sample folder]

d)

None of the above

47.

Which of the following classes is a subclass of the java.lang.Object class?

a)

System [Image shows System class inside java package]

b)

String [Image shows String class inside java.lang package]

c)

. ArrayList [Image shows ArrayList class inside java.util package]

d)

Button [Image shows Button class inside java.awt package]

48.

Which package has the most methods?

a)

javax.swing [Image shows javax.swing package with 1041 methods]

b)

java.awt [Image shows java.awt package with 674 methods]

c)

java.util [Image shows java.util package with 448 methods]

d)

java.lang [Image shows java.lang package with 146 methods]

49.

Which of the following classes is inside the util package?

a)

Map [Image shows Map class inside util package]

b)

System [Image shows System class inside java package]

c)

import ArrayList [There is no such import statement]

d)

No import statement is required

50.

Which of the following import statements is required to access the ArrayList class?

a)

import java.util.ArrayList [Image shows ArrayList class inside java.util package]

b)

import java.util [Image does not show ArrayList class inside java.util package]

c)

import ArrayList [There is no such import statement]

d)

No import statement is required

51.

Which of the following is the name of the project that is currently open in the Eclipse workspace window?

a)

Selenium Project [Image shows Selenium Project in the workspace window]

b)

Eclipse [Image does not show Eclipse project in the workspace window]

c)

Java [Image does not show Java project in the workspace window]

d)

None of the above

52.

What is the name of the method that is currently being executed?

a)

main [Image shows main method highlighted]

b)

System.out.println [Image does not show System.out.println method highlighted]

c)

getName [Image does not show getName method highlighted]

d)

printName [Image does not show printName method highlighted]

53.

What is the current working directory?

a)

G:\EDUCATIONAL JAVA PACKAGE [Image shows current working directory as G:\EDUCATIONAL JAVA PACKAGE]

b)

[Image does not show G:\ directory]

c)

[Image does not show . directory]

d)

None of the above

54.

Which of the following is the name of the library that contains the CalcView.java class?

a)

<default package> [Image shows <default package>]

b)

controller [Image does not show CalcView.java class inside controller folder]

c)

framework [Image does not show CalcView.java class inside framework folder]

d)

view [Image shows CalcView.java class inside view folder]

55.

Which of the following is the name of the class that is currently being edited?

a)

JavaPackageApp [Image shows JavaPackageApp class highlighted]

b)

System [Image does not show System class highlighted]

c)

out [Image does not show out class highlighted]

d)

print [Image does not show print class highlighted]

56.

Which of the following is the name of the layer that is responsible for interacting with the user?

a)

Presentation layer [Image shows Presentation layer]

b)

Service layer [Image does not show Service layer]

c)

Data Access layer [Image does not show Data Access layer]

d)

None of the above

57.

What is the name of the variable that is declared on line 1?

a)

port [Image shows port variable declared on line 1]

b)

tester [Image does not show tester variable declared on line 1]

c)

default backg [Image does not show default backg variable declared on line 1]

d)

import declaration [Image does not show import declaration on line 1]

58.

What is the type of the variable name?

a)

String [Image shows String type for name variable]

b)

Integer [Image does not show Integer type for name variable]

c)

Float [Image does not show Float type for name variable]

d)

Boolean [Image does not show Boolean type for name variable]

59.

Which of the following is the name of the class that is the parent class of the Employee class?

a)

Person [Image shows Person class as the parent class of Employee class]

b)

Object [Image does not show Object class as the parent class of Employee class]

c)

Animal [Image does not show Animal class as the parent class of Employee class]

d)

None of the above

60.

What is the return type of the main method?

a)

void [Image shows void as the return type of the main method]

b)

String [Image does not show String as the return type of the main method]

c)

. Integer [Image does not show Integer as the return type of the main method]

d)

None of the above

61.

Which of the following is the name of the package that contains the Scanner class?

a)

java.util [Image shows Scanner class inside java.util package]

b)

java.lang [Image does not show Scanner class inside java.lang package]

c)

java.io [Image does not show Scanner class inside java.io package]

d)

java.util.scanner [There is no such package]

62.

Which of the following packages contains the A.java class?

a)

science [Image shows A.java class inside science package]

b)

tech [Image does not show A.java class inside tech package]

c)

info [Image does not show A.java class inside info package]

d)

None of the above

63.

Which of the following packages contains the HumanResources class?

a)

com.tutorialspoint.demo.hr.model [Image shows HumanResources class inside com.tutorialspoint.demo.hr.model package]

b)

com.tutorialspoint.demo [Image does not show HumanResources class inside com.tutorialspoint.demo package]

c)

com.tutorialspoint [Image does not show HumanResources class inside com.tutorialspoint package]

d)

None of the above

64.

Which of the following is the name of the method that is currently being called?

a)

main [Image shows main method highlighted]

b)

System.out.println [Image does not show System.out.println method highlighted]

c)

getName [Image does not show getName method highlighted]

d)

printName [Image does not show printName method highlighted]

65.

Which of the following is the name of the variable that is assigned the value "Hello, world!"?

a)

name [Image does not show name variable assigned the value "Hello, world!"]

b)

message [Image shows message variable assigned the value "Hello, world!"]

c)

greeting [Image does not show greeting variable assigned the value "Hello, world!"]

d)

world [Image does not show world variable assigned the value "Hello, world!"]

66.

Which of the following annotations is used to mark a class as deprecated?

a)

@Deprecated [Image shows @Deprecated annotation]

b)

@AnyMetaDef [Image does not show @AnyMetaDef annotation]

c)

@AnyMetaDate [Image does not show @AnyMetaDate annotation]

d)

None of the above

67.

Which of the following packages contains the InstructionQueue class?

a)

Instructions [Image shows Instructions folder containing InstructionQueue.java class]

b)

Queues [Image does not show Queues folder containing InstructionQueue.java class]

c)

Messages [Image does not show Messages folder containing InstructionQueue.java class]

d)

None of the above

68.

Which of the following packages contains the Arm.java class?

a)

com.example.javapackagestructure.arm [Image shows Arm.java class inside com.example.javapackagestructure.arm folder]

b)

com.example.javapackagestructure.components [Image does not show Arm.java class inside com.example.javapackagestructure.components folder]

c)

com.example.javapackagestructure.models [Image does not show Arm.java class inside com.example.javapackagestructure.models folder]

d)

None of the above

69.

Which of the following is the correct package structure for the HomeLoan class?

a)

com.example.javapackagestructure.homeloan [Image shows com.example.javapackagestructure.homeloan package]

b)

com.example.javapackagestructure.homeloans [Image does not show com.example.javapackagestructure.homeloans package]

c)
70.

What is the error message in the image?

a)

The method main is not declared static. [Image shows error message "The method main must be declared static.". ]

b)

The class Soulie is not public. [Image does not show error message about class Soulie.]

c)

The variable name is not initialized. [Image does not show error message about variable name.]

d)

The method printName is not declared. [Image does not show error message about method printName.]

71.

Which of the following is the name of the test case that is associated with the Module 2 automation?

a)

Test Case 1 [Image shows Test Case 1 associated with Module 2 automation]

b)

Test Case 2 [Image does not show Test Case 2 associated with Module 2 automation]

c)

Test Case 3 [Image does not show Test Case 3 associated with Module 2 automation]

d)

Test Case 4 [Image does not show Test Case 4 associated with Module 2 automation]

72.

Which of the following is the name of the security manager that is responsible for managing the permissions of code that is running in the Java Virtual Machine (JVM)?

a)

AccessController [Image shows AccessController class]

b)

CodeSource [Image does not show CodeSource class]

c)

Permission [Image does not show Permission class]

d)

ProtectionDomain [Image does not show ProtectionDomain class]

73.

What is the name of the variable that is assigned the value 100?

a)

x [Image shows variable x assigned the value 100.]

b)

y [Image does not show variable y assigned the value 100.]

c)

z [Image does not show variable z assigned the value 100.]

d)

a [Image does not show variable a assigned the value 100.]

74.

Which of the following packages contains the AbstractclassandInterface class?

a)

com.example.javapackagestructure.abstractclassandinterface [Image shows AbstractclassandInterface class inside com.example.javapackagestructure.abstractclassandinterface folder.]

b)

com.example.javapackagestructure.components [Image does not show AbstractclassandInterface class inside com.example.javapackagestructure.components folder.]

c)

com.example.javapackagestructure.models [Image does not show AbstractclassandInterface class inside com.example.javapackagestructure.models folder.]

d)

None of the above

75.

What is the name of the package that contains the Containment class?

a)

com.example.javapackagestructure.containment [Image shows Containment class inside com.example.javapackagestructure.containment folder.]

b)

com.example.javapackagestructure.components [Image does not show Containment class inside com.example.javapackagestructure.components folder.]

c)

com.example.javapackagestructure.models [Image does not show Containment class inside com.example.javapackagestructure.models folder.]

d)

None of the above

76.

Which of the following packages contains the Scanner class?

a)

java.util [Image shows Scanner class inside java.util package.]

b)

java.lang [Image does not show Scanner class inside java.lang package.]

c)

java.io [Image does not show Scanner class inside java.io package.]

d)

None of the above

77.

Which of the following packages contains the Employee class?

a)

com.example.javapackagestructure.employee [Image shows Employee class inside com.example.javapackagestructure.employee folder.]

b)

com.example.javapackagestructure.components [Image does not show Employee class inside com.example.javapackagestructure.components folder.]

c)

com.example.javapackagestructure.models [Image does not show Employee class inside com.example.javapackagestructure.models folder.]

d)

None of the above

78.

Which of the following is a primitive type in Java?

a)

String [Image shows String class, which is a reference type.]

b)

Integer [Image shows Integer class, which is a primitive type.]

c)

Float [Image shows Float class, which is a primitive type.]

d)

Object [Image does not show Object class, which is a reference type.]

79.

Which of the following packages contains the NewJavaPackage class?

a)

com.example.javapackagestructure.newjavapackage [Image shows NewJavaPackage class inside com.example.javapackagestructure.newjavapackage folder.]

b)

com.example.javapackagestructure.components [Image does not show NewJavaPackage class inside com.example.javapackagestructure.components folder.]

c)

com.example.javapackagestructure.models [Image does not show NewJavaPackage class inside com.example.javapackagestructure.models folder.]

d)

None of the above

80.

Which of the following packages contains the HelloMoon.java file?

a)

com.example.javapackagestructure.hellomoon [Image shows HelloMoon.java file inside com.example.javapackagestructure.hellomoon folder.]

b)

com.example.javapackagestructure.components [Image does not show HelloMoon.java file inside com.example.javapackagestructure.components folder.]

c)

com.example.javapackagestructure.models [Image does not show HelloMoon.java file inside com.example.javapackagestructure.models folder.]

d)

None of the above

81.

What is the name of the variable that is assigned the value "Hello, world!"?

a)

name [Image does not show variable name assigned the value "Hello, world!"]

b)

message [Image shows variable message assigned the value "Hello, world!"]

c)

greeting [Image does not show variable greeting assigned the value "Hello, world!"]

d)

world [Image does not show variable world assigned the value "Hello, world!"]

82.

Which of the following is the correct package structure for the Car class?

83.

Which of the following packages is used for networking?

a)

java.net [Image shows java.net package]

b)

java.io [Image does not show java.io package]

c)

java.lang [Image does not show java.lang package]

d)

java.util [Image does not show java.util package]

84.

Which of the following libraries is used for 2D rendering in Java?

a)

JavaFX [Image shows JavaFX library]

b)

Swing [Image does not show Swing library]

c)

AWT [Image does not show AWT library]

d)

None of the above