- 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 automated testing?
A - Automation runs test cases significantly faster than human resources.
Answer : C
Explanation
Automation runs test cases significantly faster than human resources. Test cases are executed by using automation tool so less tester are required in automation testing.
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 after each Test method?
Answer : C
Explanation
Annotating a public void method with @After causes that method to be run after 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 an error to the list of errors?
A - void addError(Test test, Throwable t)
B - void addError(Test test, Error t)
Answer : A
Explanation
void addError(Test test, Throwable t) method adds an error to the list of errors.
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 returns the number of tests in this suite?
Answer : A
Explanation
int testCount() method returns the number of tests in this suite.
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 - Automated Test cases are executed by using automation tool so less tester are required in automation testing.
Answer : A
Explanation
Automated Test cases are executed by using automation tool so less tester are required in automation testing.
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.