Test Your Java Knowledge with Java MCQs Online Test

06 May 2023 Balmiki Mandal 0 Core Java

Are you a Java enthusiast? Take this Java MCQ online test and see how well versed you are in the world of Java. This multiple choice question test will help you assess your knowledge about the core concepts of Java programming language.

This test is designed to evaluate your knowledge on topics such as Java Syntax, Class definitions, Variables, Constants, Operators and much more. So, get ready to test your skills with 20 questions that you need to answer within 15 minutes.

Instructions

  • Each question has 4 options
  • Select the correct option to the best of your knowledge
  • At the end of the test, click on ‘Submit’ button to get your score

Good luck and happy learning!

  1. Which of the following is not a primitive data type in Java? a) int b) float c) boolean d) string

      Answer: d) string

  1. Which of the following is true about inheritance in Java? a) A subclass can inherit from multiple superclasses. b) A superclass can inherit from multiple subclasses. c) A subclass can inherit from only one superclass. d) A subclass can inherit from a superclass and an interface.

     Answer: c) A subclass can inherit from only one superclass.

  1. What is the output of the following code snippet? int x = 10; if (x > 5 && x < 15) { System.out.println("x is between 5 and 15"); } else { System.out.println("x is not between 5 and 15"); }

     a) x is between 5 and 10 b) x is between 5 and 15 c) x is not between 5 and 10 d) x is not between 5 and 15

     Answer: b) x is between 5 and 15

  1. What is the difference between a public and a private method in Java? a) A public method can be accessed from any class, whereas a private method can only be accessed from within the same class. b) A public method can only be accessed from within the same class, whereas a private method can be accessed from any class. c) A public method is slower than a private method. d) A public method is more secure than a private method.

      Answer: a) A public method can be accessed from any class, whereas a private method can only be accessed from within the same class.

  1. Which of the following is true about interfaces in Java? a) An interface can have implementation for its methods. b) A class can implement multiple interfaces. c) An interface can extend multiple classes. d) An interface can have constructors.

      Answer: b) A class can implement multiple interfaces.

BY: Balmiki Mandal

Related Blogs

Post Comments.

Login to Post a Comment

No comments yet, Be the first to comment.