Author name: admin

Which exception is thrown when Java is out of memory?

Java MCQ: Which exception is thrown when Java is out of memory? a) MemoryError b) OutOfMemoryError c) NullPointerException d) IOException Answer: b) OutOfMemoryError Explanation: When the Java Virtual Machine (JVM) runs out of memory, it throws an OutOfMemoryError. This error indicates that the JVM cannot allocate an object because it is out of memory and

Which exception is thrown when Java is out of memory? Read More »

What is the extension of compiled Java classes?

Java MCQ: What is the extension of compiled Java classes? a) .js b) .class c) .java d) .exe Answer: b) .class Explanation: Compiled Java classes are stored in files with the .class extension. These files contain bytecode, which can be executed by the Java Virtual Machine (JVM). Reference links: https://www.rameshfadatare.com/learn-java-programming/ https://www.javaguides.net/p/java-tutorial-learn-java-programming.html

What is the extension of compiled Java classes? Read More »

Which of the following is not an OOPS concept in Java?

Java MCQ: Which of the following is not an OOPS concept in Java? a) Inheritance b) Encapsulation c) Polymorphism d) Compilation Answer: d) Compilation Explanation: Compilation is not an object-oriented programming (OOP) concept. The main OOP concepts in Java are Inheritance, Encapsulation, Polymorphism, and Abstraction. Reference links: https://www.rameshfadatare.com/learn-java-programming/ https://www.javaguides.net/p/java-tutorial-learn-java-programming.html

Which of the following is not an OOPS concept in Java? Read More »

What is the extension of Java code files?

Java MCQ: What is the extension of Java code files? a) .js b) .txt c) .class d) .java Answer: d) .java Explanation: Java source code files have the extension .java. These files are compiled by the Java compiler into bytecode files with the extension .class. Reference links: https://www.rameshfadatare.com/learn-java-programming/ https://www.javaguides.net/p/java-tutorial-learn-java-programming.html

What is the extension of Java code files? Read More »

Which of these cannot be used for a variable name in Java?

Java MCQ: Which of these cannot be used for a variable name in Java? a) identifier b) keyword c) variable d) method Answer: b) keyword Explanation: In Java, keywords cannot be used as variable names because they have predefined meanings in the language. Examples of keywords include int, class, public, and void. Reference links: https://www.rameshfadatare.com/learn-java-programming/

Which of these cannot be used for a variable name in Java? Read More »

Which component is used to compile, debug and execute Java programs?

Java MCQ: Which component is used to compile, debug and execute Java programs? a) JDK b) JRE c) JVM d) IDE Answer: a) JDK Explanation: The Java Development Kit (JDK) is the software development environment used to compile, debug, and execute Java programs. It includes the Java compiler, libraries, and tools necessary for Java development.

Which component is used to compile, debug and execute Java programs? Read More »

Identify the interface which is used to declare core methods in Java?

Java MCQ: Identify the interface which is used to declare core methods in Java? a) java.lang.Object b) java.util.List c) java.lang.Runnable d) java.lang.Comparable Answer: d) java.lang.Comparable Explanation: The Comparable interface in Java is used to declare core methods for comparing objects. It defines the compareTo() method, which allows objects to be ordered. This interface is essential

Identify the interface which is used to declare core methods in Java? Read More »

Which of the following exception is thrown when a divide by zero statement is executed?

Java MCQ: Which of the following exception is thrown when a divide by zero statement is executed? a) ArithmeticException b) NullPointerException c) IOException d) ClassNotFoundException Answer: a) ArithmeticException Explanation: In Java, ArithmeticException is thrown when an exceptional arithmetic condition occurs, such as dividing by zero. This is a common runtime exception that does not require

Which of the following exception is thrown when a divide by zero statement is executed? Read More »

What is Runnable?

Java MCQ: What is Runnable? a) An interface b) A class c) A method d) A package Answer: a) An interface Explanation: The Runnable interface in Java is used to define a task that can be executed by a thread. It has a single method, run(), that must be implemented by any class that implements

What is Runnable? Read More »

What is the variables declared in a class for the use of all methods of the class called?

Java MCQ: What is the variables declared in a class for the use of all methods of the class called? a) Instance variables b) Local variables c) Static variables d) Global variables Answer: a) Instance variables Explanation: Instance variables are declared within a class but outside of any method. They are used by all methods

What is the variables declared in a class for the use of all methods of the class called? Read More »

Scroll to Top