Easy Mock Quiz – Easy Mock Multiple Choice Questions and Answers: Here we are to help you out to check your skill in the EasyMock. In order to know how much enough knowledge you have, to crack any technical interview, we have furnished this page with EasyMock Online Quiz. Whereas, all the provided EasyMock Multiple Choice Questions and Answers here are the most commonly asked interview questions. To know your result status of the EasyMock Online Test, you were needed to click on the submit button once you completed answering all the questions. Moreover, we suggest you not to miss this EasyMock MCQ Test as in turn, you will get the essentials you were needed to have to appear for the interview.
EasyMock Quiz – Details
Quiz Name | EasyMock |
Exam Type | MCQ (Multiple Choice Questions) |
Category | Technical Quiz |
Mode of Quiz | Online |
EasyMock Online MCQ Test
What is EasyMock?
A) A framework to mock objects in Java
B) A tool to test the performance of websites
C) A programming language
D) A software to manage databases
Answer: A
Explanation: EasyMock is a Java-based framework used for mocking objects in unit testing. It is used to simulate behavior of objects that a module under test depends on, which helps to isolate the module and test its functionality in isolation.
Which of the following annotations is used to indicate a test method in EasyMock?
A) @Test
B) @Mock
C) @Expect
D) @Verify
Answer: A
Explanation: The @Test annotation is used in EasyMock to indicate a test method. This annotation is used to identify the methods that should be executed as part of the test suite.
Which of the following statements is true about EasyMock?
A) EasyMock can only be used for unit testing
B) EasyMock is used to test the UI of an application
C) EasyMock can be used to test both unit and integration testing
D) EasyMock is used to test the performance of an application
Answer: C
Explanation: EasyMock can be used for both unit testing and integration testing. It can be used to simulate behavior of objects that a module under test depends on, which helps to isolate the module and test its functionality in isolation.
Which of the following methods is used to create a mock object in EasyMock?
A) createMock()
B) expect()
C) replay()
D) verify()
Answer: A
Explanation: The createMock() method is used to create a mock object in EasyMock. This method creates a mock object of a particular class or interface, which can be used to simulate behavior of the actual object during testing.
Which of the following methods is used to set the behavior of a mock object in EasyMock?
A) createMock()
B) expect()
C) replay()
D) verify()
Answer: B
Explanation: The expect() method is used to set the behavior of a mock object in EasyMock. This method specifies the expected behavior of the mock object when certain methods are called during testing.
Which of the following methods is used to replay the mock object in EasyMock?
A) createMock()
B) expect()
C) replay()
D) verify()
Answer: C
Explanation: The replay() method is used to replay the mock object in EasyMock. This method switches the mock object to replay mode, which allows the mocked methods to be called during testing.
Which of the following methods is used to verify the mock object in EasyMock?
A) createMock()
B) expect()
C) replay()
D) verify()
Answer: D
Explanation: The verify() method is used to verify the mock object in EasyMock. This method checks that all the expected behavior of the mock object has been executed during testing.
Which of the following statements is true about EasyMock expectations?
A) Expectations are optional in EasyMock
B) Expectations are required in EasyMock
C) Expectations are used to define the behavior of a mock object in EasyMock
D) Expectations are used to create a mock object in EasyMock
Answer: C
Explanation: Expectations are used to define the behavior of a mock object in EasyMock. They are used to specify the expected behavior of a mock object when certain methods are called during testing.
Which of the following statements is true about EasyMock stubs?
A) Stubs are used to define the behavior of a mock object in EasyMock
B) Stubs are required in EasyMock
C) Stubs are used to create a mock object in Easy Mock
D) Stubs are used to specify the expected behavior of a mock object during testing
Answer: D
Explanation: Stubs are used to specify the expected behavior of a mock object during testing. They are used to provide return values for methods called on the mock object, which allows the module under test to continue execution during testing.
Which of the following statements is true about EasyMock matchers?
A) Matchers are used to define the behavior of a mock object in EasyMock
B) Matchers are required in EasyMock
C) Matchers are used to create a mock object in EasyMock
D) Matchers are used to specify the expected arguments of a method call during testing
Answer: D
Explanation: Matchers are used to specify the expected arguments of a method call during testing. They are used to match the arguments of a method call on a mock object to ensure that the correct behavior is executed during testing.
Which of the following methods is used to specify the return value of a mocked method in EasyMock?
A) andReturn()
B) expect()
C) replay()
D) verify()
Answer: A
Explanation: The andReturn() method is used to specify the return value of a mocked method in EasyMock. This method is used in conjunction with the expect() method to specify the expected behavior of a mocked method during testing.
Which of the following methods is used to specify an exception to be thrown by a mocked method in EasyMock?
A) andThrow()
B) expect()
C) replay()
D) verify()
Answer: A
Explanation: The andThrow() method is used to specify an exception to be thrown by a mocked method in EasyMock. This method is used in conjunction with the expect() method to specify the expected behavior of a mocked method during testing.
Which of the following methods is used to specify a timeout for a mocked method in EasyMock?
A) andTimeout()
B) expect()
C) replay()
D) verify()
Answer: A
Explanation: The andTimeout() method is used to specify a timeout for a mocked method in EasyMock. This method is used in conjunction with the expect() method to specify the expected behavior of a mocked method during testing.
Which of the following methods is used to specify the number of times a mocked method should be called in EasyMock?
A) times()
B) expect()
C) replay()
D) verify()
Answer: A
Explanation: The times() method is used to specify the number of times a mocked method should be called in EasyMock. This method is used in conjunction with the expect() method to specify the expected behavior of a mocked method during testing.
Which of the following statements is true about EasyMock’s behavior when an unexpected method call is made on a mock object?
A) EasyMock throws an exception by default
B) EasyMock returns null by default
C) EasyMock returns a default value by default
D) EasyMock executes the actual method by default
Answer: A
Explanation: EasyMock throws an exception by default when an unexpected method call is made on a mock object. This behavior can be changed by setting a different default behavior for the mock object.
Which of the following statements is true about EasyMock’s behavior when a mocked method is called with incorrect arguments?
A) EasyMock throws an exception by default
B) EasyMock returns null by default
C) EasyMock returns a default value by default
D) EasyMock executes the actual method by default
Answer: A
Explanation: EasyMock throws an exception by default when a mocked method is called with incorrect arguments. This behavior can be changed by specifying a different behavior using matchers.
Which of the following statements is true about Easy Mock’s support for partial mocking?
A) EasyMock does not support partial mocking
B) EasyMock only supports partial mocking for interfaces
C) EasyMock only supports partial mocking for classes
D) EasyMock supports partial mocking for both interfaces and classes
Answer: D
Explanation: EasyMock supports partial mocking for both interfaces and classes. Partial mocking allows you to mock only certain methods of a class or interface, while allowing other methods to execute normally.
Which of the following statements is true about EasyMock’s support for mocking static methods?
A) EasyMock does not support mocking static methods
B) EasyMock supports mocking static methods using the PowerMock extension
C) EasyMock supports mocking static methods using the Mockito extension
D) EasyMock supports mocking static methods out of the box
Answer: B
Explanation: EasyMock does not support mocking static methods out of the box. However, it can be done using the PowerMock extension, which provides additional functionality for mocking static methods.
Which of the following statements is true about EasyMock’s support for mocking private methods?
A) EasyMock does not support mocking private methods
B) EasyMock supports mocking private methods using the PowerMock extension
C) EasyMock supports mocking private methods using the Mockito extension
D) EasyMock supports mocking private methods out of the box
Answer: B
Explanation: EasyMock does not support mocking private methods out of the box. However, it can be done using the PowerMock extension, which provides additional functionality for mocking private methods.
Which of the following statements is true about EasyMock’s support for mocking final classes?
A) EasyMock does not support mocking final classes
B) EasyMock supports mocking final classes using the PowerMock extension
C) EasyMock supports mocking final classes using the Mockito extension
D) EasyMock supports mocking final classes out of the box
Answer: B
Explanation: EasyMock does not support mocking final classes out of the box. However, it can be done using the PowerMock extension, which provides additional functionality for mocking final classes.
Do follow us @ freshersnow.com on a regular basis to take up more technical quizzes like EasyMock Online Quiz Test.