- 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 is correct about manual testing?
A - Since test cases are executed by human resources so it is very slow and tedious.
B - As test cases need to be executed manually so more testers are required in manual testing.
Answer : C
Explanation
Since test cases are executed by human resources so it is very slow and tedious and as test cases need to be executed manually so more testers are required in manual testing.
Q 2 - Which of the following is correct about Fixture?
A - Fixture is a fixed state of a set of objects used as a baseline for running tests.
Answer : C
Explanation
Fixture is a fixed state of a set of objects used as a baseline for running tests. The purpose of a test fixture is to ensure that there is a well known and fixed environment in which tests are run so that results are repeatable.
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 Assert class checks that an object is null?
A - void assert(Object object, boolean toCheckAsNull)
B - void assertCheck(Object object, boolean toCheckAsNull)
Answer : C
Explanation
void assertNull(Object object) checks that an object is null.
Q 5 - Which of the following method of TestResult class adds a failure to the list of failures?
A - void addFailure(Test test, Error t)
B - void addFailure(Test test, AssertionFailedError t)
Answer : B
Explanation
void addFailure(Test test, AssertionFailedError t) method adds a failure to the list of failures.
Q 6 - Which of the following method of TestResult class returns an Enumeration for the errors?
A - Enumeration<Object> errors()
B - Enumeration<TestFailure> errors()
Answer : C
Explanation
Enumeration<TestFailure> errors() method returns an Enumeration for the errors.
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 - Which of the following class is used to run test cases?
Answer : A
Explanation
The test cases are executed using JUnitCore class.
Q 9 - Testing is the process of checking the functionality of the application whether it is working as per requirements.
Answer : A
Explanation
Testing is the process of checking the functionality of the application whether it is working as per requirements.
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.