Ques

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 5

Which of the following is used to redirect the response from a servlet to a JSP page?

1. response.sendRedirect() 2.request.sendRedirect() 3.request.forward() 4.response.forward()

A user types the URL in a browser:


http://www.javatraining.com/GH/index.html.WhichHTTPrequestgetsgenerated?

1.GETmethod 2. POST method 3. HEAD method 4. PUT method.

Which of the following describes Unit Testing correctly?

1.UnitTestingistheprocessofcheckingwhethertheapplicationisworkingasper requirements.
2.Unittestingisthetestingofasingleentity(class or method). 3.Alloftheabove 4. Noneoftheabove

In Java, which of the following can be marked static?

1.Methods, Variables, Initialization Blocks, Outer Classes, and Nested Classes


2.Methods,Variables,InitializationBlocks,andNestedClasses
3.Methods,Variables,InitializationBlocks,andOuterClasses
4.Methods,Variables,andInitializationBlocks

What is the command line tool introduced for JSengine in Java8?

1.jjs 2.jss 3.jfs 4.jbd

Which is the correct Java code snippet to be used to create a Functional Interface?

1.interface MyFunctionalInterface implements


Functional{ 2."@FunctionalInterfaceinterfaceMyFunctionalInterface{"
3."@FunctionalinterfaceMyFunctionalInterface{"

What annotation wiring element is added to scan packages to find and register beans with in the
Application Context?

1.<context:annotation-config/>

2.<context:annotation-scan/>

3. .<context:component-config/>

4. .<context:component-scan/>
In the following example, what type of autowire will be used?

@Autowired(required=false)
publicEmployeeAutowiredByConstructorService(@Qualifier("employee")Employee emp)
{ this.employee=emp; }

1.ByName 2.ById 3.@Autowired 4.Constructor

When would you apply the builder design pattern?

1.When you want to provide a collection of classes, you want to reveal just their contracts and their
relationships, not their implementations.

2.When you want to use an existing class, and its interface doesnot match the one you need.

3.When you need to addres ponsibilities to individual objects dynamically without affecting other
objects

4.When you want to separate abstraction and implementation permanently and need to share an
implementation among multiple objects

To send binary output in a response, which of the following method of HttpServletResponse may
be used to get the appropriate Writer/Stream object.

1.getStream 2.getOutputStream 3.getBinaryStream 4.getWriter

Identify the location of compiled class files with in a warfile?

1./META-INF/classes 2./classes 3./WEB-INF/classes 4.D./root/classes

Pick the correct Java method reference usages.

1.object::instanceMethod 2.Class::staticMethod 3.Class::new 4.Alloftheabove

Which is the correct API to manage reactive streams in Java?

1.java.util.concurrent.Flow 2.java.util.concurrent.Flow.Publisher
3.java.util.concurrent.Flow.Processor 4.Alloftheabove

In Java, which of the following data structure classes CANNOT be type parameterized?

1.List 2.Set 3.Array 4.Map


Which of these OOPS concept is enabled by method overriding in Java?

1.Polymorphism 2.Abstraction 3.Inheritance 4.Encapsulation

Which of the following is an example of java-based configuration?

1. .<context:annotation-config/>

2.@ConfigurationpublicclassHelloWorldConfig{..}

3.@Autowired

4.ApplicationContextcontext=newClassPathXmlApplicationContext("Beans.xml");

What happens if you call the method close() on a ResultSet object?

1. The method close() does not exist for a ResultSet. Only Connections can be closed.
2. The database and JDBC resources are released.
3. You will get a SQLException , because only Statement objects can close ResultSets
4. The ResultSet , together with the statement which created it and the connection from which
the statement was retrieved Closall(), will be closed and released database and JDBC
resources

A JSP page uses the java.util.ArrayList class many times. Instead of referring the class by its
complete package name each time, we want to just use ArrayList. Which attribute of page
directive must be specified to achieve this? Select the one correct

1. Extends
2. Include
3. Package
4. Import

The task authentication blocking of requests ,data compression, logging and auditing are
performed by _________

1. Servlet filter
2. Servlet Config
3. Servlet Context
4. Servlet Container
In Java, Which of these class types supports sequential and parallel processing of data?
a) Queue
b) Lambda
c) ExecutorService
d) Streams

To execute stored procedure total Stock in a database server, which of the following code
snippet is used?

a)Statement stmt = connection.createStatement(); stmt.execute("totalStock()");


b)CallableStatement clbstmnt = con.prepareCall("{call totalStock}"); cs.executeQuery();
c)StoreProcedureStatement spstmt = connection.createStoreProcedure("totalStock()");
spstmt.executeQuery();
d)PrepareStatement pstmt = connection.prepareStatement("totalStock()"); pstmt.execute();

What is the return type of Java Lambda expressions?

a) Void
b) Lambda
c) Function
d) Regex

What is the effect of executing the following JSP statement , assuming a class with name
Employee exists in classes package?

%@page import = “classes.Employee”%


<jsp:useBean id = “employee”class=”classes.Employee “scope=”session”/>
<jsp:setProperty name=”employee” property=”*”/>

1. The code does not compile as there is no property attribute of setProperty tag.
2. The code does not compile as the property attribute cannot take * as a value
3. The code sets value of all properties of employee bean to “*”.
4. The code sets the values of all properties of employee bean matching parameters in
request object

You might also like