Smart Future Point

Java MCQ Quiz

1. What is the default value of an int variable in Java?



2. Which of the following is not a primitive data type in Java?



3. What is the size of a char in Java?



4. Which keyword is used to define a constant variable in Java?



5. Which operator is used for concatenating strings in Java?



6. What will be the output of System.out.println(10 / 3);?



7. Which of the following is used to take input in Java?



8. How do you declare an array in Java?


9. What is the correct syntax to create an object in Java?


10. What is the purpose of the this keyword in Java?


11. What does the break statement do in a loop?


12. Which method is called when an object is created in Java?


13. Which of the following is a valid for loop in Java?


14. What is the superclass of all classes in Java?


15. How do you handle exceptions in Java?


16. What is the output of 5 + "Java" in Java?


17. Which keyword is used to inherit a class in Java?


18. What will be the output of System.out.println(2 == 2.0);?


19. What will be the output of the following Java statement?
System.out.println(10 / 4);


20. What is the default value of a boolean variable in Java?


21. What is the purpose of the "final" keyword in Java?


22. What does the "super" keyword do in Java?


23. What is the default value of an instance variable in Java?


24. Which of the following is not a valid access modifier in Java?


25. What is the output of the following code snippet?
int x = 5;
System.out.println(x++);


26. What is the main difference between a method and a constructor in Java?


27. What is the purpose of the "this" keyword in Java?


28. Which of the following is not a valid Java data type?


29. How do you create a thread in Java?


30. What is the default value of a reference variable in Java?


31. What is the output of the following Java statement?
System.out.println("Hello " + 5 + 10);


32. What is the difference between an abstract class and an interface in Java?


33. How do you declare a constant in Java?


34. Which of the following statements is true about the "this" keyword in Java?


35. What is the default value of an instance variable in Java?


36. Which of the following is not a valid Java access modifier?


37. Which of the following can be used to check whether an object is an instance of a particular class in Java?


38. How do you declare an array in Java?


39. Which method is used to start a thread in Java?


40. What is the purpose of the static keyword in Java?


41. What is the purpose of the "super" keyword in Java?


42. Which of the following is used to handle exceptions in Java?


43. What does the term "polymorphism" mean in Java?


44. What is the purpose of the "final" keyword in Java?


45. What is the difference between "== " and "equals()" in Java?


46. How can you create a thread in Java?


47. What is the difference between a "checked" and "unchecked" exception in Java?


48. How do you declare a method that throws an exception in Java?


49. What is the output of the following Java code snippet?
System.out.println("Hello, World!".substring(7, 12));


50. What is the purpose of the "this" keyword in Java?


Java Short Questions

1. What is Java?

2. What are the main features of Java?

3. What is the Java Virtual Machine (JVM)?

4. What is the difference between JDK, JRE, and JVM?

5. What is an object in Java?

6. What is inheritance in Java?

7. What is an interface in Java?

8. What is exception handling in Java?

9. What is the purpose of the main method in Java?

10. What are Java Collections?

11. What is the difference between "ArrayList" and "LinkedList" in Java?

12. What is the difference between "StringBuilder" and "StringBuffer" in Java?

13. What is a constructor in Java?

14. What is inheritance in Java?

15. What is polymorphism in Java?

16. What is an abstract class in Java?

17. What is encapsulation in Java?

18. What is the difference between "==" and "equals()" in Java?

19. What is the purpose of the "super" keyword in Java?

20. What is the difference between "final", "finally", and "finalize" in Java?

21. What is the use of the "static" keyword in Java?

22. What are Java interfaces?

23. What is the difference between "ArrayList" and "Vector" in Java?

24. What is the use of the "this" keyword in Java?

25. What is multithreading in Java?

26. What is the difference between "throw" and "throws" in Java?

27. What is the purpose of the "clone" method in Java?

28. What is the difference between "String" and "StringBuffer" in Java?

29. What is an inner class in Java?

30. What is the difference between "method overloading" and "method overriding" in Java?

31. What is the purpose of the "instanceof" keyword in Java?

32. What is the difference between "abstract" class and "interface" in Java?

33. What is garbage collection in Java?

34. What is the "super" keyword used for in Java?

35. What is the use of the "final" keyword in Java?

36. What is the "volatile" keyword in Java?

37. What is the difference between "HashMap" and "TreeMap" in Java?

38. What is a "singleton" class in Java?

39. What is the purpose of the "Thread.sleep()" method in Java?

40. What is the purpose of the "yield()" method in Java?

41. What are the access modifiers in Java?

42. What is the use of the "continue" keyword in Java?

43. What is the difference between "Array" and "ArrayList" in Java?

44. What is the "default" keyword in Java?

45. What is method overloading in Java?

46. What is method overriding in Java?

47. What is the purpose of the "break" keyword in Java?

48. What is a "lambda expression" in Java?

49. What is the purpose of the "instanceof" operator in Java?

50. What is the difference between "HashMap" and "Hashtable" in Java?

Coumputer Course

Popular Courses

(123)
Web Development
(123)
FULL STACK JAVA
PROGRAMING
(123)
PYTHON PROGRAMING
smartfuturepoint