250+ TOP MCQs on Setting Up a Maven Project and Answers

JUnit Problems on “Setting Up a Maven Project”.

1. ___________ creates an action that performs the given script.
a) describeTo(Description description)
b) invoke(Invocation invocation)
c) perform(String script)
d) where(String name, Object value)
Answer: c
Clarification: The perform methods takes a BeanShell script as a parameter.

2. ____________ defines a variable that can be referred to by the script.
a) describeTo(Description description)
b) invoke(Invocation invocation)
c) perform(String script)
d) where(String name, Object value)
Answer: d
Clarification: The where() function returns the action, so that more variables can be defined if needed.

3. ____________ package contains actions that fake the behavior of mocked invocations.
a) org.jmock
b) org.jmock.lib.action
c) org.jmock.lib
d) org.jmock.lib.script
Answer: b
Clarification: org.jmock.lib.action contains actions that fake the behavior of mocked invocations.

4. _____________ returns the next of a sequence of elements each time it is invoked.
a) ActionSequence
b) CustomAction
c) DoAllAction
d) ReturnValueAction
Answer: a
Clarification: The ActionSequence methods takes as a parameter the invocation to perform.

5. The exception thrown by the ActionSequence mehod is _____________
a) NullPointer
b) Throwable
c) ArrayIndexOutOfBounds
d) Arithmetic
Answer: b
Clarification: Any checked exception thrown must be in the throws list of the invoked method.

6. ______________ is a partial implementation of the Action interface that making it easy to implement actions specific to applications with inline anonymous classes.
a) ActionSequence
b) CustomAction
c) DoAllAction
d) ReturnValueAction
Answer: b
Clarification: The CustomAction class is a partial implementation of the Action interface.

7. _____________ performs multiple actions every time it is invoked.
a) ActionSequence
b) CustomAction
c) DoAllAction
d) ReturnValueAction

Answer: c
Clarification: The DoAllAction class implements the Action interface.

8. ___________ returns an Enumeration over a collection.
a) ActionSequence
b) CustomAction
c) DoAllAction
d) ReturnEnumerationAction
Answer: d
Clarification: The class definition is public ReturnEnumerationAction(Object… array).

9. ___________ returns an iterator over a collection.
a) ActionSequence
b) CustomAction
c) ReturnIteratorAction
d) ReturnEnumerationAction
Answer: c
Clarification: The constructors are public ReturnIteratorAction(Collection collection) and public ReturnIteratorAction(Object… array).

10. The VoidAction class throws an exception.
a) True
b) False
Answer: b
Clarification: The ThrowAction class throws an exception.


JUnit Problems,

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top