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. int char binary float 2. What is the default value of the integer stored in Array. null empty space “” 0 3. Select the option which is not a JAVA keyword. args void static main 4. Identify the appropriate datatype for 3.5 float double int byte 5. Select the correct option about the variables names. Group of Characters Alphanumeric and beginning letter starts with a character Single Character All of the above 6. IS JAVA Case Sensitive?? true false 7. What is the command useful to compile the java program HelloWorld.java? java HelloWorld javac HelloWorld javac HelloWorld.java javap HelloWorld.java 8. Java code can be executed in the following platforms Windows MAC Linux All of the above 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; 2 200 0 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 14 10 15 12. What is the size of the Arrays int a[]={1,2,3,4,5,6}; 6 5 13. How to calculate the length of the Array? int arr[]={1,2,3,4,5,6}; arr.size() arr.length() arr.length arr.size 14. What is the definition of Array?? An array is used to store values of different data types An array is used to store same values of different data types An array is used to store values of similar data types An array is used to store different values of different datatypes 15. How to declare a two dimensional array in java? int arr[][]=new int[][]; int arr[5][5]=new int[5][5]; int arr[][]=new int[5][5]; int arr[ ]=new int[5,5]; 16. JDK stands for ?? Java Development knowledge Java Database kit Java Development kernel Java Development kit 17. What is the command useful to execute/run the java program HelloWorld.java ? java HelloWorld javac HelloWorld javac HelloWorld.java java HelloWorld.java 18. What is the output of the below program?? class Addition { public static void main(String args[]) { System.out.println(20+30); } } 20 30 3020 50 2030 19. Real-world objects contain ____________ and _________ state and behavior public and private static and non-static All the above 20. The term API stands for _____________ Automated processing interface Application programming interface Application processing interface Analytical processing interface 21. How many primitive datatypes in java?? 10 9 7 8 22. Which operator is used to compare two values = == != === 23. How do you write a infinite loop? while (true) { } while (false) { } while (i>0) { } while (i<0) { } 24. IDE stands for: Integration development environment Integrated development environment Integral database environment Indetailed development environment. 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} Line number 5 Line number 6 Line number 3 Line number 4 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; } x y & z x & y & z x & y 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; } y & z x & z x & y x & y & z 28. Which of the following is not a valid comment? /** comment */ // comment /* comment */ /* comment 29. What is the correct signature of the main method? public static void main(String args[]) public static void main(String args()) public void main(String args[]) public static main(string args[]) 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? second string third string second string third string first string second string third string Loading ...
Srikanth Kannan February 27, 2018 at 1:00 pm this java quiz was great, expecting more like this Reply ↓
TOTAL-QA Post authorFebruary 27, 2018 at 7:32 pm Sure. Will upload few more questions and update you. Reply ↓
Juli February 28, 2018 at 9:24 pm I loved it. Expecting more to come including array questions 🙂 Reply ↓
TOTAL-QA Post authorFebruary 28, 2018 at 9:37 pm Sure.. You can try attempting this as well. http://total-qa.com/java-oops-quiz/ Reply ↓
Lakshmi March 1, 2018 at 7:41 am 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 ↓
TOTAL-QA Post authorMarch 2, 2018 at 7:48 pm Thanks for giving your valuable feedback. We will look into the issue. Reply ↓
this java quiz was great, expecting more like this
Sure. Will upload few more questions and update you.
I loved it. Expecting more to come including array questions 🙂
Sure.. You can try attempting this as well. http://total-qa.com/java-oops-quiz/
Website is very helpful. Thanks
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
Thanks for giving your valuable feedback. We will look into the issue.
This java quiz was great, expecting more
not able to access java quiz
check now
still not able to access java quiz
Thanks for giving this challenge !!
Thanks !!
Thanks