🧪 Maven MCQ Quiz Hub

Maven Mcq Set 2

Choose a topic to test your knowledge and improve your Maven skills

JUnit is used for what type of software testing for the Java language?





✅ Correct Answer: 1

A JUnit Unit Test Case is compulsorily characterised by a/an known _______ and a/an expected _____





✅ Correct Answer: 2

To use JUnit in a project we need to add which JAR files on our test classpath?





✅ Correct Answer: 3

What are fixtures in JUnit?





✅ Correct Answer: 2

JUnit test methods must compulsorily return what value?





✅ Correct Answer: 4

JUnit test files are written in files with which file extension?





✅ Correct Answer: 3

What is the purpose of assertArrayEquals(“message”, A, B)?





✅ Correct Answer: 4

Which annotation implies that a method is a JUnit test case?





✅ Correct Answer: 4

What is a test runner?





✅ Correct Answer: 1

Which methods cannot be tested by JUnit test class?





✅ Correct Answer: 2

What are Parameterised tests used for in JUnit?





✅ Correct Answer: 1

A parameterised test class must carry which annotation?





✅ Correct Answer: 3

The test class must carry the @RunWith annotation with the ______ class as its argument.





✅ Correct Answer: 2

What will be the outcome for the following piece of code? //The JUnit files are imported public class TestClass { @Test public void testingMethod() { String message = “Test”; assertEquals(3,message.length()); } }





✅ Correct Answer: 4

What does the fail() method do in JUnit?





✅ Correct Answer: 1

Which annotation must be used to define suite classes?





✅ Correct Answer: 2

When is the tearDown() method called in JUnit?





✅ Correct Answer: 3

What does the assertTrue(“message”,A) do?





✅ Correct Answer: 1

How can a method be made to run before the execution of every test case?





✅ Correct Answer: 1

Which method from TestCase class returns the name of a Test case?





✅ Correct Answer: 4

The ______ is a container used to gather tests for the purpose of grouping and invocation.





✅ Correct Answer: 3

What happens if the tester does not define a Suite?





✅ Correct Answer: 1

The Suite object is a _____ that executes all of the @Test annotated methods in the test class.





✅ Correct Answer: 4

Suite class is the JUnit 4 equivalent of what feature of JUnit 3.8.x?





✅ Correct Answer: 1

For a Suite class, the @RunWith annotation has the value of which class?





✅ Correct Answer: 4

Which annotation is used to list all the classes in a suite?





✅ Correct Answer: 2

If we want to run test files Test1 and Test2 together, the @SuiteClasses annotation will be?





✅ Correct Answer: 1

JUnit Suites are independent of the capability of the ______ system.





✅ Correct Answer: 4

Will the second and third assert failures be reported? public class TestFile { @Test public void testMethod() { assertTrue(false); assertTrue(false); assertTrue(false); } }





✅ Correct Answer: 1

Which attribute is added to the @Test annotation so that the test passes when an expected exception is thrown?





✅ Correct Answer: 3

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





✅ Correct Answer: 3

An example of a web controller is ____





✅ Correct Answer: 1

What are the object(s) which make the core of the description of a controller component?





✅ Correct Answer: 2

What is the signature of the addHandler method of the Controller interface?





✅ Correct Answer: 1

The principle of “Hollywood Principle: Don’t call us, we’ll call you” is commonly known as ______





✅ Correct Answer: 3

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





✅ Correct Answer: 4

When the container calls setter methods after invoking a constructor with no arguments it is known as _______





✅ Correct Answer: 2

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





✅ Correct Answer: 1

Constructor-based DI is preferred for ______





✅ Correct Answer: 2

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).





✅ Correct Answer: 3

Improving the design of existing code is known as _______





✅ Correct Answer: 1

In what order is multiple @Before annotated methods run?





✅ Correct Answer: 3

The ______ method confirms that both references are to the same object.





✅ Correct Answer: 4

The assertEquals() method uses which underlying method to compare objects?





✅ Correct Answer: 2

The equals() method is inherited from which base class?





✅ Correct Answer: 1

To use Parameterized.class with the @RunWith annotation, we need to import ____





✅ Correct Answer: 1

To avoid overdesigning an interface, usually ____________ is used.





✅ Correct Answer: 2

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.





✅ Correct Answer: 1

Controller logic component accesses the ________ logic component.





✅ Correct Answer: 3

Overuse of argument _________ can lead to fragile tests.





✅ Correct Answer: 4