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. |
___________ traverses the meaning of the contained matchers.(a) not(b) or(c) allOf(d) andAllI got this question in a national level competition.This interesting question is from Hamcrest Matchers topic in section Mastering JUnit of JUnit |
|
Answer» Right choice is (a) not |
|
| 2. |
______ is used only to improve the readability of the statements.(a) anything(b) is(c) sameInstance(d) nullValueThis question was addressed to me in an interview.My question is taken from Hamcrest Matchers in portion Mastering JUnit of JUnit |
|
Answer» Right CHOICE is (B) is |
|
| 3. |
With the ‘expected’ argument, one cannot ___________(a) Test a method(b) Test for exception type(c) Test the value of the message in the exception(d) Test for specific exceptionI have been asked this question in exam.This interesting question is from Testing Exception Handling in section Mastering JUnit of JUnit |
|
Answer» Right CHOICE is (C) TEST the value of the message in the exception |
|
| 4. |
The _________ is a sequential or non-iterative design process, which is used in software development processes, in which progress is seen as flowing steadily downwards.(a) Waterfall Model(b) Iterative Model(c) Spiral Model(d) Big Bang ModelThe question was asked in an online quiz.My question comes from Testing the Controller Component topic in chapter Mastering JUnit of JUnit |
|
Answer» Right option is (a) Waterfall Model |
|
| 5. |
The package for the assertThat() function is?(a) org.hamcrest.CoreMatchers.assertThat(b) org.junit.Assert.assertThat(c) org.junit.JunitMatchers.assertThat(d) org.junit.hasItem.assertThatThe question was posed to me during an interview.Question is from Hamcrest Matchers in section Mastering JUnit of JUnit |
|
Answer» The correct option is (B) org.JUNIT.ASSERT.assertThat |
|
| 6. |
Inversion of Control is used to increase __________ of the code.(a) Functionality(b) Cleanliness(c) Effectiveness(d) ModularityI had been asked this question in examination.Question is taken from The Controller Component topic in section Mastering JUnit of JUnit |
|
Answer» Correct option is (d) Modularity |
|
| 7. |
_________ is a programming paradigm which allows the separation of cross cutting concerns, hence, increasing modularity.(a) Functional Programming(b) Object Oriented Programming(c) Aspect Oriented Programming(d) Data InjectionsThe question was asked in final exam.This key question is from Testing Exception Handling topic in division Mastering JUnit of JUnit |
|
Answer» Correct choice is (c) ASPECT ORIENTED Programming |
|
| 8. |
________ can be useful in adding additional functionality which applies to every test within a test class.(a) Copy(b) Rules(c) Exceptions(d) BoundariesThe question was asked in an internship interview.I need to ask this question from Testing Exception Handling in chapter Mastering JUnit of JUnit |
|
Answer» Correct CHOICE is (b) Rules |
|
| 9. |
The principle of “Hollywood Principle: Don’t call us, we’ll call you” is commonly known as _____________(a) Calling Principle(b) Control Call(c) Inversion of Control(d) No-Show PrincipleThis question was addressed to me during an interview.My question is taken from The Controller Component topic in portion Mastering JUnit of JUnit |
|
Answer» CORRECT ANSWER is (c) INVERSION of Control For explanation: Inversion of Control focuses on separating what to do from when to do. |
|
| 10. |
The instanceOf matcher is equivalent to ________(a) isCompatibleType(b) isCompatible(c) isInstance(d) isSameI got this question in an internship interview.My question is based upon Hamcrest Matchers topic in division Mastering JUnit of JUnit |
|
Answer» RIGHT choice is (a) isCompatibleType Easiest explanation: Match whether objects are of compatible type (are instances of ONE ANOTHER). |
|
| 11. |
________________ is a library that contains a lot of helpful matcher objects , ported in several languages.(a) Java(b) Pygame(c) AllenWake(d) HamcrestThe question was posed to me during an interview.Enquiry is from Hamcrest Matchers in portion Mastering JUnit of JUnit |
|
Answer» Correct ANSWER is (d) HAMCREST |
|
| 12. |
An example of a web controller is __________(a) Apache Struts Framework(b) JUnit(c) Java(d) PhpI had been asked this question in an interview.My query is from The Controller Component topic in portion Mastering JUnit of JUnit |
|
Answer» The correct option is (a) APACHE Struts Framework |
|
| 13. |
________ checks to see if any of the contained matchers match.(a) anyOf(b) allOf(c) instanceOf(d) notNullThe question was asked during an interview.My question is taken from Hamcrest Matchers topic in portion Mastering JUnit of JUnit |
|
Answer» CORRECT choice is (a) ANYOF To explain I would say: The anyOf Hamcrest MATCHER is just like the || OPERATOR. |
|
| 14. |
To avoid overdesigning an interface, usually ____________ is used.(a) Agile Development(b) Test Driven Development(c) Base Design Development(d) Waterfall DevelopmentThe question was posed to me in class test.My question is taken from Testing the Controller Component topic in chapter Mastering JUnit of JUnit |
|
Answer» The correct OPTION is (b) Test Driven Development |
|
| 15. |
Which Hamcrest matcher is just like the && operator?(a) Is(b) Anything(c) sameInstance(d) allOfThe question was posed to me in an interview.The question is from Hamcrest Matchers in portion Mastering JUnit of JUnit |
|
Answer» The CORRECT option is (d) allOf |
|
| 16. |
@Test(timeout = 130) implies a time limit of ___________(a) 130 milliseconds(b) 130 minutes(c) 130 seconds(d) 1.30 minutesI have been asked this question by my college director while I was bunking the class.This question is from Timeout Testing in portion Mastering JUnit of JUnit |
|
Answer» RIGHT answer is (a) 130 MILLISECONDS To explain I would say: The timeout argument is in milliseconds. |
|
| 17. |
To use Parameterized.class with the @RunWith annotation, we need to import __________(a) org.junit.runners.Parameterized(b) org.junit.Parameterized(c) org.junit.runners.Parameterized(d) org.runners.ParameterizedI had been asked this question in class test.My question comes from Testing the Controller Component topic in section Mastering JUnit of JUnit |
|
Answer» The CORRECT choice is (a) org.JUNIT.runners.Parameterized |
|
| 18. |
What is the signature of the addHandler method of the Controller interface?(a) void addHandler(Request request, RequestHandler requestHandler)(b) void addHandler(RequestHandler requestHandler);(c) void addHandler(RequestHandler requestHandler);(d) void addHandler(Request request, Request requestHandler);I got this question in semester exam.This intriguing question originated from The Controller Component topic in division Mastering JUnit of JUnit |
|
Answer» The correct choice is (a) VOID addHandler(Request request, RequestHandler requestHandler) |
|
| 19. |
What applies the same timeout to every test method of a class?(a) @Timeout(b) @Expected(c) Timeout Rule(d) Not possible to apply same timeoutI got this question by my college professor while I was bunking the class.Enquiry is from Timeout Testing in portion Mastering JUnit of JUnit |
|
Answer» The correct OPTION is (c) TIMEOUT Rule |
|
| 20. |
Improving the design of existing code is known as __________(a) Refactoring(b) Improving(c) Betterment(d) UpgradingI had been asked this question in homework.Origin of the question is Testing the Controller Component in section Mastering JUnit of JUnit |
|
Answer» The CORRECT answer is (a) REFACTORING |
|
| 21. |
In what order is multiple @Before annotated methods run?(a) Oldest First(b) Newest First(c) Randomly(d) According to argument listThe question was asked during an interview.My doubt stems from Testing the Controller Component topic in portion Mastering JUnit of JUnit |
|
Answer» CORRECT CHOICE is (c) Randomly Explanation: It is not certain which @Before annotated METHOD will run first as all run randomly. |
|
| 22. |
Constructor-based DI is accomplished when the container invokes a class constructor with ____________(a) A number of arguments(b) No argument(c) Just one argument(d) Null objectsThe question was asked in examination.The query is from The Controller Component in division Mastering JUnit of JUnit |
|
Answer» Right OPTION is (a) A NUMBER of arguments |
|
| 23. |
If a timeout which has been specified lapses before the completion of the test, its execution is interrupted with _____________(a) Interrupt()(b) Thread.interrupt()(c) Thread.interruptable()(d) Threads.interruptable()This question was posed to me in an internship interview.I need to ask this question from Timeout Testing topic in portion Mastering JUnit of JUnit |
|
Answer» RIGHT option is (b) Thread.interrupt() To explain: The TIMEOUT is brought about through Interruptible I/O and LOCKS. |
|
| 24. |
Timeout testing is ____________(a) Software Dependent(b) Hardware Dependent(c) Software and Hardware Dependent(d) Software and Hardware IndependentThe question was posed to me in an international level competition.Asked question is from Timeout Testing topic in chapter Mastering JUnit of JUnit |
|
Answer» The correct choice is (C) Software and HARDWARE Dependent |
|
| 25. |
Controller logic component accesses the ________ logic component.(a) Class(b) Object(c) Business(d) CriteriaI had been asked this question by my school teacher while I was bunking the class.This interesting question is from Testing the Controller Component topic in section Mastering JUnit of JUnit |
|
Answer» Correct OPTION is (C) Business |
|
| 26. |
Hamcrest is not a ______________ framework in itself.(a) Matching(b) Testing(c) Asserting(d) CheckingI had been asked this question in exam.Enquiry is from Hamcrest Matchers in portion Mastering JUnit of JUnit |
|
Answer» Correct option is (b) Testing |
|
| 27. |
ExpectedException is found under which package?(a) org.junit.ExpectedException(b) org.junit.Test.ExpectedException(c) org.junit.Rule.ExpectedException(d) org.junit.rules.ExpectedExceptionThe question was posed to me by my college director while I was bunking the class.My question comes from Testing Exception Handling topic in section Mastering JUnit of JUnit |
|
Answer» The correct choice is (d) org.junit.rules.EXPECTEDEXCEPTION |
|
| 28. |
Constructor-based DI is preferred for ___________(a) Optional dependencies(b) Mandatory dependencies(c) All dependencies(d) No dependencyThe question was asked by my college professor while I was bunking the class.My question is from The Controller Component topic in chapter Mastering JUnit of JUnit |
|
Answer» The correct CHOICE is (B) Mandatory dependencies |
|
| 29. |
The Timeout Rule implements which interface?(a) Timeout(b) Test(c) TestingTimeout(d) TestRuleThe question was asked in an internship interview.This interesting question is from Timeout Testing topic in section Mastering JUnit of JUnit |
|
Answer» The CORRECT answer is (d) TestRule |
|
| 30. |
What is timeout testing?(a) Testing for exceptions(b) Testing code execution within time limits(c) Testing code correctness(d) Testing code with time functionsThis question was posed to me in an interview for internship.Origin of the question is Timeout Testing topic in section Mastering JUnit of JUnit |
|
Answer» The CORRECT CHOICE is (b) TESTING code execution WITHIN time limits |
|
| 31. |
When the container calls setter methods after invoking a constructor with no arguments it is known as ________________(a) Constructor-based dependency injection(b) Setter-based dependency injection(c) Setter-Seller dependency injection(d) No-Constructor dependency injectionI have been asked this question in an interview for internship.My question comes from The Controller Component topic in division Mastering JUnit of JUnit |
|
Answer» Right choice is (b) SETTER-based dependency injection |
|
| 32. |
The ______ is a component that “interacts with a client, controlling and managing the handling of each request”.(a) Master(b) RequestHandler(c) Controller(d) ClassI got this question during an internship interview.Enquiry is from The Controller Component topic in chapter Mastering JUnit of JUnit |
|
Answer» Right option is (c) Controller |
|
| 33. |
Where is the Timeout class present?(a) org.junit.rules.Timeout(b) org.junit.Timeout(c) org.Timeout(d) org.junit.RuleClasses.TimeoutI had been asked this question in final exam.Question is from Timeout Testing topic in portion Mastering JUnit of JUnit |
|
Answer» Right CHOICE is (a) org.junit.rules.TIMEOUT |
|
| 34. |
What are exceptions?(a) Anomalous conditions requiring special processing(b) Extra methods written to increase functionality(c) Commented lines describing exceptional cases(d) Null objectsI have been asked this question in an international level competition.Question is from Testing Exception Handling in chapter Mastering JUnit of JUnit |
|
Answer» Right answer is (a) Anomalous conditions requiring special processing |
|
| 35. |
What are the object(s) which make the core of the description of a controller component?(a) The Request, the Response(b) The Request, the Response, the RequestHandler, and the Controller(c) The Request(d) The RequestHandlerThe question was asked by my school principal while I was bunking the class.My question is taken from The Controller Component in division Mastering JUnit of JUnit |
|
Answer» The CORRECT option is (b) The Request, the RESPONSE, the RequestHandler, and the Controller |
|
| 36. |
The _________ rule can be used to test both exception type and message.(a) Expected(b) ExpectedException(c) CatchException(d) CatchThe question was asked in an internship interview.I would like to ask this question from Testing Exception Handling topic in portion Mastering JUnit of JUnit |
|
Answer» RIGHT ANSWER is (B) ExpectedException For explanation: Since JUnit 4.7, ExpectedException can be used to TEST both exception type and message. |
|
| 37. |
Custom JUnit rules can be created using ___________(a) TestRule Interface(b) CreateRule Interface(c) RuleCreate Interface(d) RuleInitialize InterfaceThe question was asked during a job interview.My doubt stems from Testing Exception Handling topic in chapter Mastering JUnit of JUnit |
|
Answer» The correct answer is (a) TestRule Interface |
|
| 38. |
______________ Hamcrest matcher can be used to match absolutely everything.(a) Is(b) AnyOf(c) Anything(d) NotI have been asked this question in final exam.This is a very interesting question from Hamcrest Matchers topic in portion Mastering JUnit of JUnit |
|
Answer» RIGHT OPTION is (c) Anything For explanation I WOULD SAY: Matches ABSOLUTELY anything. Useful in some cases where one wants to make the assert statement more readable. |
|
| 39. |
AOP forms a basis for __________(a) Functional Development(b) Object Oriented Programming(c) Datafield Development(d) Aspect Oriented Software DevelopmentThe question was asked during an interview for a job.The origin of the question is Testing Exception Handling in section Mastering JUnit of JUnit |
|
Answer» The correct CHOICE is (d) Aspect Oriented Software Development |
|
| 40. |
The ___________ method confirms that both references are to the same object.(a) assertEquals(b) assertEqual(c) assertEqualObject(d) assertSameThis question was posed to me by my school teacher while I was bunking the class.My doubt is from Testing the Controller Component topic in section Mastering JUnit of JUnit |
|
Answer» RIGHT OPTION is (d) ASSERTSAME Explanation: assertSame USES the == operator to compare OBJECTS. |
|
| 41. |
The equals() method is inherited from which base class?(a) Object(b) String(c) Integer(d) org.junit.EqualsThe question was posed to me in an interview for internship.The origin of the question is Testing the Controller Component in chapter Mastering JUnit of JUnit |
|
Answer» The correct option is (a) Object |
|
| 42. |
A Timeout Rule is initialized by ____________(a) @Rule public Timeout object = new Timeout()(b) @Rulepublic Timeout object = Timeout.seconds()(c) public Timeout object = Timeout.seconds()(d) public Timeout object = new Timeout()This question was addressed to me in an online interview.This intriguing question originated from Timeout Testing topic in division Mastering JUnit of JUnit |
|
Answer» Correct option is (b) @Rulepublic TIMEOUT OBJECT = Timeout.seconds() |
|
| 43. |
The ___________ parameter is used along with the @Test annotation to test for timeouts.(a) Expected(b) Timeout(c) NoLimit(d) TimeThe question was posed to me in an interview for internship.Query is from Timeout Testing topic in section Mastering JUnit of JUnit |
|
Answer» Correct answer is (b) Timeout |
|
| 44. |
________ describes a class of functions which when run modify other functions.(a) Class(b) Advice(c) Modifiers(d) ChangersThe question was posed to me during an internship interview.My question is based upon Testing Exception Handling topic in chapter Mastering JUnit of JUnit |
|
Answer» Correct OPTION is (b) Advice |
|
| 45. |
The assertEquals() method uses which underlying method to compare objects?(a) ==(b) equals()(c) isequal()(d) =I got this question in class test.My question is from Testing the Controller Component topic in section Mastering JUnit of JUnit |
|
Answer» The CORRECT OPTION is (b) equals() |
|