- 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 annotation causes that method to be run before each Test method?
Answer : B
Explanation
Annotating a public void method with @Before causes that method to be run before each Test method.
Q 4 - Which of the following method of TestCase class counts the number of test cases executed by run(TestResult result)?
Answer : A
Explanation
int countTestCases() method counts the number of test cases executed by run(TestResult result).
Q 5 - Which of the following method of TestResult class informs the result that a test was completed?
Answer : C
Explanation
void endTest(Test test) method informs the result that a test was completed.
Q 6 - Which of the following method of TestSuite class adds a test to the suite?
Answer : C
Explanation
void addTest(Test test) method adds a test to the suite.
Q 7 - Which of the following method of TestSuite class runs the tests and collects their result in a TestResult?
A - void execute(TestResult result)
B - void runTest(TestResult result)
Answer : C
Explanation
void run(TestResult result) method runs the tests and collects their result in a TestResult.
Q 8 - If a test class is annotated with @Ignore then none of its test methods will be executed.
Answer : B
Explanation
If a test class is annotated with @Ignore then none of its test methods will be executed.
Q 9 - Parameterized tests allow developer to run the same test over and over again using same values.
Answer : B
Explanation
Parameterized tests allow developer to run the same test over and over again using different values.
Q 10 - Unit Tests are to be written before the code during development in order to help coders write the best code.
Answer : A
Explanation
Unit Tests are to be written before the code during development in order to help coders write the best code.
To Continue Learning Please Login
Login with Google