TOTAL QS = 25Time [ 00 : 00 : 00 ]
00:00:00

Java Package Rules Basics Online Practice Test 1

Instructions

Total Questions: 25

Total Minutes: 25

This ExamTray Free Online Test or Quiz or Trivia tests your Programming Skills on the basics of Java Package Rules. This practice test displays answers after finishing the exam for review. You can easily clear Competitive Exams and Job Interview Questions. Students can learn Java basics.

Go through Java Theory Notes on Packages Rules before attempting this test.

All the Best

Challenge SCORE

0 / 25

Take This Exam
1) What is a package in Java?
2) Choose the correct syntax of a Java Package below.
3) The keyword used to declare a Java package is ____.
4) What is the maximum number of Java Class files that can be kept inside a single Java Package?
5) Can you compile a Java file kept inside a directory without mentioning the package name?
folder_1
     ----- SomeFile.java
.
.
//SomeFile.java
//no package declaration
//package folder_1; commented
public class SomeFile
{

}
6) The name of a package is the name of the ___ in Java.
7) It is possible to declare a package and import another package within the same Java class file. State TRUE or FALSE.
8) The keyword used to import a package into Java class or Interface is ___.
9) Which is the correct syntax to import a Java package below?
10) Choose correct declaration and importing of packages in Java.
11) You can use the same name for a Parent package and Child package in Java. State TRUE or FALSE.
12) What is the maximum number of levels or depth up to which sub-packages can be defined in Java?
13) Choose a correct statement below about importing packages into a class.
14) When importing a Package, the Class is actually importing ____.
15) The package declaration statement should be the first statement in a Java file. State TRUE or FALSE.
16) You can place a comment before the Package Declaration statement in Java. State TRUE or FALSE.
17) How does JAVAC or JAVA (JVM) find the packages that will be used inside classes by an import statement?
18) Which is the default Java package that will be auto included (imported) in the classpath while Compiling and Running a Java program?
19) What are the popular Classes or Interfaces inside a Java Language Pack (java.lang)?
20) Choose a correct way of importing all the classes in the below java program with packages.
//Cat.java
package animals;
public class Cat { }

//Dog.java
package animals;
public class Dog { }

//PackageTesting.java
//import statements
public class
{
  //new Cat();
  //new Dog();
}
21) Which is the symbol used to separate a super-package and a sub-package at the time of declaring or importing in a Java program?
22) Choose a correct statement about using the classes or interfaces or abstract classes inside the packages in our Java program.
23) Accessing the variables, constants, or methods of a class, imported from a package is subjective to access modifiers like PUBLIC, PRIVATE, PROTECTED and default. State TRUE or FALSE.
24) What are the uses of a Java Package?
25) What is the output of the below Java program with packages?
//MathClas.java
package package1;
public class MathClass
{
  public static int getRandom()
  {
    //returns a random number from 0 to 999
    return ((int) (Math.random() * 1000)); 
  }
}

//PackageTest3.java
import package1.*;
public class PackageTest3
{
  public static void main(String[] args)
  {
    System.out.print(MathClass.getRandom());
  }
}

 

 

Show some care. Like or Subscribe.

C MCQ App by ExamTray (Give us 5*)

EXAMTRAY C MCQ android app link

Java MCQ App by ExamTray (Give us 5*)

EXAMTRAY Java MCQ android app link
ALL MCQ App by ExamTray (Give us 5*) EXAMTRAY android app link
WUnsaved Whatsapp msg to Unknown(Give us 5*) WUnsaved android app link
Virtual Tape GPS (Give us 5*) Virtual Tape GPS android app link