Olete.in
Articles
Mock Tests
🧪 Maven MCQ Quiz Hub
Maven Mcq Set 3
Choose a topic to test your knowledge and improve your Maven skills
1. What are exceptions?
Anomalous conditions requiring special processing
Extra methods written to increase functionality
Commented lines describing exceptional cases
Null objects
2. ________ can be useful in adding additional functionality which applies to every test within a test class.
Copy
Rules
Exceptions
Boundaries
3. ______ is a programming paradigm which allows the separation of cross cutting concerns, hence, increasing modularity.
Functional Programming
Object Oriented Programming
Aspect Oriented Programming
Data Injections
4. _______ describes a class of functions which when run modify other functions.
Class
Advice
Modifiers
Changers
5. AOP forms a basis for ______
Functional Development
Object Oriented Programming
Datafield Development
Aspect Oriented Software Development
6. Custom JUnit rules can be created using _______
TestRule Interface
TestRule Interface
RuleCreate Interface
RuleInitialize Interface
7. With the ‘expected’ argument, one cannot ________
Test a method
Test for exception type
Test the value of the message in the exception
Test for specific exception
8. The _________ rule can be used to test both exception type and message.
Expected
ExpectedException
CatchException
Catch
9. ExpectedException is found under which package?
org.junit.ExpectedException
org.junit.Test.ExpectedException
org.junit.Rule.ExpectedException
org.junit.rules.ExpectedException
10. The correct way to initialise an ExpectedException object is _____
public ExpectedException thrown = ExpectedException.none()
@Rule public ExpectedException thrown
@Rule public ExpectedException thrown = ExpectedException.none()
public ExpectedException thrown = ExpectedException.none()
11. What is timeout testing?
Testing for exceptions
Testing code execution within time limits
Testing code correctness
Testing code with time functions
12. The _____ parameter is used along with the @Test annotation to test for timeouts.
Expected
Timeout
NoLimit
Time
13. @Test(timeout = 130) implies a time limit of ______
130 milliseconds
130 minutes
130 seconds
1.30 minutes
14. Timeout testing is _____
Software Dependent
Hardware Dependent
Software and Hardware Dependent
Software and Hardware Independent
15. What applies the same timeout to every test method of a class?
@Timeout
@Expected
Timeout Rule
Not possible to apply same timeout
16. A Timeout Rule is initialized by _______
@Rule public Timeout object = new Timeout()
@Rule public Timeout object = Timeout.seconds()
public Timeout object = Timeout.seconds()
public Timeout object = new Timeout()
17. Where is the Timeout class present?
org.junit.rules.Timeout
org.junit.Timeout
org.Timeout
org.junit.RuleClasses.Timeout
18. The Timeout Rule implements which interface?
Timeout
Test
TestingTimeout
TestRule
19. If a timeout which has been specified lapses before the completion of the test, its execution is interrupted with _____
Interrupt()
Thread.interrupt()
Thread.interruptable()
Threads.interruptable()
20. What does a specified timeout of 0 imply?
130 milliseconds
130 minutes
130 seconds
Not set
21. ______ is a library that contains a lot of helpful matcher objects , ported in several languages.
Java
Pygame
AllenWake
Hamcrest
22. Hamcrest is not a _______ framework in itself.
Matching
Testing
Asserting
Checking
23. The package for the assertThat() function is?
org.hamcrest.CoreMatchers.assertThat
org.junit.Assert.assertThat
org.junit.JunitMatchers.assertThat
org.junit.hasItem.assertThat
24. ______ Hamcrest matcher can be used to match absolutely everything.
Is
AnyOf
Anything
Not set
25. ______ is used only to improve the readability of the statements.
anything
is
sameInstance
nullValue
26. Which Hamcrest matcher is just like the && operator?
Is
Anything
sameInstance
allOf
27. ______ checks to see if any of the contained matchers match.
anyOf
allOf
instanceOf
notNull
28. ________ traverses the meaning of the contained matchers.
not
or
allOf
andAll
29. The instanceOf matcher is equivalent to ________
isCompatibleType
isCompatible
isInstance
isSame
30. ______ is used to test object identity.
instanceOf
isCompatibleType
type
sameInstance
31. The JUnit hasItem() function is a _______
Hamcrest Matcher
Instance Function
JUnitMatcher
Matcher
32. The package to which hasItem() function belongs is ________
org.junit.JUnitMatchers.hasItem
org.junit.JUnitMatchers.hasItem
org.junit.Junit.hasItem
org.junit.hamcrest.hasItem
33. Class JUnitMatchers extends _______
java.lang.Object
java.lang.String
java.util.*
java.util.Arrays
34. _____ is used for combining those matchers which must both pass.
all
both
justTwo
matchTwo
35. _______ Hamcrest matcher tests for null values.
isNull
nullValue
isNullValue
isNullable
36. ______ tests whether a JavaBean has a particular property.
isProperty
porperty
hasProperty
isPresent
37. To define a ________ in a JavaBean class, public getter and setter methods have to be supplied.
Class
Object
Value
Property
38. A/An __________ property is an array instead of a single value.
Indexed
valued
null
variable
39. __________ tests whether a given string equals another one, ignoring the case.
stringEqual
equalToIgnoringCase
ignoringCaseEqual
equalToCase
40. _______ tests whether a given Map has a given entry.
hasItem
hasItems
hasValue
hasEntry
41. Which Hamcrest core matcher checks if a number is equal to a number of some acceptable error?
closeTo
equals
errorBy
similarTo
42. assertThat(1.03, is(closeTo(1.0, 0.03))) is _____
True
False
Null
Error
43. assertThat(0.03, is(closeTo(1.0, 0.03))) is _____
True
False
Null
Error
44. The closeTo function is found under which package?
org.hamcrest.TypeSafeMatcher
org.hamcrest.BaseMatcher
org.hamcrest.number.IsCloseTo
org.hamcrest.number.CloseTo
45. The isCloseTo class extends which base class?
Matcher
HamcrestCore
TypeMatcher
TypeSafeMatcher
46. The ___________ method of the TypeSafeMatcher class is made final.
matches
matchesSafely
describeMismatchSafely
No mehtod
47. The TypeSafeMatcher implements the __________ interface.
Self
Describing
EqulityCheck
SelfDescribing
48. The ____________ matcher checks if a given key is in a map.
hasEntry
hasValue
hasKey
isKey
49. To write custom matcher _____________ has to be implemented.
Matcher Interface
Hamcrest Interface
HamcrestMatching Interface
Not possible to implement
50. _______ is the base class for all Matcher implementations.
MatcherBase
Base
Matcher
BaseMatcher
Submit