Sail E0 Webinar

MCQs

Total Questions : 10
Question 1. The ____________ interface is used in the creation of partial mocks with EasyMock.
  1.    IMockBuilder
  2.    IMocker
  3.    IBuilder
  4.    MockBuilder
 Discuss Question
Answer: Option A. -> IMockBuilder


The MockBuilder class implements the ImockBuilder interface.


Question 2. _____________ exception is thrown while invokeAll() is interrupted while waiting.
  1.    InterruptedException
  2.    NullPointerException
  3.    RejectedExecutionException
  4.    ArrayIndexOutOfBoundsException
 Discuss Question
Answer: Option A. -> InterruptedException


If the exception is thrown, the unfinished tasks are cancelled.


Question 3. EasyMock relies heavily on the __________import feature of Java.
  1.    Dynamic
  2.    Static
  3.    Class
  4.    Object
 Discuss Question
Answer: Option B. -> Static


All EasyMock imports are static imports.


Question 4. ______________ create a new capture instance that will keep only the last captured value.
  1.    newCapture()
  2.    makeThreadSafe()
  3.    createNiceControl()
  4.    createNiceMock(Class toMock)
 Discuss Question
Answer: Option A. -> newCapture()


The newCapture method without arguments creates a new capture.


Question 5. __________________ 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.
  1.    createMock(Class toMock)
  2.    createMock(MockType type, Class toMock)
  3.    createMock(String name, Class toMock)
  4.    createMock(String name, MockType type, Class toMock)
 Discuss Question
Answer: Option D. -> createMock(String name, MockType type, Class toMock)


The name is passed as a parameter in the function definition.


Question 6. _______________ is used for the execution of the given tasks, returning a list of Futures holding their status and results after completion.
  1.    isShutdown
  2.    isTerminated
  3.    invokeAll(Collection? extends Callable tasks)
  4.    invokeAll(Collection extends Callable tasks, long timeout, TimeUnit unit)
 Discuss Question
Answer: Option C. -> invokeAll(Collection? extends Callable tasks)


Future.isDone() is true for each element of the returned list.


Question 7. _____________ expects the last invocation once.
  1.    andVoid()
  2.    times(int min, int max)
  3.    once()
  4.    asStub()
 Discuss Question
Answer: Option C. -> once()


This is the default in EasyMock.


Question 8. Other than RejectedExecutionException, the execute(Runnable command) function can also throw which exception?
  1.    Arithmetic
  2.    ArrayIndexOutOfBounds
  3.    StringIndexOutOfBounds
  4.    NullPointerException
 Discuss Question
Answer: Option D. -> NullPointerException


This exception is thrown if the command passed as argument is null.


Question 9. __________ class is an Executor that executes commands on the thread that calls runPendingCommands or runUntilIdle.
  1.    Blitzer
  2.    DeterministicExecutor
  3.    DeterministicScheduler
  4.    Synchroniser
 Discuss Question
Answer: Option B. -> DeterministicExecutor


The DeterministicExecutor executes commands on the thread calling runPendingCommands.


Question 10. ____________ expect the last invocation a specified number of times.
  1.    times(int count)
  2.    times(int min, int max)
  3.    once()
  4.    asStub()
 Discuss Question
Answer: Option A. -> times(int count)


times (int count) specifies the number of times to expect the last invocation via the count argument.


Latest Videos

Latest Test Papers