
Packages + java-visual
Quiz
•
Education
•
Professional Development
•
Practice Problem
•
Hard
ANIL KUMAR
FREE Resource
Enhance your content in a minute
84 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
20 sec • 1 pt
Which of the following classes is part of the java.awt package?
System
String
ArrayList
Button
Answer explanation
The correct answer is Button. The java.awt package contains classes that are used to create graphical user interfaces (GUIs). The Button class is a subclass of the Component class, and it is used to create buttons in a GUI. The other classes in the image are not part of the java.awt package.
2.
MULTIPLE CHOICE QUESTION
20 sec • 1 pt
Which of the following packages is the default package in the image?
default package
Hellojava
rest
SpringJSONRest Test
Answer explanation
The correct answer is default package. The default package is the package that is used when you do not specify a package name for your Java class. In the image, the RestletServer.java and RestletClient.java files do not have a package name specified, so they are part of the default package. The Hellojava and rest packages are both explicitly specified in the image, and the SpringJSONRest Test package is not a real package.
3.
MULTIPLE CHOICE QUESTION
20 sec • 1 pt
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.
Answer explanation
The correct answer is Packages are a required part of the Java language. Packages are not a required part of the Java language. You can write Java programs without using packages, but you will not be able to take advantage of the benefits of packages, such as organization, access control, and name clashes.
4.
MULTIPLE CHOICE QUESTION
20 sec • 1 pt
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()
Answer explanation
The correct answer is package personpackage;. The package statement is used to indicate to the compiler which package a Java class belongs to. In the image, the package personpackage; statement is on the first line of the Person.java file, which indicates that the Person class belongs to the personpackage package.
5.
MULTIPLE CHOICE QUESTION
20 sec • 1 pt
Which of the following classes is part of the java.lang package?
System
String
ArrayList
Button
Answer explanation
The correct answer is System. The java.lang package is the default package in Java, and it contains classes that are fundamental to the language, such as System and String. The other classes in the image are part of the util and awt packages.
6.
MULTIPLE CHOICE QUESTION
20 sec • 1 pt
Which of the following is the most common type of built-in package in Java?
Answer explanation
The correct answer is java.lang. The java.lang package is the default package in Java, and it contains classes that are fundamental to the language, such as System, String, and Object. The other packages in the image are all useful, but they are not as fundamental as the java.lang package.
7.
MULTIPLE CHOICE QUESTION
20 sec • 1 pt
Which of the following packages is not a sub-package of java.util?
concurrent
logging
collections
concurrency.concurrent
Answer explanation
The correct answer is concurrency.concurrent. The concurrency package is a sub-package of the java.util package, but the concurrency.concurrent package is not. The concurrency.concurrent package is a nested package, which is a special type of sub-package that is created by putting a period between the names of the packages.
Create a free account and access millions of resources
Create resources
Host any resource
Get auto-graded reports

Continue with Google

Continue with Email

Continue with Classlink

Continue with Clever
or continue with

Microsoft
%20(1).png)
Apple
Others
Already have an account?
Similar Resources on Wayground
Popular Resources on Wayground
10 questions
Honoring the Significance of Veterans Day
Interactive video
•
6th - 10th Grade
9 questions
FOREST Community of Caring
Lesson
•
1st - 5th Grade
10 questions
Exploring Veterans Day: Facts and Celebrations for Kids
Interactive video
•
6th - 10th Grade
19 questions
Veterans Day
Quiz
•
5th Grade
14 questions
General Technology Use Quiz
Quiz
•
8th Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
15 questions
Circuits, Light Energy, and Forces
Quiz
•
5th Grade
19 questions
Thanksgiving Trivia
Quiz
•
6th Grade
