Java Programming Quiz


Play this Java quiz that will help you to excel in Java certification exams, placements etc. This Java programming quiz consist of 10 questions that you need to solve in 10 minutes. We’ve specially designed this quiz so that you can quickly acquaint to the pattern of questions you can be asked in placement drives, certification exams etc. This Java programming test enables you to assess your knowledge of Java programming.

Take the Free Practice Test



Java MCQs

Practice Java MCQ Questions, which will help you to understand Java programming related concepts and also helps you to prepare for placements, technical rounds, interviews, competitive exams etc.

Java Quiz

Try Free Java Quiz, to start a quiz you need to login first, after login you will get start quiz button and then by clicking on that you can start quiz. You will get 10 Minutes to answer all questions.

Java Quiz

1. Which of these is correct way of inheriting class A by class B?

class B + class A {}
class B inherits class A {}
class B extends A {}
class B extends class A {}

2. Predict the output of the following program.

class LFC {
    public static void main(String[] args)
    {
        Double object = new Double("2.4");
        int a = object.intValue();
        byte b = object.byteValue();
        float d = object.floatValue();
        double c = object.doubleValue();
        System.out.println(a + b + c + d );
 
    }
}

8
8.8
8.800000095
8

3. What will be the output of the program?

  
class Main {  
   public static void main(String args[]) {    
         int t; 
         System.out.println(t);
    } 
}

0
garbage value
compiler error
runtime error

4. Which of these is a super class of all errors and exceptions in the Java language?

Catchable
Throwable
RunTimeExceptions
None of the above

5. Which class is used to load the JDBC driver?

java.sql.Connection
java.sql.ResultSet
java.sql.Statement
java.sql.DriverManager

6. Which of the following will directly stop the execution of a Thread?

notify()
notifyall()
wait()
exits synchronized code

7. Which two are acceptable types for x?

switch(x)
{
	default:
		System.out.println("Hello");
}

short
char
long
float

8. How to run java program in command prompt?

javac filename.java
java filename.java
javac filename
java filename

9. What is the output of this program?

  
class array_output {
   public static void main(String args[])
     {
       char array_variable [] = new char[10];
       for (int i = 0; i < 10; ++i) {
            array_variable[i] = 'i';
            System.out.print(array_variable[i] + """" );
            i++;
       }
    } 
}
		   

i i i i i
0 1 2 3 4
i j k l m
None of the mentioned

10. Can "abstract" keyword be used with constructor, Initialization Block, Instance Initialization and Static Initialization Block.

TRUE
FALSE
Can be true or false
can not say

Results