- JUnit Tutorial
- JUnit - Home
- JUnit - Overview
- JUnit - Environment Setup
- JUnit - Test Framework
- JUnit - Basic Usage
- JUnit - API
- JUnit - Writing a Tests
- JUnit - Using Assertion
- JUnit - Execution Procedure
- JUnit - Executing Tests
- JUnit - Suite Test
- JUnit - Ignore Test
- JUnit - Time Test
- JUnit - Exceptions Test
- JUnit - Parameterized Test
- JUnit - Plug with Ant
- JUnit - Plug with Eclipse
- JUnit - Extensions
- JUnit Useful Resources
- JUnit - Questions and Answers
- JUnit - Quick Guide
- JUnit - Useful Resources
- JUnit - Discussion
JUnit Online Quiz
Following quiz provides Multiple Choice Questions (MCQs) related to JUnit Framework. 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.
Q 1 - Which of the following is correct about JUnit?
A - It is an open source framework.
B - It provides Annotation to identify the test methods.
Answer : D
Explanation
All of the above options are correct.
Q 2 - Which of the following class contains methods to collect the results of executing a test case?
Answer : C
Explanation
TestResult class contains methods to collect the results of executing a test case.
Q 3 - Which of the following is correct about org.junit.JUnitCore class?
A - The test cases are executed using JUnitCore class.
B - JUnitCore is a facade for running tests.
C - It supports running JUnit 4 tests, JUnit 3.8.x tests, and mixtures.
Answer : D
Explanation
The test cases are executed using JUnitCore class. JUnitCore is a facade for running tests. It supports running JUnit 4 tests, JUnit 3.8.x tests, and mixtures.
Q 4 - Which of the following method of Assert class fails a test with no message?
A - void assertChecks(boolean pass)
Answer : D
Explanation
void fail() fails a test with no message.
Q 5 - Which of the following method of TestCase class sets the name of a TestCase?
Answer : C
Explanation
void setName() method sets the name of a TestCase.
Q 6 - Which of the following method of TestResult class marks that the test run should stop?
Answer : B
Explanation
void stop() method marks that the test run should stop.
Q 7 - Which of the following method of TestSuite class returns the test at the given index?
Answer : A
Explanation
Test testAt(int index) method returns the test at the given index.
Q 8 - @Test annotation along with expected attribute can be used to test the code whether code throws desired exception or not.
Answer : A
Explanation
@Test annotation along with expected attribute can be used to test the code whether code throws desired exception or not.
Answer : A
Explanation
JUnit 4.0 provides Annotations to identify the test methods.
Answer : A
Explanation
Assert contains a set of assert methods.
To Continue Learning Please Login
Login with Google