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. In the following code snippet, which lines of code contain error?

int j=0;
while (j < 10)
{
	j++;
	if (j==5) continue loop;
	system.out.ptintln("j is " +j);
}

Line 2
Line 3
Line 4
Line 5

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

4. What will be the output of the program?

  
class mainclass {
    public static void main(String args[])
    {
      boolean var1 = true;
      boolean var2 = false;
      if (var1)
         System.out.println(var1);
      else
         System.out.println(var2);
    } 
}

0
1
TRUE
FALSE

5. Select from among the following character escape code which is not available in Java.

\\
\v
\a
\t

6. A __________ statement allows us to execute a statement or group of statements multiple times.

array
loop
function
exception

7. Which data type value is returned by all transcendental math functions?

int
float
double
long

8. The String class is?

mutable
immutable
Both A and B
None of the above

9. Which statement is true?

public void test(int x)
{
	int odd = 1;
	if(odd) /* Line 4 */
	{
		System.out.println("odd");
	}
	else
	{
		System.out.println("even");
	}
}

Compilation fails.
"odd" will always be output.
"even" will always be output.
"odd" will be output for odd values of x, and "even" for even values.

10. Deadlock is a situation when thread is waiting for other thread to release acquired object.

TRUE
FALSE
Can be true or false
can not say

Results