
- 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
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
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 describes Testing correctly?
B - Testing is the testing of single entity (class or method).
Answer : A
Explanation
Testing is the process of checking the functionality of the application whether it is working as per requirements.
Q 2 - Which of the following class contains a set of assert methods?
Answer : A
Explanation
Assert class contains a set of assert methods.
Q 3 - Which of the following annotation causes that method run once after all tests have finished?
Answer : D
Explanation
Annotating a public static void method with @AfterClass cause that method run after all tests have finished. This can be used to perform clean-up activities.
Q 4 - Which of the following method of Assert class checks if two object references are not pointing to the same object?
A - void assert(Object expected, Object actual,boolean isSame)
B - void assertCheck(Object expected, Object actual,boolean isSame)
C - void assertNotSame(Object expected, Object actual)
D - void assertChecks(Object expected, Object actual,boolean isSame)
Answer : C
Explanation
void assertNotSame(Object expected, Object actual) checks if two object references are not pointing to the same object.
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 counts the number of test cases that will be run by this test?
Answer : D
Explanation
int countTestCases() method counts the number of test cases that will be run by this test.
Q 7 - Which of the following method of TestSuite class returns the number of tests in this suite?
Answer : A
Explanation
int testCount() method returns the number of tests in this suite.
Answer : B
Explanation
Both @RunWith and @Suite annotation are used to run the suite test.
Answer : B
Explanation
JUnit is an open source framework.
Q 10 - Unit Tests are written after the code during development in order to help coders test the code.
Answer : B
Explanation
Unit Tests are to be written before the code during development in order to help coders write the best code.