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. The class which inherits the properties of other is known as ________

superclass
parent class
subclass
None of the above

2. What will be the output of the program?

class Main {
   public static void main(String [] args)
	{
	 Main p = new Main();
	 p.start();
	}
	void start()
	{
 	 String s1 = "s";
	 String s2 = fix(s1);
	 System.out.println(s1 + " " + s2);
	}
	String fix(String s1)
	{
	 s1 = s1 + "st";
	 System.out.print(s1 + " ");
	 return "st";
	}
}

s st
sst st
st s st
sst s st

3. What type of methods an interface contain by default?

abstract
static
final
private

4. 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

5. Which of the following packages is used to includes utility classes like Calendar, Collection, Date?

java.lang
java.net
java.awt
java.util

6. In Java programming language, strings are treated as objects.

TRUE
FALSE
Can be true or false
Can not say

7. What happens when we access the same variable defined in two interfaces implemented by the same class?

Compilation failure
Runtime Exception
The JVM is not able to identify the correct variable
The interfaceName.variableName needs to be defined

8. What is the type of variable "b" and "d" in the below snippet?

int a[], b;
int []c, d;

"b" and "d" are int
"b" and "d" are arrays of type int
"d" is int variable; and "b" is int array
"b" is int variable; and "d" is int array

9. A method which is declared as abstract and does not have implementation is known as an _____________?

Abstract Interface
Abstract Thread
Abstract List
abstract Method

10. Which of these keywords is used to define interfaces in Java?

interface
Interface
intf
Intf

Results