Explore topic-wise InterviewSolutions in .

This section includes InterviewSolutions, each offering curated multiple-choice questions to sharpen your knowledge and support exam preparation. Choose a topic below to get started.

1.

___________ parses properties using a collection of expanders.(a) LocalPropertyStack(b) ResolvePropertyMap(c) NullReturn(d) ParsePropertiesThis question was posed to me in an interview for internship.This question is from Maven Downsides in portion Running JUnit Tests from Maven2 of JUnit

Answer»

The correct ANSWER is (d) PARSEPROPERTIES

To elaborate: The constructor of the ParseProperties class is public ParseProperties(Project project,java.util.Collection EXPANDERS, GetProperty getProperty).

2.

A _________ is a JUnit Rule that manages JMock expectations and allowances.(a) JunitRuleMockery(b) JmockRuleMockery(c) JunitRule(d) JunitMockeryI have been asked this question in quiz.Enquiry is from Maven Surefire in section Running JUnit Tests from Maven2 of JUnit

Answer»

Correct answer is (a) JunitRuleMockery

The BEST I can explain: JunitRuleMockery asserts that EXPECTATIONS have been MET after each TEST has FINISHED.

3.

___________ interface defines a sequence of expectations.(a) Sequence(b) States(c) Expectations(d) MockeryThis question was addressed to me during an interview for a job.I'm obligated to ask this question of Maven Plug-ins topic in chapter Running JUnit Tests from Maven2 of JUnit

Answer» RIGHT choice is (a) Sequence

The best I can explain: INVOCATIONS can be CONSTRAINED to occur in a strict ORDER DEFINED by a sequence.
4.

The __________ package contains plugins that make it easier to write custom actions by scripting their behaviour with BeanShell.(a) org.jmock.api(b) org.jmock.lib.action(c) org.jmock.lib.script(d) org.jmock.lib.legacyThis question was addressed to me in an interview.Enquiry is from Maven Introduction in chapter Running JUnit Tests from Maven2 of JUnit

Answer»

Right option is (C) org.jmock.lib.script

Easy explanation: org.jmock.lib.script is the package containing plugins to write CUSTOM ACTIONS by SCRIPTING.

5.

The __________ package contains plugins that make it easier to use jMock with legacy code.(a) org.jmock.api(b) org.jmock.lib.action(c) org.jmock.lib.script(d) org.jmock.lib.legacyI had been asked this question in class test.I'd like to ask this question from Maven Introduction topic in section Running JUnit Tests from Maven2 of JUnit

Answer»

The correct choice is (d) org.JMOCK.lib.LEGACY

Explanation: org.jmock.lib.legacy contains several plugins that make it SUITABLE to use jMock with legacy CODE.

6.

_____________ class is used to indicate that the XML namespace (URI) can be used to look for namespace attributes.(a) AttributeNamespace(b) BaseIfAttribute(c) IfBlankAttribute(d) IfSetAttributeThe question was asked in semester exam.I need to ask this question from Maven Downsides topic in section Running JUnit Tests from Maven2 of JUnit

Answer»

The CORRECT answer is (a) AttributeNamespace

Explanation: The AttributeNamespace class is USEFUL for INDICATION of XML namespace.

7.

__________ is an interface which defines a state machine that is used to constrain the order of invocations.(a) Sequence(b) States(c) Expectations(d) MockeryThis question was posed to me in unit test.The doubt is from Maven Plug-ins topic in section Running JUnit Tests from Maven2 of JUnit

Answer»

Correct choice is (B) STATES

Explanation: The States INTERFACE defines the state machine.

8.

__________ function translates the given ExpectationError into an error type compatible with another testing framework.(a) change()(b) translate()(c) compatible()(d) mock()This question was posed to me in homework.The origin of the question is Maven Plug-ins topic in portion Running JUnit Tests from Maven2 of JUnit

Answer»

Right OPTION is (b) translate()

The best explanation: Translate() returns an error that is compatible with another testing FRAMEWORK and contains the same MESSAGE and stack trace as the passed parameter.

9.

__________ is a TestCase that supports testing with mock objects.(a) JUnit3ErrorTranslator(b) JUnit3Mockery(c) MockObjectTestCase(d) VerifyingTestCaseI had been asked this question in examination.The origin of the question is Maven Surefire in section Running JUnit Tests from Maven2 of JUnit

Answer»

Correct ANSWER is (a) JUnit3ErrorTranslator

To ELABORATE: MockObjectTestCase is used for testing MOCK OBJECTS.

10.

The __________ class provides factory methods for the executor services provided in the package.(a) Executors(b) Exceptions(c) ReadOnly(d) AbstractMockI got this question during a job interview.This interesting question is from Maven Surefire topic in chapter Running JUnit Tests from Maven2 of JUnit

Answer» CORRECT option is (a) Executors

To explain I would SAY: The Executors CLASS has factory methods for theexecutor SERVICES.
11.

___________ returns an iterator over a collection.(a) ActionSequence(b) CustomAction(c) ReturnIteratorAction(d) ReturnEnumerationActionI have been asked this question during an internship interview.Question is taken from Setting Up a Maven Project in chapter Running JUnit Tests from Maven2 of JUnit

Answer» CORRECT CHOICE is (c) ReturnIteratorAction

The best explanation: The constructors are PUBLIC ReturnIteratorAction(COLLECTION> collection) and public ReturnIteratorAction(Object… array).
12.

______________ method performs an action in response to an invocation.(a) describeTo(Description description)(b) invoke(Invocation invocation)(c) perform(String script)(d) where(String name, Object value)The question was posed to me during an online exam.This intriguing question originated from Maven Introduction in division Running JUnit Tests from Maven2 of JUnit

Answer»

Right answer is (B) INVOKE(Invocation invocation)

To explain I would say: invoke(Invocation invocation)returns the RESULT of the invocation, if not THROWING an exception.

13.

__________ is an Imposteriser that uses the Proxy class of the Java Reflection API.(a) AssertionErrorTranslator(b) CamelCaseNamingScheme(c) JavaReflectionImposteriser(d) IdentityExpectationErrorTranslatorThe question was asked in an interview for internship.I would like to ask this question from Maven Plug-ins in section Running JUnit Tests from Maven2 of JUnit

Answer» RIGHT CHOICE is (c) JavaReflectionImposteriser

Explanation: The JavaReflectionImposteriser CLASS makes USE of the Proxy class of the Java REFLECTION API.
14.

The biggest advantage of mock objects over in-container testing is that mocks don’t require a ________ container in order to execute tests.(a) Running(b) Closed(c) Open(d) StaticI have been asked this question in an international level competition.The query is from Maven Downsides topic in chapter Running JUnit Tests from Maven2 of JUnit

Answer»

The correct ANSWER is (a) Running

Best EXPLANATION: Tests can be set up quickly and run quickly when using mock OBJECTS.

15.

___________ class is an Action that executes a BeanShell script.(a) ScriptedAction(b) Scripted(c) Action(d) ScriptedActionClassThis question was addressed to me in an interview.I need to ask this question from Maven Introduction topic in portion Running JUnit Tests from Maven2 of JUnit

Answer» CORRECT ANSWER is (a) ScriptedAction

Explanation: ScriptedAction class MAKES it EASY to implement custom actions.
16.

________________ interface is used by ant attributes.(a) EnableAttribute(b) PropertyExpander(c) GetProperty(d) LocalPropertiesThe question was asked during an online exam.I need to ask this question from Maven Downsides topic in portion Running JUnit Tests from Maven2 of JUnit

Answer»

The CORRECT OPTION is (a) EnableAttribute

The BEST I can EXPLAIN: The EnableAttribute interface is used by all apache ant ATTRIBUTES.

17.

____________ translates ExpectationErrors into JUnit’s AssertionFailedErrors.(a) JUnit3ErrorTranslator(b) JUnit3Mockery(c) MockObjectTestCase(d) VerifyingTestCaseThe question was posed to me by my college professor while I was bunking the class.I'd like to ask this question from Maven Surefire in division Running JUnit Tests from Maven2 of JUnit

Answer»

Right CHOICE is (a) JUnit3ErrorTranslator

To EXPLAIN I would say: JUnit3ErrorTranslator TRANSLATE Expectation Errors into JUNIT AssertionFailedErrors.

18.

____________ translates ExpectationErrors into AssertionErrors that several test frameworks, including JUnit 4 and TestNG, use to report errors.(a) AssertionErrorTranslator(b) CamelCaseNamingScheme(c) CurrentStateMatcher(d) IdentityExpectationErrorTranslatorThe question was asked in an online interview.My enquiry is from Maven Plug-ins topic in chapter Running JUnit Tests from Maven2 of JUnit

Answer»

Right answer is (a) AssertionErrorTranslator

To EXPLAIN I would SAY: The AssertionErrorTranslator is a CLASS that translates ExpectationErrors into AssertionErrors.

19.

_________ is a class to represent a null and to stop the chain of lookups.(a) LocalPropertyStack(b) ResolvePropertyMap(c) NullReturn(d) ParsePropertiesThis question was posed to me in an online quiz.This interesting question is from Maven Downsides in division Running JUnit Tests from Maven2 of JUnit

Answer» RIGHT CHOICE is (c) NullReturn

The best explanation: The NullReturn CLASS is the apache ant class REPRESENTATION of NULL.
20.

______________ 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) ReturnValueActionThis question was addressed to me during an interview.The query is from Setting Up a Maven Project topic in division Running JUnit Tests from Maven2 of JUnit

Answer»

Correct option is (B) CUSTOMACTION

The EXPLANATION is: The CustomAction CLASS is a partial implementation of the Action interface.

21.

The ancilliaryTypes parameter of the imposterise()function must all be interfaces.(a) True(b) FalseI had been asked this question in examination.My query is from Maven Introduction in section Running JUnit Tests from Maven2 of JUnit

Answer»

The correct answer is (a) True

To elaborate: The TYPES must all be INTERFACES because Java only allows SINGLE inheritance of classes.

22.

___________ is a thread local class containing local properties.(a) ParseNextProperty(b) PropertyExpander(c) GetProperty(d) LocalPropertiesI have been asked this question in an online interview.This intriguing question comes from Maven Downsides topic in chapter Running JUnit Tests from Maven2 of JUnit

Answer» CORRECT option is (d) LocalProperties

Explanation: The LocalProperties is a class of org.apache.tools.ant.property that CONTAINS LOCAL PROPERTIES.
23.

___________ returns an Enumeration over a collection.(a) ActionSequence(b) CustomAction(c) DoAllAction(d) ReturnEnumerationActionI had been asked this question in unit test.I need to ask this question from Setting Up a Maven Project topic in section Running JUnit Tests from Maven2 of JUnit

Answer» RIGHT choice is (d) RETURNENUMERATIONACTION

Best explanation: The class DEFINITION is PUBLIC ReturnEnumerationAction(Object… array).
24.

___________ 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)I have been asked this question in an online quiz.Asked question is from Setting Up a Maven Project in portion Running JUnit Tests from Maven2 of JUnit

Answer»

Right ANSWER is (c) perform(String script)

For explanation I would say: The perform METHODS TAKESA BEANSHELL script as a parameter.

25.

Stubs work well to ________ a given class for testing and asserting the state of its instances.(a) Delete(b) Enhance(c) Isolate(d) AppendThis question was posed to me in a national level competition.My question is taken from Maven Surefire topic in division Running JUnit Tests from Maven2 of JUnit

Answer»

Correct CHOICE is (c) Isolate

Best explanation: Stubbing a servlet CONTAINER ALLOWS us to TRACK how many requests were made, what the state of the server is, or what URL s where REQUESTED.

26.

____________ 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.scriptThis question was addressed to me in a job interview.I want to ask this question from Setting Up a Maven Project in portion Running JUnit Tests from Maven2 of JUnit

Answer»

Correct choice is (B) org.jmock.lib.action

To EXPLAIN I would SAY: org.jmock.lib.action CONTAINS actions that fake the behavior of mocked invocations.

27.

____________ 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)This question was posed to me by my college professor while I was bunking the class.My question comes from Setting Up a Maven Project topic in section Running JUnit Tests from Maven2 of JUnit

Answer»

The correct CHOICE is (d) where(String name, Object value)

The best EXPLANATION: The where() FUNCTION returns the ACTION, so that more variables can be DEFINED if needed.

28.

________ method reports if the Imposteriser is able to imposterise a given type.(a) canImposterise(Class type)(b) Imposterise(Class type)(c) imposterise(Invokable mockObject, Class mockedType, Class… ancilliaryTypes)(d) imposter()This question was addressed to me during an interview.Enquiry is from Maven Introduction topic in chapter Running JUnit Tests from Maven2 of JUnit

Answer»

Right answer is (a) canImposterise(Class> type)

The EXPLANATION: canImposterise(Class> type) RETURNS true if this IMPOSTERISER can imposterise type, false otherwise.

29.

____________ is the interface to a class to get a property in apache ant.(a) ParseNextProperty(b) PropertyExpander(c) GetProperty(d) LocalPropertiesThe question was asked during an online exam.My question comes from Maven Downsides topic in division Running JUnit Tests from Maven2 of JUnit

Answer»

The correct option is (C) GETPROPERTY

The EXPLANATION: The GetProperty interface is NORMALLY the interface to the PropertyHelper class.

30.

The mockObject parameter of imposterise() is the class representing the static type of the imposter.(a) True(b) FalseI had been asked this question in an online quiz.My question is taken from Maven Introduction topic in section Running JUnit Tests from Maven2 of JUnit

Answer»

Correct option is (b) False

The EXPLANATION is: The mockType PARAMETER of imposterise() is the CLASS representing the static TYPE of the imposter.

31.

___________ contains helper classes for ant properties.(a) org.apache.tools.ant.property(b) org.apache.tools.ant.types(c) org.apache.tools.ant.util(d) org.apache.tools.ant.taskdefsI had been asked this question during an online interview.This interesting question is from Maven Downsides topic in section Running JUnit Tests from Maven2 of JUnit

Answer»

The CORRECT ANSWER is (a) org.apache.tools.ant.property

The best I can explain: The package org.apache.tools.ant.property of apache ant CONTAINS helper CLASSES for ant properties.

32.

A __________ offers services for the components it’s hosting, such as lifecycle, security, transaction, distribution, and so forth.(a) Component(b) Container(c) Mock(d) AppraisalThis question was posed to me in a national level competition.My question is from Maven Surefire topic in division Running JUnit Tests from Maven2 of JUnit

Answer»

The correct answer is (B) CONTAINER

To EXPLAIN: A component executes in a container.

33.

The exception thrown by the ActionSequence mehod is _____________(a) NullPointer(b) Throwable(c) ArrayIndexOutOfBounds(d) ArithmeticI had been asked this question in an interview for internship.My question comes from Setting Up a Maven Project in section Running JUnit Tests from Maven2 of JUnit

Answer»

The correct ANSWER is (b) Throwable

For explanation: Any checked exception thrown MUST be in the throws LIST of the invoked method.

34.

_____________ performs multiple actions every time it is invoked.(a) ActionSequence(b) CustomAction(c) DoAllAction(d) ReturnValueActionI got this question in an international level competition.This question is from Setting Up a Maven Project in division Running JUnit Tests from Maven2 of JUnit

Answer» RIGHT answer is (C) DOALLACTION

Explanation: The DoAllAction class implements the Action INTERFACE.
35.

_____________ class enables to imposterise abstract and concrete classes without calling the constructors of the mocked class.(a) ClassImposteriser(b) Imposteriser(c) ImposterisingClass(d) ImposterI got this question in a national level competition.My enquiry is from Maven Introduction topic in division Running JUnit Tests from Maven2 of JUnit

Answer» CORRECT option is (a) ClassImposteriser

To elaborate: The ClassImposteriser IMPLEMENTS IMPOSTERISER interface.
36.

__________ is an ExpectationErrorTranslator that doesn’t do any translation.(a) AssertionErrorTranslator(b) CamelCaseNamingScheme(c) CurrentStateMatcher(d) IdentityExpectationErrorTranslatorThis question was addressed to me at a job interview.I want to ask this question from Maven Plug-ins in portion Running JUnit Tests from Maven2 of JUnit

Answer» CORRECT ANSWER is (d) IdentityExpectationErrorTranslator

To EXPLAIN: IdentityExpectationErrorTranslator returns the ExpectationError it is GIVEN.
37.

___________ is a naming scheme in which the implicit name for a mock object is the last word of the mocked type’s name in lower case.(a) AssertionErrorTranslator(b) CamelCaseNamingScheme(c) JavaReflectionImposteriser(d) LastWordNamingSchemeI have been asked this question during an interview.Origin of the question is Maven Plug-ins in section Running JUnit Tests from Maven2 of JUnit

Answer»

Right option is (d) LASTWORDNAMINGSCHEME

The explanation: The LastWordNamingScheme class defines a NAMING SCHEME for MOCK objects.

38.

To write a mock object test in JUnit 3, MockObject needs to be extended.(a) True(b) FalseThis question was posed to me in a job interview.My question comes from Maven Surefire topic in portion Running JUnit Tests from Maven2 of JUnit

Answer»

Right answer is (B) False

Easiest EXPLANATION: To write a MOCK object test in JUnit 3, MockObjectTestCase NEEDS to be EXTENDED.

39.

____________ is a TestCase that verifies postconditions after the test has run and before the fixture has been torn down.(a) JUnit3ErrorTranslator(b) JUnit3Mockery(c) MockObjectTestCase(d) VerifyingTestCaseI got this question during a job interview.Question is taken from Maven Surefire in chapter Running JUnit Tests from Maven2 of JUnit

Answer»

Correct ANSWER is (a) JUnit3ErrorTranslator

Explanation: VERIFYINGTESTCASE is a class that VERIFIES post CONDITIONS.

40.

_____________ returns the next of a sequence of elements each time it is invoked.(a) ActionSequence(b) CustomAction(c) DoAllAction(d) ReturnValueActionThe question was asked in semester exam.This is a very interesting question from Setting Up a Maven Project in portion Running JUnit Tests from Maven2 of JUnit

Answer»

Right CHOICE is (a) ActionSequence

Explanation: The ActionSequence methods TAKES as a parameter the INVOCATION to PERFORM.

41.

___________ creates an imposter for a given type that forwards Invocations to an Invokable object.(a) canImposterise(Class type)(b) Imposterise(Class type)(c) imposterise(Invokable mockObject, Class mockedType, Class… ancilliaryTypes)(d) imposter()The question was posed to me in an internship interview.I need to ask this question from Maven Introduction topic in section Running JUnit Tests from Maven2 of JUnit

Answer»

Correct option is (C) imposterise(Invokable mockObject, Class mockedType, Class>… ancilliaryTypes)

For explanation I would SAY: imposterise(Invokable mockObject, Class mockedType, Class>… ancilliaryTypes) returns a new IMPOSTER. The imposter must IMPLEMENT the mockedType and all the ancialliaryTypes.

42.

__________ is a naming scheme in which the implicit name for a mock object is the mocked type’s name prepend with “mock”.(a) RetroNamingScheme(b) CamelCaseNamingScheme(c) JavaReflectionImposteriser(d) LastWordNamingSchemeThis question was posed to me by my college director while I was bunking the class.Asked question is from Maven Plug-ins in chapter Running JUnit Tests from Maven2 of JUnit

Answer» CORRECT CHOICE is (a) RetroNamingScheme

Explanation: The RetroNamingScheme CLASS defines a naming SCHEME with the PREFIX of “mock” for mock objects.
43.

___________ is the class to resolve properties in a map.(a) LocalPropertyStack(b) ResolvePropertyMap(c) NullReturn(d) ParsePropertiesThis question was posed to me in semester exam.The question is from Maven Downsides topic in section Running JUnit Tests from Maven2 of JUnit

Answer»

Correct OPTION is (B) RESOLVEPROPERTYMAP

To explain I would say: The ResolvePropertyMap class is used to resolve properties in a map.