Java quiz

The test is not official, it's just a nice way to see how much you know, or don't know, about Java. You will get 1 point for each correct answer. At the end of the Quiz, your total score will be displayed. Maximum score is 25 points. If you don't know Java, we suggest that you read our Java Tutorial from scratch. The Bootstrap Certificate documents your knowledge of the Bootstrap framework. If you want to report an error, or if you want to make a suggestion, do not hesitate to send us an e-mail:.

Start the Quiz Good luck! W3Schools' Online Certification The perfect solution for professionals who need to balance work, family, and career building. More than 25 certificates already issued! HOW TO. Your message has been sent to W3Schools. W3Schools is optimized for learning, testing, and training. Examples might be simplified to improve reading and basic understanding. Tutorials, references, and examples are constantly reviewed to avoid errors, but we cannot warrant full correctness of all content.

While using this site, you agree to have read and accepted our terms of usecookie and privacy policy. Copyright by Refsnes Data. All Rights Reserved.

Powered by W3.You will have to read all the given answers and click over the correct answer. If you are not sure about the answer then you can check the answer using Show Answer button. You can use Next Quiz button to check new set of questions in the quiz. String object is immutable so that once it is created a String object cannot be changed. Since String is immutable it can safely be shared between many threads which are considered very important for multithreaded programming.

A - It is the process where one object acquires the properties of another. B - inheritance is the ability of an object to take on many forms.

C - inheritance is a technique to define different methods of same type. It is the process where one object acquires the properties of another. With the use of inheritance the information is made manageable in a hierarchical order. A - It is used to create syncronized code.

C - It is used to initialize the static data member. It is executed before main method at the time of loading of a class. A - Methods with same name but different parameters. B - Methods with same name but different return types. C - Methods with same name, same parameter types but different parameter names.

If a class has multiple functions by same name but different parameters, it is known as Method Overloading. A - Thread returns to the ready state.

java quiz

B - Thread returns to the waiting state. Q 9 - Under what conditions is an object's finalize method invoked by the garbage collector? A - When it detects that the object has become unreachable. B - As soon as object is set as null.

C - At fixed intervalm it checks for null value. The garbage collector invokes an object's finalize method when it detects that the object has become unreachable. Java Online Quiz Advertisements. Previous Page. Next Page. Q 1 - Can we compare int variable with a boolean variable? A - True B - False.

java quiz

Answer : B Explaination True, Compile time error will occur if an int variable is compared with Boolean variable. Show Answer. Q 2 - Can we have two public classes in one java file?

Answer : B Explaination No, a java file can contain only one public class. Q 3 - What is the default value of char variable?

Q 4 - Which of the following is true about String? A - String is mutable. B - String is immutable. C - String is a data type. D - None of the above. Answer : B Explaination String object is immutable so that once it is created a String object cannot be changed.Welcome to Core Java Quiz. Java is an object-oriented programming language. In this quiz, you will be tested on core java basics and OOPS concepts.

Give it a try and share with others if you like it. Which of the below is valid way to instantiate an array in java? Compiler will complain as Type mismatch: cannot convert from int to int[]. By default, any field of the interface is public, static and final. So we can't change is, hence compile-time error at line 8 statement Foo.

Java compiler tries to automatically convert int to char. Runtime error because main method is not static. We can have static block in a class, it gets executed only once when class loads. From java 8 onwards, we can have static method implementations in interfaces. Further Reading: static keywords in java java 8 interface changes.

Inheritance is one of the core concepts in Java. You should be familiar with it. Please read below articles to learn more about the answer choices. Inheritance in Java Multiple Inheritance in Java. Subclass foo method can't be static, it will give compile time error This static method cannot hide the instance method from Super. Compile time error at line 10 because Super class foo method is private. Below code snippet shows the compilation error for Java 9.

RuntimeException and its subclasses are unchecked exceptions. Unchecked exceptions do not need to be declared in a method or constructor's throws clause. Read more at Exception Handling in Java. Compile-time error Unreachable catch block for IOException. It is already handled by the catch block for Exception.

Java & SQL Quiz -- Test your JAVA Programming knowledge

This was a tricky question. We can have multiple main methods in java through method overloading. Read more at Java Annotations.Java Inheritance. Please wait while the activity loads. If this activity does not load, try refreshing your browser. Also, this page requires javascript. Please visit using a browser with javascript enabled.

If loading fails, click here to try again. Question 1. Output of following Java Program? Question 1 Explanation:. In the above program, b is a reference of Base type and refers to an abject of Derived class. In Java, functions are virtual by default. So the run time polymorphism happens and derived fun is called. Question 2. Question 2 Explanation:.

Final methods cannot be overridden. See the compiler error here. Question 3. Question 3 Explanation:. Question 4. Which of the following is true about inheritance in Java? Question 4 Explanation:. Question 5. Output of following Java program? Question 5 Explanation:. Question 6. Predict the output of following program. Note that fun is public in base and private in derived.With this Java test, you can assess the skills of prospective candidates before ever inviting them to an interview.

The exam consists of 20 questions compiled by a group of experts in the Java programming language and covers a broad spectrum of Java knowledge. You can use our Java online test to easily identify which candidates show the highest aptitude for Java development and which you can safely pass on. Which of the following Java classes effectively prevent other classes from modifying their internal data?

Check all that apply. Note that for the purposes of this question, neither reflection nor bytecode manipulation may be used to modify another class. Immutability is tricky in Java. To achieve it, you must:. Now it's time to invite them to a live interview so you can personally ask some programming questions. Our team of experts has assembled a set of ready-made Java interview questions and answers you can use in your interview process. We provide all the information you need to interview candidates like a professional developer!

In order to properly compare candidates, they need to answer questions of the same difficulty leveland different questions always mean different difficulty levels. However, the order of questions and answers is randomized for each applicant. For example, you have 5 candidates who get scores of 35, 45, 60, 65, and 80, based on a maximum possible score of The test is presented in a multiple-choice, or quiz, formatrather than requiring test takers to write code. If we used a coding test instead, we would have to check all answers manually, which would obviously be impossible.

The test can also be used to test junior programmers, but you should reduce your acceptance score drastically to compensate. Likewise, you can use it to test senior Java developers as well, with an increased acceptance score. Some will argue that it's pointless to judge senior developers based on a test meant for mid-level developers.

This is generally true if you're looking for specific skills in a candidate rather than a broad base of expertise. But at the same time, anyone can claim to be a senior developer on their resume. If you're concerned that candidates might be overstating their knowledge and accomplishments, this Java skills test is a good way to determine which ones can actually deliver what they promise.

Software Engineering Manager at Red Hat. Read how we create our tests Tests4Geeks is the service for IT skills assessment. Coding tests allow you to hire programmers more easily. Each online programming test is developed by professionals with great knowledge, experience and skills.

Log In Register. Taking advantage of Java quiz is a surefire way to streamline your interview process! Explanation Immutability is tricky in Java. To achieve it, you must: Not expose any mutators setters Protect your Java class from being subclassed Make sure all mutable data you expose is either immutable or a defensive copy.If this activity does not load, try refreshing your browser.

Also, this page requires javascript. Please visit using a browser with javascript enabled. Question 1 Which class can access all public and protected methods and fields of its super class? Exception D Java. Any items you have not completed will be marked incorrect.

Get Results There are 20 questions to complete. If you leave this page, your progress will be lost. Keep trying! Not bad! Good work! JAVA Quiz. Please wait while the activity loads.

java quiz

If loading fails, click here to try again. Your answers are highlighted below. Question 1. Which class can access all public and protected methods and fields of its super class? Question 2. Method,Field can be accessed from the same class to which they belong. Question 3. Question 4. What will be the output of following piece of code? Question 5. Can variables be used in Java without initialization? Question 6.

Can a class in java be inherited from more than one class? Question 7. Question 8.

Top 25 Java Quiz Questions – A Small Test to Build Your Knowledge

Question 9. In JAVA can a dead thread be started again? Question Is JDK required on each machine to run a Java program? Which tool is required on each machine to run a Java program? Can a variable be local and static at the same time?There are a list of core java quizzes such as basics quiz, oops quiz, string handling quiz, array quiz, exception handling quiz, collection framework quiz etc.

After clearing the exam, play our Belt Series Quiz and earn points. These points will be displayed on your profile page.

Java Online Test

JavaTpoint offers too many high quality services. Mail us on hr javatpoint. Please mail your requirement at hr javatpoint. Duration: 1 week to 2 week.

Core Java Basics Quiz. String Handling Quiz. Exception Hand. Multithreading Quiz. Multithreading quiz-1 Multithreading quiz Java Misc. Quiz-1 Java Misc. Quiz-2 Java Misc. Quiz-3 Java Misc. Quiz-4 Java Misc. Core Java Quiz Java Online Test There are a list of core java quizzes such as basics quiz, oops quiz, string handling quiz, array quiz, exception handling quiz, collection framework quiz etc. Quiz Exception Hand. Quiz-1 Exception Hand. Quiz-2 Exception Hand.

Multithreading Quiz Multithreading quiz-1 Multithreading quiz