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. At time of array initialization which is necessary to specify?

Row
Column
Row and Column
None of the above

2. What will be the output of the program?

  
class area {
        public static void main(String args[]) 
        {   
             double r, pi, a;
             r = 9.8;
             pi = 3.14;
             a = pi * r * r;
             System.out.println(a);
        } 
}
	

301.5656
301
301.56
301.57

3. Which of the following are legal lines of Java code?
1. int w = (int)888.8;
2. byte x = (byte)100L;
3. long y = (byte)100;
4. byte z = (byte)100L;

1 and 2
2 and 3
3 and 4
All statements are correct

4. Which of these can be returned by the operator &?

Integer
Boolean
Character
Integer or Boolean

5. Which kind of language java is ?

Object Oriented
Procedural
Event Driven
None of these

6. Java is a ________ programming language

high-level
Middle-level
Low-level
None of the above

7. Number of arguments can be passed to main() is?

1
2
3
Infinite

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. What is the output of this program?

interface calculate
{
   void cal(int item);
}
class display implements calculate
{
	int x;
	public void cal(int item)
	{
		x = item * item;
	}
}
class Main
{
   public static void main(String args[])
   {
    display arr = new display();
    arr.x = 0;
    arr.cal(2);
    System.out.print(arr.x);
   }
}

0
2
4
None of the mentioned

10. What will be output for the following code?

 import java.awt.*;
    import java.applet.*;
    public class myapplet extends Applet
    {
        public void paint(Graphics g)
        {
            g.drawString(""A Simple Applet"", 20, 20);    
        }
    }

A Simple Applet
A Simple Applet 20 20
Compilation Error
Runtime Error

Results