InterviewSolution
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. |
____________ expect the last invocation a specified number of times.(a) times(int count)(b) times(int min, int max)(c) once()(d) asStub()The question was posed to me by my college professor while I was bunking the class.The query is from Putting Ant to The Task topic in chapter Running JUnit Tests from Ant of JUnit |
|
Answer» The CORRECT choice is (a) times(int COUNT) |
|
| 2. |
______________ integrates jMock with JUnit 3.(a) org.jmock(b) org.jmock.api(c) org.jmock.lib(d) org.jmock.integration.junit3I had been asked this question during an interview.I need to ask this question from Dependency Management with Ivy topic in division Running JUnit Tests from Ant of JUnit |
|
Answer» The correct choice is (d) org.jmock.integration.junit3 |
|
| 3. |
______________ sets stub behavior for the expected invocation.(a) andStubReturn(T value)(b) andThrow(Throwable throwable)(c) anyTimes()(d) asStub()This question was addressed to me in a national level competition.My question is based upon Putting Ant to The Task topic in chapter Running JUnit Tests from Ant of JUnit |
|
Answer» The CORRECT option is (d) asStub() |
|
| 4. |
____________ returns whether this executor is idle.(a) runUntilIdle(b) runPendingCommands(c) execute(d) isIdleThe question was posed to me by my school teacher while I was bunking the class.My question is based upon Creating HTML Reports in chapter Running JUnit Tests from Ant of JUnit |
|
Answer» RIGHT ANSWER is (d) isIdle The BEST I can explain: isIdle() function checks that there are no pending background tasks waiting to be RUN. |
|
| 5. |
______________ runs all commands that are currently pending.(a) runUntilIdle(b) runPendingCommands(c) execute(d) isIdleThis question was posed to me in an interview.The query is from Creating HTML Reports in chapter Running JUnit Tests from Ant of JUnit |
|
Answer» Correct answer is (b) runPendingCommands |
|
| 6. |
_____________ expects the last invocation once.(a) andVoid()(b) times(int min, int max)(c) once()(d) asStub()I got this question in unit test.I want to ask this question from Putting Ant to The Task in portion Running JUnit Tests from Ant of JUnit |
|
Answer» CORRECT OPTION is (c) once() Easiest explanation: This is the DEFAULT in EASYMOCK. |
|
| 7. |
NullPointerException is thrown if tasks or any of its elements are null.(a) True(b) FalseThis question was posed to me in unit test.My question is based upon Batching Tests in section Running JUnit Tests from Ant of JUnit |
|
Answer» Correct ANSWER is (a) True |
|
| 8. |
_____________ returns the expectation setter for the last expected invocation in the current thread.(a) createControl()(b) createControl(MockType type)(c) createNiceControl()(d) expect(T value)The question was posed to me in unit test.My doubt is from Ant Targets, Projects, Properties and Tasks topic in division Running JUnit Tests from Ant of JUnit |
|
Answer» CORRECT answer is (d) expect(T VALUE) The EXPLANATION: The PARAMETER value is used to transport the type to the ExpectationSetter. |
|
| 9. |
________________ creates a mock builder allowing to create a partial mock for the given class or interface.(a) createMockBuilder(Class toMock)(b) createMock(Class toMock)(c) createNiceControl()(d) createNiceMock(Class toMock)I got this question in my homework.I would like to ask this question from Ant Targets, Projects, Properties and Tasks in portion Running JUnit Tests from Ant of JUnit |
|
Answer» The CORRECT answer is (a) createMockBuilder(Class |
|
| 10. |
To use the createMock method of EasyMock we need to import ___________(a) org.easymock.EasyMock.createMock(b) org.EasyMock.createMock(c) org.easymock.createMock(d) org.createMockThe question was posed to me during an interview.My question is based upon Ant topic in section Running JUnit Tests from Ant of JUnit |
|
Answer» Correct option is (a) org.EASYMOCK.EasyMock.createMock |
|
| 11. |
____________ runs executed commands until there are no commands pending execution.(a) runUntilIdle(b) runPendingCommands(c) execute(d) isIdleThe question was posed to me by my school principal while I was bunking the class.My doubt stems from Creating HTML Reports topic in chapter Running JUnit Tests from Ant of JUnit |
|
Answer» The CORRECT ANSWER is (a) runUntilIdle |
|
| 12. |
The _____________ exception can be thrown by the execute(Runnable command) function.(a) Arithmetic(b) ArrayIndexOutOfBounds(c) StringIndexOutOfBounds(d) RejectedExecutionExceptionThe question was asked in an interview for internship.Query is from Creating HTML Reports topic in division Running JUnit Tests from Ant of JUnit |
|
Answer» The correct answer is (d) REJECTEDEXECUTIONEXCEPTION |
|
| 13. |
_______________ sets a stub object implementing the same interface as the mock.(a) andAnswer(IAnswer |
|
Answer» Right ANSWER is (d) andStubDelegateTo(OBJECT delegateTo) |
|
| 14. |
_______________ expect the last invocation between min and max times.(a) times(int count)(b) times(int min, int max)(c) once()(d) asStub()The question was posed to me in quiz.This question is from Putting Ant to The Task topic in division Running JUnit Tests from Ant of JUnit |
|
Answer» CORRECT answer is (b) times(int min, int max) The explanation is: The max and min values are passed as ARGUMENTS in the FUNCTION definition times(int min, int max). |
|
| 15. |
__________________ creates a mock object, of the requested type and name which are passed, which also has implementations of the given interface or extends the given class.(a) createMock(Class toMock)(b) createMock(MockType type, Class toMock)(c) createMock(String name, Class toMock)(d) createMock(String name, MockType type, Class toMock)This question was addressed to me in my homework.Question is from Ant topic in division Running JUnit Tests from Ant of JUnit |
|
Answer» RIGHT option is (d) createMock(String name, MockType type, Class To explain I would say: The name is PASSED as a parameter in the FUNCTION definition. |
|
| 16. |
When we’re talking about mock objects, a/an _________ is a feature built into the mock that verifies whether the external class calling this mock has the correct behavior.(a) Expectation(b) Explanation(c) Behavior(d) AmorousThe question was asked during an online interview.I'm obligated to ask this question of Ant in section Running JUnit Tests from Ant of JUnit |
|
Answer» The correct OPTION is (a) Expectation |
|
| 17. |
______________ is a class that “blitzes” an object by calling it many times, from multiple threads.(a) Blitzer(b) DeterministicExecutor(c) DeterministicScheduler(d) SynchroniserThe question was asked in exam.The origin of the question is Dependency Management with Ivy in chapter Running JUnit Tests from Ant of JUnit |
|
Answer» The correct CHOICE is (a) BLITZER |
|
| 18. |
Mocks are Trojan horses because they replace real ___________ from the inside, without the calling classes being aware of it.(a) Methods(b) Objects(c) Variables(d) ClassesThis question was posed to me in exam.This interesting question is from Ant in section Running JUnit Tests from Ant of JUnit |
|
Answer» The correct CHOICE is (b) Objects |
|
| 19. |
______________ executes the given tasks, returning the result of one that has completed successfully.(a) isShutdown(b) invokeAny(Collection |
|
Answer» The correct answer is (b) invokeAny(Collection extends Callable |
|
| 20. |
____________ submits a Runnable task for execution and returns a Future representing that task.(a) submit(Callable task)(b) awaitTermination(c) submit(Runnable task, T result)(d) invokeAll()This question was posed to me by my college director while I was bunking the class.This intriguing question comes from Batching Tests in portion Running JUnit Tests from Ant of JUnit |
|
Answer» Right OPTION is (C) submit(Runnable task, T RESULT) |
|
| 21. |
When a call to tick returns, the executor will be idle.(a) True(b) FalseThis question was addressed to me by my college professor while I was bunking the class.My enquiry is from Creating HTML Reports in chapter Running JUnit Tests from Ant of JUnit |
|
Answer» The CORRECT option is (a) True |
|
| 22. |
InterruptedException is thrownif any task cannot be scheduled for execution.(a) True(b) FalseI got this question in an interview.This key question is from Batching Tests in division Running JUnit Tests from Ant of JUnit |
|
Answer» The correct CHOICE is (b) False |
|
| 23. |
_____________ exception is thrown while invokeAll() is interrupted while waiting.(a) InterruptedException(b) NullPointerException(c) RejectedExecutionException(d) ArrayIndexOutOfBoundsExceptionThis question was posed to me at a job interview.Query is from Batching Tests topic in section Running JUnit Tests from Ant of JUnit |
|
Answer» Right choice is (a) InterruptedException |
|
| 24. |
_____________ function expect the last invocation any times.(a) andStubReturn(T value)(b) andThrow(Throwable throwable)(c) anyTimes()(d) asStub()I have been asked this question during an online exam.I want to ask this question from Putting Ant to The Task in division Running JUnit Tests from Ant of JUnit |
|
Answer» Right ANSWER is (c) anyTimes() |
|
| 25. |
__________ method creates a mock object that implements the given interface, order checking is enabled by default.(a) createNiceControl(b) createMockBuilder(c) createNiceMock(d) createStrictMockThis question was addressed to me in an internship interview.Origin of the question is Ant topic in chapter Running JUnit Tests from Ant of JUnit |
|
Answer» The correct CHOICE is (d) CREATESTRICTMOCK |
|
| 26. |
________________ contains classes to help test concurrent code with jMock.(a) org.jmock.concurrent(b) org.jmock.syntax(c) org.jmock.lib(d) org.jmock.integration.junit3This question was posed to me in examination.My question is based upon Dependency Management with Ivy topic in portion Running JUnit Tests from Ant of JUnit |
|
Answer» Right ANSWER is (a) org.jmock.concurrent |
|
| 27. |
_______________ is used for the execution of the given tasks, returning a list of Futures holding their status and results after completion.(a) isShutdown(b) isTerminated(c) invokeAll(Collection |
|
Answer» Right option is (C) invokeAll(Collection extends Callable |
|
| 28. |
____________ runs time forwards by a given duration, executing any commands scheduled for execution during that time period.(a) runUntilIdle(b) runPendingCommands(c) tick(d) isIdleThe question was asked in quiz.The query is from Creating HTML Reports topic in section Running JUnit Tests from Ant of JUnit |
|
Answer» The correct option is (C) TICK |
|
| 29. |
The __________ interface allows setting expectations for an associated expected invocation.(a) IMocksControl(b) IExpectationSetters(c) IExpectation(d) IsettersI got this question during an online interview.Question is from Putting Ant to The Task in section Running JUnit Tests from Ant of JUnit |
|
Answer» Correct option is (b) IExpectationSetters |
|
| 30. |
The ____________ interface is used in the creation of partial mocks with EasyMock.(a) IMockBuilder(b) IMocker(c) IBuilderexpect(T value)(d) MockBuilderThis question was posed to me in a national level competition.My doubt stems from Ant Targets, Projects, Properties and Tasks topic in chapter Running JUnit Tests from Ant of JUnit |
|
Answer» RIGHT OPTION is (a) IMockBuilder The explanation: The MockBuilder CLASS IMPLEMENTS the ImockBuilder |
|
| 31. |
_____________ reports an argument matcher.(a) newCapture()(b) makeThreadSafe()(c) reportMatcher(IArgumentMatcher matcher)(d) createNiceMock(Class toMock)I got this question in homework.Query is from Ant Targets, Projects, Properties and Tasks topic in portion Running JUnit Tests from Ant of JUnit |
|
Answer» CORRECT ANSWER is (c) reportMatcher(IArgumentMatcher MATCHER) For explanation I would SAY: The reportMatcher method is USED to report an argument matcher. |
|
| 32. |
___________ is used for the creation of a mock object, with the specification of it being of the requested type, which has implementations of the given interface or extends the given class.(a) createMock(Class toMock)(b) createMock(MockType type, Class toMock)(c) createMock(String name, ClasstoMock)(d) createMock(String name, MockType type, ClasstoMock)The question was asked in an internship interview.This intriguing question comes from Ant in division Running JUnit Tests from Ant of JUnit |
|
Answer» Correct choice is (b) createMock(MockType type, CLASS |
|
| 33. |
Other than RejectedExecutionException, the execute(Runnable command) function can also throw which exception?(a) Arithmetic(b) ArrayIndexOutOfBounds(c) StringIndexOutOfBounds(d) NullPointerExceptionI got this question during an interview.This key question is from Creating HTML Reports in chapter Running JUnit Tests from Ant of JUnit |
|
Answer» Right answer is (d) NullPointerException |
|
| 34. |
_____________ sets a stub object that will be used for the calculation of the answer for the expected invocation.(a) andAnswer(IAnswer |
|
Answer» Right CHOICE is (c) andStubAnswer(IANSWER extends T> ANSWER) |
|
| 35. |
______________ is a ScheduledExecutorService that executes commands on the thread that calls runNextPendingCommand, runUntilIdle or tick.(a) Blitzer(b) DeterministicExecutor(c) DeterministicScheduler(d) SynchroniserThe question was posed to me by my school principal while I was bunking the class.This key question is from Dependency Management with Ivy in portion Running JUnit Tests from Ant of JUnit |
|
Answer» Right ANSWER is (a) Blitzer |
|
| 36. |
______________ create a new capture instance that will keep only the last captured value.(a) newCapture()(b) makeThreadSafe()(c) createNiceControl()(d) createNiceMock(Class toMock)This question was addressed to me by my college professor while I was bunking the class.I want to ask this question from Ant Targets, Projects, Properties and Tasks in portion Running JUnit Tests from Ant of JUnit |
|
Answer» CORRECT answer is (a) newCapture() Explanation: The newCapture method without ARGUMENTS creates a new CAPTURE. |
|
| 37. |
anyObject() expects any double argument.(a) True(b) FalseThis question was posed to me in a national level competition.Asked question is from Ant Targets, Projects, Properties and Tasks in division Running JUnit Tests from Ant of JUnit |
|
Answer» Right ANSWER is (b) False |
|
| 38. |
_____________ returns true if all tasks have completed following shut down.(a) submit(Callable task)(b) isTerminated(c) submit(Runnable task, T result)(d) invokeAll()The question was asked in final exam.Asked question is from Batching Tests topic in section Running JUnit Tests from Ant of JUnit |
|
Answer» The correct answer is (B) isTerminated |
|
| 39. |
________ submits a value-returning task for execution and returns a Future representing the pending results of the task.(a) submit(Callable task)(b) awaitTermination(c) submit(Runnable task, T result)(d) invokeAll()I have been asked this question in an online interview.My question comes from Batching Tests topic in portion Running JUnit Tests from Ant of JUnit |
|
Answer» Correct option is (a) submit(Callable |
|
| 40. |
The Executor implementations provided implement ____________ which is a more extensive interface.(a) ExecutorService(b) ThreadPoolExecutor(c) ArrayDeque(d) SerialExecutorI have been asked this question in an international level competition.My query is from Creating HTML Reports topic in portion Running JUnit Tests from Ant of JUnit |
|
Answer» The CORRECT choice is (a) ExecutorService |
|
| 41. |
_____________ expects a comparable argument greater than or equal the given value.(a) anyObject()(b) anyString()(c) geq(Comparable value)(d) anyDouble()This question was addressed to me during an online exam.The question is from Ant Targets, Projects, Properties and Tasks topic in chapter Running JUnit Tests from Ant of JUnit |
|
Answer» The correct choice is (c) GEQ(COMPARABLE |
|
| 42. |
______________ creates a mock object that implements the given interface with the specification is that order checking is disabled by default.(a) createMock(Class toMock)(b) createMock(MockType type, ClasstoMock)(c) createMock(String name, Class toMock)(d) createMock(String name, MockType type, Class toMock)The question was asked in exam.Asked question is from Ant topic in portion Running JUnit Tests from Ant of JUnit |
|
Answer» CORRECT option is (c) createMock(STRING NAME, Class Easiest EXPLANATION: The type PARAMETER is the interface that the mock object should implement. |
|
| 43. |
The __________ command executes the given command at some time in the future.(a) Execution()(b) execute(Runnable command)(c) scheduleNext()(d) poll()The question was posed to me during an internship interview.My query is from Creating HTML Reports topic in chapter Running JUnit Tests from Ant of JUnit |
|
Answer» Correct option is (B) EXECUTE(Runnable command) |
|
| 44. |
EasyMock instantiates an object based on an interface or class.(a) True(b) FalseThis question was addressed to me in examination.This question is from Ant in chapter Running JUnit Tests from Ant of JUnit |
|
Answer» Correct CHOICE is (a) True |
|
| 45. |
____________ creates a control of the requested type.(a) createControl()(b) createControl(MockType type)(c) createNiceControl()(d) createNiceMock(Class toMock)I have been asked this question by my school principal while I was bunking the class.This key question is from Ant Targets, Projects, Properties and Tasks topic in chapter Running JUnit Tests from Ant of JUnit |
|
Answer» CORRECT answer is (B) createControl(MockType type) Explanation: createControl(MockType type) RETURNS an ImocksControl OBJECT. |
|
| 46. |
__________ class is an Executor that executes commands on the thread that calls runPendingCommands or runUntilIdle.(a) Blitzer(b) DeterministicExecutor(c) DeterministicScheduler(d) SynchroniserI have been asked this question during an interview.Query is from Dependency Management with Ivy topic in chapter Running JUnit Tests from Ant of JUnit |
|
Answer» Correct answer is (B) DeterministicExecutor |
|
| 47. |
_______________ contains implementations of the core interfaces that are used to adjust or extend jMock’s basic functionality.(a) org.jmock(b) org.jmock.api(c) org.jmock.lib(d) org.jmock.integration.junit3The question was asked in a national level competition.My query is from Dependency Management with Ivy topic in section Running JUnit Tests from Ant of JUnit |
|
Answer» CORRECT answer is (C) org.jmock.lib Explanation: The org.jmock.lib PACKAGE contains IMPLEMENTATIONS of the core interfaces. |
|
| 48. |
_____________ records a call but returns nothing.(a) andVoid()(b) times(int min, int max)(c) once()(d) asStub()I have been asked this question in an internship interview.My enquiry is from Putting Ant to The Task in section Running JUnit Tests from Ant of JUnit |
|
Answer» Right OPTION is (a) andVoid() |
|
| 49. |
By default, a mock is thread safe.(a) True(b) FalseThe question was posed to me in class test.This intriguing question comes from Ant Targets, Projects, Properties and Tasks topic in section Running JUnit Tests from Ant of JUnit |
|
Answer» Correct ANSWER is (a) True |
|
| 50. |
____________ Exception is thrown to report that a DeterministicScheduler has been asked to perform a blocking wait, which is not supported.(a) UnsupportedSynchronousOperationException(b) ArrayIndexOutOfBounds(c) StringIndexoutOfBounds(d) ArithmeticI got this question in exam.This is a very interesting question from Dependency Management with Ivy topic in division Running JUnit Tests from Ant of JUnit |
|
Answer» The correct choice is (a) UNSUPPORTEDSYNCHRONOUSOPERATIONEXCEPTION |
|