Explore topic-wise MCQs in Junit.

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

1.

In the context of unit testing, the term ___________ is used to contrast and compare the objects you use in your application with the objects that you use to test your application (test objects).

A. Mock Object
B. Dummy Object
C. Domain Object
D. Real Object
Answer» D. Real Object
2.

Constructor-based DI is preferred for ___________

A. Optional dependencies
B. Mandatory dependencies
C. All dependencies
D. No dependency
Answer» C. All dependencies
3.

Constructor-based DI is accomplished when the container invokes a class constructor with ____________

A. A number of argumentsb) No argument
B. No argumentb) Just one argument
C. Null objects
Answer» B. No argumentb) Just one argument
4.

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 Principle
Answer» D. No-Show Principle
5.

The ______ is a component that “interacts with a client, controlling and managing the handling of each request”.

A. Master
B. RequestHandler
C. Controller
D. Class
Answer» D. Class
6.

CONSTRUCTOR-BASED_DI_IS_PREFERRED_FOR____________?$

A. Optional dependencies
B. Mandatory dependencies
C. All dependencies
D. No dependency
Answer» C. All dependencies
7.

In_the_context_of_unit_testing,_the_term_____________is_used_to_contrast_and_compare_the_objects_you_use_in_your_application_with_the_objects_that_you_use_to_test_your_application_(test_objects).$

A. Mock Object
B. Dummy Object
C. Domain Object
D. Real Object
Answer» D. Real Object
8.

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 objects
Answer» B. No argument
9.

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 injection
Answer» C. Setter-Seller dependency injection
10.

Inversion of Control is used to increase __________ of the code.

A. Functionality
B. Cleanliness
C. Effectiveness
D. Modularity
Answer» E.
11.

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 Principle
Answer» D. No-Show Principle
12.

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);
Answer» B. void addHandler(RequestHandler requestHandler);
13.

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 RequestHandler
Answer» C. The Request
14.

An example of a web controller is __________

A. Apache Struts Framework
B. JUnit
C. Java
D. Php
Answer» B. JUnit
15.

The ______ is a component that “interacts with a client, controlling and managing the handling of each request”.

A. Master
B. RequestHandler
C. Controller
D. Class
Answer» D. Class