Java Quiz: Test Your GK! Trivia

Reviewed by Editorial Team
The ProProfs editorial team is comprised of experienced subject matter experts. They've collectively created over 10,000 quizzes and lessons, serving over 100 million users. Our team includes in-house content moderators and subject matter experts, as well as a global network of rigorously trained contributors. All adhere to our comprehensive editorial guidelines, ensuring the delivery of high-quality content.
Learn about Our Editorial Process
| By TeacheMeIDEA
T
TeacheMeIDEA
Community Contributor
Quizzes Created: 6 | Total Attempts: 16,455
| Attempts: 1,007 | Questions: 10
Please wait...
Question 1 / 10
0 %
0/100
Score 0/100
1. Is it necessary that each try block must be followed by a final block?

Explanation

It is not necessary for each try block to be followed by a final block. A final block, also known as a finally block, is used to define a section of code that will always be executed, regardless of whether an exception is thrown or not. While it is a good practice to include a final block to handle any necessary cleanup operations, it is not mandatory. In some cases, the try block may be followed by catch blocks to handle specific exceptions, without the need for a final block.

Submit
Please wait...
About This Quiz
Java Quiz: Test Your GK! Trivia - Quiz

This Java Quiz tests general knowledge in Java programming, covering topics like data types, access modifiers, OOP concepts, and applets. It assesses key skills for understanding Java's fundamental... see moreprinciples and its application in web browsers, suitable for learners aiming to enhance their programming skills. see less

2. Which of the following is true about public access modifier?

Explanation

The public access modifier allows variables, methods, and constructors to be accessed by any class, regardless of whether they are in the same package or not. This means that any class, regardless of its location, can access and use the public members of a class. Therefore, the correct answer is that variables, methods, and constructors declared as public can be accessed by any class.

Submit
3. What is an applet?

Explanation

An applet is a Java program that runs in a Web browser. This means that it is a small application written in the Java programming language that can be embedded within a web page and executed within a web browser. Applets are often used to provide interactive and dynamic content on websites, such as animations, games, or interactive forms. They have access to the browser's capabilities and can interact with the web page's HTML content. Applets are different from standalone Java programs, which are executed outside of a web browser.

Submit
4. What is NullPointerException?

Explanation

A NullPointerException is thrown when calling the instance method of a null object or modifying/accessing field of a null object. This means that if we try to perform any action on an object that is null (has no value assigned to it), such as calling a method or accessing a field, a NullPointerException will be thrown. This is because null objects do not have any methods or fields associated with them, so attempting to access them will result in an error.

Submit
5. What is the default value of the String variable?

Explanation

The default value of a String variable is null. This means that if a String variable is not assigned a value, it will automatically have a null value.

Submit
6. What is Abstraction?

Explanation

Abstraction in object-oriented programming (OOP) refers to the ability to make a class abstract. An abstract class is a class that cannot be instantiated and is meant to be subclassed. It provides a common interface for all the subclasses, but each subclass can have its own implementation. This allows for the concept of abstraction, where the essential details and behaviors of an object are captured in an abstract class, while the specific implementation details are left to the subclasses.

Submit
7. What of the following is the default value of an instance variable?

Explanation

The default value of an instance variable depends upon the type of variable. In Java, the default value for numeric types (such as int, float, double) is 0, for boolean it is false, and for reference types (such as String) it is null. Therefore, the correct answer is "Depends upon the type of variable."

Submit
8. What is the size of the float variable?

Explanation

The size of the float variable is 32 bits.

Submit
9. Which of the following is a marker interface?

Explanation

A marker interface is an interface that does not contain any methods but is used to mark or tag a class. In this case, the correct answer is "serializable" because it is a marker interface in Java that indicates that a class can be serialized, meaning its objects can be converted into a byte stream for storage or transmission.

Submit
10. What happens when the thread's yield() method is called?

Explanation

When the thread's yield() method is called, it temporarily pauses its execution and allows other threads of the same priority to run. It does not go back to the waiting state because it is not waiting for any specific condition or resource. Instead, it goes back to the ready state, where it is eligible to run again when the scheduler chooses it. This allows for fair scheduling and prevents a single thread from monopolizing the CPU.

Submit
View My Results

Quiz Review Timeline (Updated): Mar 22, 2023 +

Our quizzes are rigorously reviewed, monitored and continuously updated by our expert board to maintain accuracy, relevance, and timeliness.

  • Current Version
  • Mar 22, 2023
    Quiz Edited by
    ProProfs Editorial Team
  • Dec 09, 2018
    Quiz Created by
    TeacheMeIDEA
Cancel
  • All
    All (10)
  • Unanswered
    Unanswered ()
  • Answered
    Answered ()
Is it necessary that each try block must be followed by a final block?
Which of the following is true about public access modifier?
What is an applet?
What is NullPointerException?
What is the default value of the String variable?
What is Abstraction?
What of the following is the default value of an instance variable?
What is the size of the float variable?
Which of the following is a marker interface?
What happens when the thread's yield() method is called?
Alert!

Advertisement