Font size
WorksheetsPackages + java-visual
Total questions: 84
Worksheet time: 28mins
Which of the following classes is part of the java.awt package?
System
String
ArrayList
Button
Which of the following packages is the default package in the image?
default package
Hellojava
rest
SpringJSONRest Test
Which of the following statements about packages in Java is NOT true?
Packages are used to organize Java classes and interfaces.
Packages can be used to control access to Java classes and interfaces.
Packages can be used to prevent name clashes between Java classes and interfaces.
Packages are a required part of the Java language.
Which line of code indicates to the compiler that the Person class belongs to the personpackage package?
package personpackage;
public class Person
private String firstName;
public String getFirstName()
Which of the following classes is part of the java.lang package?
System
String
ArrayList
Button
Which of the following is the most common type of built-in package in Java?
Which of the following packages is not a sub-package of java.util?
concurrent
logging
collections
concurrency.concurrent
Which of the following is the default package in Java?
java
lang
util
awt
Which of the following is the name of the folder in the image?
animals
Animals
animal
animals.class
Which of the following classes is part of the java.util package?
Date
Calendar
Object
Applet
What is the name of the class that is being tested?
ClassOne
ClassTwo
Testing
package_name
Which of the following is the default package in Java?
default package
Hellojava
rest
SpringJSONRest Test
Which of the following packages is the root package in Java?
java
lang
util
awt
Which of the following classes is part of the java.lang package?
System
String
ArrayList
Button
Which of the following is the name of the package that contains the Dodecahedron and Icosahedron classes?
geometry
default package
java.lang
java.util
Which of the following is the name of the package that contains the Geekyshows.java file?
geekyshows
default package
hellojava
rest
Which of the following is the name of the sub-package of java.util that contains the ArrayList class?
collection
collections
list
array
Which of the following is the name of the package that contains the Mobile and Laptop classes?
gadget
default package
mainn
rest
Which of the following is the name of the package that contains the Shapes.java file?
shapes
default package
hellojava
rest
Which of the following is the name of the package that contains the Circle and Rectangle classes?
shapes
default package
hellojava
rest
Which of the following is the name of the package that contains the Person class?
personpackage
default package
java.util
java.lang
Which of the following is the name of the interface that is implemented by the Circle and Rectangle classes?
Shape
GeometricObject
Colorable
Cloneable
Which of the following is the name of the package that contains the NonPackagedClass.java file?
default package
hellojava
rest
classes
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?
ArrayList
LinkedList
Set
Map
Which of the following is the name of the class that is used to represent a geometric object?
Circle
Rectangle
Shape
GeometricObject
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?
getPackageName()
getPackage()
packageName()
package()
Which of the following is the name of the package that contains the HumanResources class?
Which of the following is the name of the package that contains the org.xtext.example.mydsl.myDsl class?
org.xtext.example.mydsl
myDsl
default package
hellojava
Which of the following is the name of the package that contains the AbstractMap.java class?
java.util
default package
collections
map
Which of the following is the name of the class that is used to represent a geometric object with a radius?
Circle
Rectangle
Shape
GeometricObject
Which of the following is the name of the class that is used to represent a geometric object with four sides?
Rectangle
Square
Circle
Triangle
Which of the following is the name of the sub-package of java.util that contains the ArrayList class?
collection
collections
list
array
Which of the following is the name of the class that is used to represent a geometric object with no sides?
Point
Line
Circle
Rectangle
Which of the following is the name of the package that contains the New Java Package window?
default package
com.baeldung
hellojava
rest
What is the text on the laptop screen?
Which of the following is the most common type of predefined package in Java?
Which of the following is a predefined package in Java?
java [Image shows java package]
lang [Image shows lang package]
rmi [Image shows rmi package]
security [Image shows security package]
Which of the following classes is part of the java.lang package?
Math [Image shows Math class]
String [Image shows String class]
Object [Image shows Object class]
Process [Image shows Process class]
What is the name of the directory that contains the files ClassOne.class, ClassOne.java, ClassTwo.class, and ClassTwo.java?
package_name [Image shows that package_name is a folder, not a directory.]
package_one [Image shows that package_one is a folder, not a directory.]
src [Image shows that src is a directory, and it contains the files ClassOne.class, ClassOne.java, ClassTwo.class, and ClassTwo.java.]
eclipse_workbench [Image shows that eclipse_workbench is a folder, not a directory.]
What are the two types of packages in Java?
Built-in Packages [Image shows Built-in Packages]
User-Defined Packages [Image shows User-Defined Packages]
Public Packages [Image does not show Public Packages]
Private Packages [Image does not show Private Packages]
Which of the following directories is used to store the source code of the project?
mycorp [Image shows mycorp directory]
STC [Image shows STC directory]
com.mycorp [Image shows com.mycorp directory]
entity [Image shows entity directory]
Which of the following is a type of package in Java?
Inbuilt Packages [Image shows Inbuilt Packages]
User-Defined Packages [Image shows User-Defined Packages]
Public Packages [Image does not show Public Packages]
Private Packages [Image does not show Private Packages]
What is the name of the package that contains the MyClass class?
com [Image shows com folder]
foo [Image shows foo folder]
bar [Image shows bar folder]
com.foo.bar [Image shows MyClass class inside com.foo.bar folder]
What is the name of the package that contains the UserManager class?
com.zodizo [Image shows com.zodizo folder]
model [Image shows model folder inside com.zodizo folder]
UserManager [Image shows UserManager class inside model folder]
None of the above
What is the error message in the image?
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"]
The package info.sample.arm is not a valid Java package.
The package info.sample.arm is not imported in the project.
The class Arm is not defined in the package info.sample.arm.
What is the name of the package that contains the Arm class?
info.sample.arm [Image shows Arm class inside info.sample.arm package]
info.sample [Image shows info.sample folder, but Arm class is not inside info.sample folder]
sample [Image does not show Arm class inside sample folder]
None of the above
Which of the following classes is a subclass of the java.lang.Object class?
System [Image shows System class inside java package]
String [Image shows String class inside java.lang package]
. ArrayList [Image shows ArrayList class inside java.util package]
Button [Image shows Button class inside java.awt package]
Which package has the most methods?
javax.swing [Image shows javax.swing package with 1041 methods]
java.awt [Image shows java.awt package with 674 methods]
java.util [Image shows java.util package with 448 methods]
java.lang [Image shows java.lang package with 146 methods]
Which of the following classes is inside the util package?
Map [Image shows Map class inside util package]
System [Image shows System class inside java package]
import ArrayList [There is no such import statement]
No import statement is required
Which of the following import statements is required to access the ArrayList class?
import java.util.ArrayList [Image shows ArrayList class inside java.util package]
import java.util [Image does not show ArrayList class inside java.util package]
import ArrayList [There is no such import statement]
No import statement is required
Which of the following is the name of the project that is currently open in the Eclipse workspace window?
Selenium Project [Image shows Selenium Project in the workspace window]
Eclipse [Image does not show Eclipse project in the workspace window]
Java [Image does not show Java project in the workspace window]
None of the above
What is the name of the method that is currently being executed?
main [Image shows main method highlighted]
System.out.println [Image does not show System.out.println method highlighted]
getName [Image does not show getName method highlighted]
printName [Image does not show printName method highlighted]
What is the current working directory?
G:\EDUCATIONAL JAVA PACKAGE [Image shows current working directory as G:\EDUCATIONAL JAVA PACKAGE]
[Image does not show G:\ directory]
[Image does not show . directory]
None of the above
Which of the following is the name of the library that contains the CalcView.java class?
<default package> [Image shows <default package>]
controller [Image does not show CalcView.java class inside controller folder]
framework [Image does not show CalcView.java class inside framework folder]
view [Image shows CalcView.java class inside view folder]
Which of the following is the name of the class that is currently being edited?
JavaPackageApp [Image shows JavaPackageApp class highlighted]
System [Image does not show System class highlighted]
out [Image does not show out class highlighted]
print [Image does not show print class highlighted]
Which of the following is the name of the layer that is responsible for interacting with the user?
Presentation layer [Image shows Presentation layer]
Service layer [Image does not show Service layer]
Data Access layer [Image does not show Data Access layer]
None of the above
What is the name of the variable that is declared on line 1?
port [Image shows port variable declared on line 1]
tester [Image does not show tester variable declared on line 1]
default backg [Image does not show default backg variable declared on line 1]
import declaration [Image does not show import declaration on line 1]
What is the type of the variable name?
String [Image shows String type for name variable]
Integer [Image does not show Integer type for name variable]
Float [Image does not show Float type for name variable]
Boolean [Image does not show Boolean type for name variable]
Which of the following is the name of the class that is the parent class of the Employee class?
Person [Image shows Person class as the parent class of Employee class]
Object [Image does not show Object class as the parent class of Employee class]
Animal [Image does not show Animal class as the parent class of Employee class]
None of the above
What is the return type of the main method?
void [Image shows void as the return type of the main method]
String [Image does not show String as the return type of the main method]
. Integer [Image does not show Integer as the return type of the main method]
None of the above
Which of the following is the name of the package that contains the Scanner class?
Which of the following packages contains the HumanResources class?
com.tutorialspoint.demo.hr.model [Image shows HumanResources class inside com.tutorialspoint.demo.hr.model package]
com.tutorialspoint.demo [Image does not show HumanResources class inside com.tutorialspoint.demo package]
com.tutorialspoint [Image does not show HumanResources class inside com.tutorialspoint package]
None of the above
Which of the following is the name of the method that is currently being called?
main [Image shows main method highlighted]
System.out.println [Image does not show System.out.println method highlighted]
getName [Image does not show getName method highlighted]
printName [Image does not show printName method highlighted]
Which of the following is the name of the variable that is assigned the value "Hello, world!"?
name [Image does not show name variable assigned the value "Hello, world!"]
message [Image shows message variable assigned the value "Hello, world!"]
greeting [Image does not show greeting variable assigned the value "Hello, world!"]
world [Image does not show world variable assigned the value "Hello, world!"]
Which of the following annotations is used to mark a class as deprecated?
@Deprecated [Image shows @Deprecated annotation]
@AnyMetaDef [Image does not show @AnyMetaDef annotation]
@AnyMetaDate [Image does not show @AnyMetaDate annotation]
None of the above
Which of the following packages contains the InstructionQueue class?
Instructions [Image shows Instructions folder containing InstructionQueue.java class]
Queues [Image does not show Queues folder containing InstructionQueue.java class]
Messages [Image does not show Messages folder containing InstructionQueue.java class]
None of the above
Which of the following packages contains the Arm.java class?
com.example.javapackagestructure.arm [Image shows Arm.java class inside com.example.javapackagestructure.arm folder]
com.example.javapackagestructure.components [Image does not show Arm.java class inside com.example.javapackagestructure.components folder]
com.example.javapackagestructure.models [Image does not show Arm.java class inside com.example.javapackagestructure.models folder]
None of the above
Which of the following is the correct package structure for the HomeLoan class?
com.example.javapackagestructure.homeloan [Image shows com.example.javapackagestructure.homeloan package]
com.example.javapackagestructure.homeloans [Image does not show com.example.javapackagestructure.homeloans package]
com.example.javapackagestructure.loans.homeloan [Image does not show com.example.javapackagestructure.loans.homeloan package]
com.example.javapackagestructure.homeloan.loans [Image does not show com.example.javapackagestructure.homeloan.loans package]
What is the error message in the image?
The method main is not declared static. [Image shows error message "The method main must be declared static.". ]
The class Soulie is not public. [Image does not show error message about class Soulie.]
The variable name is not initialized. [Image does not show error message about variable name.]
The method printName is not declared. [Image does not show error message about method printName.]
Which of the following is the name of the test case that is associated with the Module 2 automation?
Test Case 1 [Image shows Test Case 1 associated with Module 2 automation]
Test Case 2 [Image does not show Test Case 2 associated with Module 2 automation]
Test Case 3 [Image does not show Test Case 3 associated with Module 2 automation]
Test Case 4 [Image does not show Test Case 4 associated with Module 2 automation]
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)?
AccessController [Image shows AccessController class]
CodeSource [Image does not show CodeSource class]
Permission [Image does not show Permission class]
ProtectionDomain [Image does not show ProtectionDomain class]
What is the name of the variable that is assigned the value 100?
x [Image shows variable x assigned the value 100.]
y [Image does not show variable y assigned the value 100.]
z [Image does not show variable z assigned the value 100.]
a [Image does not show variable a assigned the value 100.]
Which of the following packages contains the AbstractclassandInterface class?
com.example.javapackagestructure.abstractclassandinterface [Image shows AbstractclassandInterface class inside com.example.javapackagestructure.abstractclassandinterface folder.]
com.example.javapackagestructure.components [Image does not show AbstractclassandInterface class inside com.example.javapackagestructure.components folder.]
com.example.javapackagestructure.models [Image does not show AbstractclassandInterface class inside com.example.javapackagestructure.models folder.]
None of the above
What is the name of the package that contains the Containment class?
com.example.javapackagestructure.containment [Image shows Containment class inside com.example.javapackagestructure.containment folder.]
com.example.javapackagestructure.components [Image does not show Containment class inside com.example.javapackagestructure.components folder.]
com.example.javapackagestructure.models [Image does not show Containment class inside com.example.javapackagestructure.models folder.]
None of the above
Which of the following packages contains the Employee class?
com.example.javapackagestructure.employee [Image shows Employee class inside com.example.javapackagestructure.employee folder.]
com.example.javapackagestructure.components [Image does not show Employee class inside com.example.javapackagestructure.components folder.]
com.example.javapackagestructure.models [Image does not show Employee class inside com.example.javapackagestructure.models folder.]
None of the above
Which of the following is a primitive type in Java?
String [Image shows String class, which is a reference type.]
Integer [Image shows Integer class, which is a primitive type.]
Float [Image shows Float class, which is a primitive type.]
Object [Image does not show Object class, which is a reference type.]
Which of the following packages contains the NewJavaPackage class?
com.example.javapackagestructure.newjavapackage [Image shows NewJavaPackage class inside com.example.javapackagestructure.newjavapackage folder.]
com.example.javapackagestructure.components [Image does not show NewJavaPackage class inside com.example.javapackagestructure.components folder.]
com.example.javapackagestructure.models [Image does not show NewJavaPackage class inside com.example.javapackagestructure.models folder.]
None of the above
Which of the following packages contains the HelloMoon.java file?
com.example.javapackagestructure.hellomoon [Image shows HelloMoon.java file inside com.example.javapackagestructure.hellomoon folder.]
com.example.javapackagestructure.components [Image does not show HelloMoon.java file inside com.example.javapackagestructure.components folder.]
com.example.javapackagestructure.models [Image does not show HelloMoon.java file inside com.example.javapackagestructure.models folder.]
None of the above
What is the name of the variable that is assigned the value "Hello, world!"?
name [Image does not show variable name assigned the value "Hello, world!"]
message [Image shows variable message assigned the value "Hello, world!"]
greeting [Image does not show variable greeting assigned the value "Hello, world!"]
world [Image does not show variable world assigned the value "Hello, world!"]
Which of the following is the correct package structure for the Car class?
com.example.javapackagestructure.cars [Image shows com.example.javapackagestructure.cars package]
com.example.javapackagestructure.car [Image does not show com.example.javapackagestructure.car package]
com.example.javapackagestructure.models.cars [Image does not show com.example.javapackagestructure.models.cars package]
None of the above
Which of the following libraries is used for 2D rendering in Java?
JavaFX [Image shows JavaFX library]
Swing [Image does not show Swing library]
AWT [Image does not show AWT library]
None of the above
