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

2. Which of these statements is incorrect?

By multithreading CPU idle time is minimized, and we can take maximum use of it
By multitasking CPU idle time is minimized, and we can take maximum use of it
Two thread in Java can have the same priority
A thread can exist only in two states, running and blocked

3. What will be output for the following code?

  
class Test {
	public static void main(String args[]) {
		int arr[] = new int[2];
		System.out.println(arr[0]);
		System.out.println(arr[1]);
	}
}

0 0
garbage value garbage value
Compiler Error
Exception

4. What should be expression1 evaluate to in using ternary operator as in this line?

  
 expression1 ?   expression2  :  expression3

Integer
Floating - point numbers
Boolean
None of the mentioned

5. Short data type has a minimum value of _____________.

-32768
-32767
32768
32767

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

Catchable
Throwable
RunTimeExceptions
None of the above

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

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

9. An enhanced FOR loop work with only Collection type data. Examples of Collection are ___.

Array Class type or any regular array variable
ArrayList
HashMap, HashSet
All of the above

10. ___________ is a very small Java framework that makes it trivial to parse command line parameters.

Command Line
Jcommander
Args
None of the above

Results