Maven/Maven Mcq Set 2 Sample Test,Sample questions

Question:
 An example of a web controller is ____

1.Apache Struts Framework

2. JUnit

3.Java

4.Php

Posted Date:-2022-01-08 08:13:46


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

1. @SuiteClasses(value={Test1.class,Test2.class})

2. @SuiteClasses(value=All)

3.@SuiteClasses(Test1, Test2);

4.@SuiteClasses()

Posted Date:-2022-01-08 08:10:31


Question:
 Improving the design of existing code is known as _______

1.Refactoring

2. Improving

3. Betterment

4.Upgrading

Posted Date:-2022-01-08 08:23:19


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

1.Mock Object

2.Dummy Object

3.Domain Object

4. Real Object

Posted Date:-2022-01-08 08:22:41


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

1.Functionality

2.Cleanliness

3. Effectiveness

4.Modularity

Posted Date:-2022-01-08 08:18:48


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

1..junit

2..test

3. .java

4. .unit

Posted Date:-2022-01-08 07:57:05


Question:
 JUnit test methods must compulsorily return what value?

1.String

2.int

3.Object

4.void

Posted Date:-2022-01-08 07:56:40


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

1.static Test suite() method

2. Test suite() method

3. static void suite() method

4. void suite() method

Posted Date:-2022-01-08 08:09:17


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

1.Master

2.RequestHandler

3.Controller

4.Class

Posted Date:-2022-01-08 08:13:20


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

1.assertEquals

2.assertEqual

3.assertEqualObject

4.assertSame

Posted Date:-2022-01-08 08:24:19


Question:
 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.

1.Waterfall Model

2.Iterative Model

3.Spiral Model

4. Big Bang Model

Posted Date:-2022-01-08 08:29:44


Question:
 What happens if the tester does not define a Suite?

1.The test runner automatically creates a Suite

2. Compilation Error

3. Every test fails

4.Every test passes

Posted Date:-2022-01-08 08:08:24


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

1.String testCaseName()

2.String getTest()

3.String getTestCaseName()

4. String getName()

Posted Date:-2022-01-08 08:04:17


Question:
 Will the second and third assert failures be reported?

	public class TestFile 
        {
		@Test
		public void testMethod()
                {
			assertTrue(false);
			assertTrue(false);
			assertTrue(false);
		}
	}

1.Yes

2.No

3.none

4.all the mentoined

Posted Date:-2022-01-08 08:11:21


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

1.output, input

2. input, output

3. variable, literal

4.program, variable

Posted Date:-2022-01-08 07:55:22


Question:
A parameterised test class must carry which annotation?

1.@Test

2.@ParameterisedClass

3.@Runwith

4.@Class

Posted Date:-2022-01-08 08:00:29


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

1.A number of arguments

2.No argument

3. Just one argument

4.Null objects

Posted Date:-2022-01-08 08:21:45


Question:
Constructor-based DI is preferred for ______

1.Optional dependencies

2.Mandatory dependencies

3.All dependencies

4.No dependency

Posted Date:-2022-01-08 08:22:11


Question:
Controller logic component accesses the ________ logic component.

1. Class

2.Object

3.Business

4. Criteria

Posted Date:-2022-01-08 08:30:10


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

1.org.junit.runners.class

2.org.junit.Suite.class

3. org.runners.Suite.class

4. org.junit.runners.Suite.class

Posted Date:-2022-01-08 08:09:41


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

1.Annotate the method with @Before

2. Prefix the method name with startfirst

3.Annotate the method with a @BeforeClass

4.Such a method cannot be made

Posted Date:-2022-01-08 08:03:47


Question:
In what order is multiple @Before annotated methods run?

1.Oldest First

2.Newest First

3.Randomly

4.According to argument list

Posted Date:-2022-01-08 08:23:51


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

1.Unit Testing

2. Integration Testing

3. Functional Testing

4.System Testing

Posted Date:-2022-01-08 07:54:56


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

1.Run

2.Class

3.Test

4.Build

Posted Date:-2022-01-08 08:10:55


Question:
Overuse of argument _________ can lead to fragile tests.

1.Parameters

2. Objects

3.Classes

4.Captors

Posted Date:-2022-01-08 08:30:36


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

1.==

2.equals()

3.isequal()

4. =

Posted Date:-2022-01-08 08:24:49


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

1.Object

2.String

3.Integer

4.org.junit.Equals

Posted Date:-2022-01-08 08:25:15


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

1.Calling Principle

2.Control Call

3.Inversion of Control

4.No-Show Principle

Posted Date:-2022-01-08 08:15:10


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

1.Result

2.FolderConfigurationTest

3.FileConfigurationTest

4. Runner

Posted Date:-2022-01-08 08:08:52


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

1.Default

2. Parameterised

3.Super

4.Inherited

Posted Date:-2022-01-08 08:01:00


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

1. Result

2. TestCase

3.Suite

4.Test

Posted Date:-2022-01-08 08:08:01


Question:
To avoid overdesigning an interface, usually ____________ is used.

1.Agile Development

2.Test Driven Development

3.Base Design Development

4.Waterfall Development

Posted Date:-2022-01-08 08:29:18


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

1.junit.jar

2.hamcrest-core.jar

3.junit.jar and hamcrest-core.jar

4.java-junit.jar

Posted Date:-2022-01-08 07:55:49


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

1.org.junit.runners.Parameterized

2.org.junit.Parameterized

3.org.junit.runners.Parameterized

4. org.runners.Parameterized

Posted Date:-2022-01-08 08:28:51


Question:
What are fixtures in JUnit?

1.Objects that specify when to run a test

2.Fixed state of a set of objects used as a baseline for running tests

3.Bundle of few test cases run together

4.Date objects

Posted Date:-2022-01-08 07:56:14


Question:
What are Parameterised tests used for in JUnit?

1.Run a test many times with different sets of parameters

2.Run a test with no parameters

3.Run a test with only String parameters

4.Run a test once with fixed set of parameters

Posted Date:-2022-01-08 08:00:03


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

1. The Request, the Response

2.The Request, the Response, the RequestHandler, and the Controller

3. The Request

4. The RequestHandler

Posted Date:-2022-01-08 08:14:15


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

1.Asserts that the condition A is true

2.Asserts that “message” = A

3.Asserts that A contains “message”

4. Asserts that the condition A is false

Posted Date:-2022-01-08 08:03:20


Question:
What does the fail() method do in JUnit?

1.Throws an assertion error unconditionally

2.Calls the default constructor

3. Outputs the message “Fail” to the console

4. Pauses the test for 1 second

Posted Date:-2022-01-08 08:01:54


Question:
What is a test runner?

1.Used to execute the test file

2.Defines the test file

3. Used to write test cases

4.Used to define annotations

Posted Date:-2022-01-08 07:58:19


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

1.Checks that “message” is in both A and B

2.Checks that “message” is in A but not B

3.Checks that “message” is in B but not A

4.Asserts the equality of the A and B arrays

Posted Date:-2022-01-08 07:57:29


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

1.void addHandler(Request request, RequestHandler requestHandler)

2.void addHandler(RequestHandler requestHandler);

3. void addHandler(RequestHandler requestHandler);

4.void addHandler(Request request, Request requestHandler);

Posted Date:-2022-01-08 08:14:43


Question:
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());
		}
	}

1.Compilation Error

2.Runtime Error

3.Test Ran with Success

4. Test Ran with Failure

Posted Date:-2022-01-08 08:01:27


Question:
When is the tearDown() method called in JUnit?

1. After all the tests have run

2.At the beginning of every test case

3. After each test case has run

4.At the beginning of the first test case

Posted Date:-2022-01-08 08:02:45


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

1. Constructor-based dependency injection

2.Setter-based dependency injection

3.Setter-Seller dependency injection

4.No-Constructor dependency injection

Posted Date:-2022-01-08 08:21:17


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

1. @junit

2. @testcase

3.@org.Test

4.@org.junit.Test

Posted Date:-2022-01-08 07:57:54


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

1.@RunWith

2. @SuiteClasses

3. @Classses

4. @SuiteClass

Posted Date:-2022-01-08 08:10:08


Question:
Which annotation must be used to define suite classes?

1. @RunWith

2.@SuiteClasses

3.@Suite

4.@SuiteClass

Posted Date:-2022-01-08 08:02:21


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

1.exception

2.throws

3.expected

4.expectedException

Posted Date:-2022-01-08 08:11:53


Question:
Which methods cannot be tested by JUnit test class?

1. public methods

2.private methods

3. protected methods

4.methods with void return type

Posted Date:-2022-01-08 07:58:45


More MCQS

  1. Maven Mcq Set 1
  2. Maven Mcq Set 2
  3. Maven Mcq Set 3
  4. Maven Mcq Set 4
  5. Maven Mcq Set 5
  6. Maven Mcq Set 6
  7. Maven Mcq Set 7
Search
R4R Team
R4Rin Top Tutorials are Core Java,Hibernate ,Spring,Sturts.The content on R4R.in website is done by expert team not only with the help of books but along with the strong professional knowledge in all context like coding,designing, marketing,etc!