NEW
Font size
S
M
L
XL
Worksheets3.JUnitin Action
Total questions: 46
Worksheet time: 23mins
Name
Class
Date
1.
What is JUnit used for in Java?
a)
Debugging
b)
Documentation
c)
Unit testing
d)
Performance optimization
2.
How to include JUnit in Java?
a)
Build
b)
Run
c)
Compile
d)
Test
3.
How to write JUnit 5 test cases in Java?
a)
Create
b)
Import
c)
Configure
d)
Execute
4.
How to write test case in JUnit Java?
a)
Declare
b)
Implement
c)
Execute
d)
Evaluate
5.
Why JUnit is used for testing?
a)
Code analysis
b)
Performance monitoring
c)
Regression testing
d)
User interface testing
6.
How JUnit is used for testing?
a)
Assertion
b)
Compilation
c)
Debugging
d)
Optimization
7.
How do I run a JUnit test in code?
a)
Build As
b)
Run As
c)
Execute As
d)
Debug As
8.
How do I create a JUnit test file?
a)
Build
b)
Run
c)
Create
d)
Implement
9.
What are the JUnit annotations?
a)
Indicators
b)
Declarations
c)
Predefined
d)
Assertions
10.
What are the lifecycle methods in JUnit?
a)
BeforeAll, AfterAll, BeforeEach, AfterEach
b)
Start, Stop, Initiate, Terminate
c)
Setup, Teardown, Execute, Cleanup
d)
Initialize, Finalize, Pretest, Posttest
11.
What is platform in JUnit?
a)
Foundation
b)
Framework
c)
Launcher
d)
Engine
12.
Which JUnit version to use?
a)
4.5
b)
5
c)
5.7
d)
6
13.
How to write JUnit mock test cases?
a)
Define
b)
Create
c)
Execute
d)
Verify
14.
Can we write JUnit for POJO class?
a)
Yes
b)
No
c)
Maybe
d)
Depends
15.
What is the purpose of the @test annotation in JUnit 5?
a)
Marking test methods
b)
Enabling test execution
c)
Capturing test results
d)
Managing test dependencies
16.
Is JUnit only for unit testing?
a)
Yes
b)
No
c)
Sometimes
d)
Depends
17.
What is the difference between testing and JUnit?
a)
Dependency management
b)
Framework compatibility
c)
Test execution speed
d)
Dependency tests
18.
Why cucumber in JUnit is used?
a)
Test execution speed
b)
Non-technical test case definition
c)
Dependency testing
d)
Smooth test case execution
19.
What are the advantages of JUnit?
a)
Fast coding and increased quality
b)
Complex and time-consuming
c)
Manual test result verification
d)
Automatic test execution and feedback
20.
What are the limitations of JUnit?
a)
Dependency testing support
b)
Suitable for large test suites
c)
HTML reports generation
d)
Group testing capability
21.
How do I run all tests in JUnit?
a)
Ctrl+Shift+F10
b)
Right-click and select Run
c)
Maven command: mvn clean test
d)
Terminal command: runAllTests
22.
How to run JUnit tests with Maven?
a)
mvn compile test
b)
mvn clean package
c)
mvn test-run
d)
mvn clean test
23.
How do I take a JUnit test report?
a)
Use JUnit HTML Report Generator
b)
mvn generate-report
c)
Run mvn site command
d)
Use JUnit Reporter plugin
24.
What is JUnit format?
a)
XML
b)
JSON
c)
HTML
d)
YAML
25.
How to install JUnit testing?
a)
Verify Java installation
b)
Download JUnit archive
c)
Set up JUnit environment
d)
Run JUnit setup test
26.
How do you write a unit test?
a)
Test complex code segments
b)
Write tests after fixing bugs
c)
Follow Arrange, Act, Assert pattern
d)
Keep tests long and detailed
27.
What is @rule in JUnit?
a)
Inheritance principle
b)
Test composition principle
c)
Assertion annotation
d)
Method visibility rule
28.
What is mocking in JUnit?
a)
Creating controlled test environment
b)
Removing external dependencies
c)
Test case declaration
d)
Inheritance principle
29.
What is the use of @test annotation?
a)
Marking test methods
b)
Parameter resolution
c)
Test result capturing
d)
Dependency management
30.
What are the three lifecycle methods?
a)
Mounting, Updating, Unmounting
b)
Before, During, After
c)
Pre, During, Post
d)
Start, Stop, Cleanup
31.
Which lifecycle method is called?
a)
Update
b)
Initiate
c)
Invoke
d)
Mount
32.
What is before all annotation?
a)
Annotation to run tests in parallel
b)
Annotation for dependency testing
c)
Annotation for test setup
d)
Annotation to run before all tests
33.
What are platform types?
a)
Types of Java declarations
b)
Testing framework platforms
c)
Dependency management platforms
d)
Test execution platforms
34.
What are the three parts of a platform?
a)
Frame, Lid, Legs
b)
Base, Support, Surface
c)
Top, Bottom, Sides
d)
Structure, Foundation, Cover
35.
Why is it called a platform?
a)
Flat form
b)
Stability and support
c)
Origin from Middle French
d)
Frame for standing
36.
Can JUnit run automatically?
a)
Yes
b)
No
c)
Sometimes
d)
Depends
37.
Is JUnit a library or framework?
a)
Library
b)
Framework
38.
What is the difference between JUnit and Mockito?
a)
Purpose
b)
Syntax
c)
Compatibility
d)
Design
39.
Who writes JUnit test cases?
a)
Testers
b)
Developers
c)
Managers
d)
Users
40.
What is the first step in mocking?
a)
Setting
b)
Stubs
c)
Spying
d)
Annotation
41.
What is Spy in Mockito?
a)
Tracking
b)
Mocking
c)
Calling
d)
Instantiating
42.
Can we write JUnit for private class?
a)
Yes
b)
No
43.
Can we write JUnit for abstract class?
a)
Yes
b)
No
44.
What is POJO in testing?
a)
Parameter
b)
Testing
c)
Interface
d)
Class
45.
What is @Test annotation in Java?
a)
Reporting
b)
Invocation
c)
Verification
d)
Construction
46.
What is the use of @Mock annotation in JUnit?
a)
Verification
b)
Mocking
c)
Minimization
d)
Reading
Reset
