Java Online Quiz-Test your knowledge Java Basics

TEST YOUR KNOWLEDGE IN JAVA BY ANSWERING 30 QUESTIONS.
DONT SKIP ANY QUESTIONS, TRY TO ATTEMTP ALL OF THEM

Please enter your email:

1. Select the option which is not a Java Datatype.

 
 
 
 

2. What is the default value of the integer stored in Array.

 
 
 
 

3. Select the option which is not a JAVA keyword.

 
 
 
 

4. Identify the appropriate datatype for 3.5

 
 
 
 

5. Select the correct option about the variables names.

 
 
 
 

6. IS JAVA Case Sensitive??

 
 

7. What is the command useful to compile the java program HelloWorld.java?

 
 
 
 

8. Java code can be executed in the following platforms

 
 
 
 

9. Select the option which is not a logical operator in Java

 
 
 

10. What is the output of a%b

int a =20;
int b =10;

 
 
 
 

11. What is the output of the java program ?

public class ArraysEx
{
public static void main(String[] args)
{
int arr[]={2,4,5,6,9};
System.out.println(arr[2]+arr[4]);

}

}

 
 
 
 

12. What is the size of the Arrays int a[]={1,2,3,4,5,6};

 
 

13. How to calculate the length of the Array?
int arr[]={1,2,3,4,5,6};

 
 
 
 

14. What is the definition of Array??

 
 
 
 

15. How to declare a two dimensional array in java?

 
 
 
 

16. JDK stands for ??

 
 
 
 

17. What is the command useful to execute/run the java program HelloWorld.java ?

 
 
 
 

18. What is the output of the below program??

class Addition
{
public static void main(String args[])
{

System.out.println(20+30);
}
}

 
 
 
 

19. Real-world objects contain ____________ and _________

 
 
 
 

20. The term API stands for _____________

 
 
 
 

21. How many primitive datatypes in java??

 
 
 
 

22. Which operator is used to compare two values

 
 
 
 

23. How do you write a infinite loop?

 
 
 
 

24. IDE stands for:

 
 
 
 

25. Identify the line number which has error code mentioned below in the program??
1 public class SomethingIsWrong {
2 public static void main(String[] args) {
3 Rectangle myRect;
4 myRect.width = 40;
5 myRect.height = 50;
6 System.out.println("myRect's area is " + myRect.area());
7 }
8}

 
 
 
 

26. Consider the following class. what are instance variables??

public class IdentifyMyParts {
public static int x = 7;
public int y = 3;
public int z = 10;
}

 
 
 
 

27. Consider the following class. what are class variables??

public class IdentifyMyParts {
public static int x = 7;
public static int y = 3;
public int z = 10;

}

 
 
 
 

28. Which of the following is not a valid comment?

 
 
 
 

29. What is the correct signature of the main method?

 
 
 
 

30. Consider the following code snippet.
if (aNumber >= 0)
if (aNumber == 0)
System.out.println("first string");
else
System.out.println("second string");
System.out.println("third string");

Exercise: What output do you think the code will produce if aNumber is 3?

 
 
 
 


14 comments on “Java Online Quiz-Test your knowledge Java Basics

  1. Lakshmi

    Thanks for giving this opportunity.Its giving me confidence. Scoring comes like “you scored 9 points out of 9 points total”, even if 10 questions correct also

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *