0% found this document useful (0 votes)
3 views

Web Programming With Java Mock 1 - Kochi (1)

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

Web Programming With Java Mock 1 - Kochi (1)

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 22

7/28/23, 12:51 PM Web Programming with Java Mock 1

Web Programming with Java Mock 1


Total points 40/40

Which are the ioc container in spring? * 1/1

BeanFactory

ApplicationContext

Both BeanFactory & ApplicationContext

None of the above

Sophia is using Spring Data JPA for the data layer implementations in her *1/1
web application. She wrote a custom method in the repository. She is
using ‘update’ query to implement the functionality of the method. Which
one of the following annotation she should use on that method?

@Updating

@Updated

@Modifying

@Modified

https://docs.google.com/forms/d/e/1FAIpQLSecW_MwaAcyjh51F96AaHZiQ3TeXqcq3XAApQJZvtbnqvardA/viewscore?viewscore=AE0zAgBAvk… 1/22
7/28/23, 12:51 PM Web Programming with Java Mock 1

Which one of the following annotations is not used in Hibernate? * 1/1

@Entity

@Query

@Column

@Basic

What is the purpose of a PreparedStatement in JDBC? * 1/1

To execute SQL queries and retrieve results

To avoid SQL Injection

To retrieve metadata about a database

To handle exceptions in JDBC operations

Which option is true for the role of BeanFactory in Spring Framework: * 1/1

BeanFactory provides the configuration framework and basic functionality

BeanFactory provides access to messages in i18n-style

BeanFactory provides access to resources, such as URLs and files

BeanFactory provides event propagation to beans implementing the


ApplicationListener interface

https://docs.google.com/forms/d/e/1FAIpQLSecW_MwaAcyjh51F96AaHZiQ3TeXqcq3XAApQJZvtbnqvardA/viewscore?viewscore=AE0zAgBAvk… 2/22
7/28/23, 12:51 PM Web Programming with Java Mock 1

Jacob is working on a web application where JPA is being used in data *1/1
layer. He wrote a POJO class and wants this class to work as an entity to
implement the ORM concept. What are the minimum required
annotations he must use at the class to create a table in the database?

@Id, @Entity

@Table, @Entity, @Id

@Column, @Entity, @Table

@Id, @GeneratedValue

AOP stands for? * 1/1

Asynchronous oriented programming

Aspect Oriented Programming

All Oops Program

None of the above

What is the appropriate HTTP status code for a successful response in a *1/1
RESTful API?

200 OK

201 Created

204 No Content

All of the above

https://docs.google.com/forms/d/e/1FAIpQLSecW_MwaAcyjh51F96AaHZiQ3TeXqcq3XAApQJZvtbnqvardA/viewscore?viewscore=AE0zAgBAvk… 3/22
7/28/23, 12:51 PM Web Programming with Java Mock 1

Select the option that is not a correct approach to create bean life cycle *1/1
methods in Spring framework?

By using Annotations

By implementing Interfaces provided by Spring framework

By extending classes provided by Spring framework

By using XML configuration

Which of the following is correct error when loading JAR file with *1/1
duplicate name?

java.io.NullPointerException

java.lang.ClassNotFound

java.lang.ClassFormatError

java.lang.DuplicateClassError

What is Inversion of Control in Spring? * 1/1

A design pattern that allows for greater control over an application's objects

A technique for delegating control of the application to a central authority

A method for controlling an application's flow of control from the inside out

The term 'Inversion of Control' is not used in Spring

https://docs.google.com/forms/d/e/1FAIpQLSecW_MwaAcyjh51F96AaHZiQ3TeXqcq3XAApQJZvtbnqvardA/viewscore?viewscore=AE0zAgBAvk… 4/22
7/28/23, 12:51 PM Web Programming with Java Mock 1

Consider the following bean definition : * 1/1


<bean id="test" class="com.dev.test.TestBean" />

Which of the below bean scope is applied in this bean?

Session

Request

Prototype

Singleton

What is the main component of the Spring framework? * 1/1

Servlet API

Hibernate ORM

Spring Core Container

Spring Data JPA

PRN *

https://docs.google.com/forms/d/e/1FAIpQLSecW_MwaAcyjh51F96AaHZiQ3TeXqcq3XAApQJZvtbnqvardA/viewscore?viewscore=AE0zAgBAvk… 5/22
7/28/23, 12:51 PM Web Programming with Java Mock 1

What is the purpose of the @Qualifier annotation in Spring? * 1/1

It specifies the order of bean initialization among multiple beans

It marks a bean for automatic injection

It resolves ambiguity when multiple beans of the same type are present

It marks a class to become a Spring bean

Choose the statement that best describes the relationship between JSP *1/1
and servlets

Servlets are built on JSP semantics and all servlets are compiled to JSP pages for
runtime usage

Servlets and JSP are competing technologies for handling web requests. Servlets
are being superseded by JSP, which is preferred. The two technologies are not
useful in combination

JSPs are built on servlet semantics and all JSPs are compiled to servlets for
runtime usage

JSP and sevlets are unrelated technologies

Servlet mapping defines * 1/1

an association between a URL pattern and a servlet

an association between a URL pattern and a request page

an association between a URL pattern and a response page

All of the above

https://docs.google.com/forms/d/e/1FAIpQLSecW_MwaAcyjh51F96AaHZiQ3TeXqcq3XAApQJZvtbnqvardA/viewscore?viewscore=AE0zAgBAvk… 6/22
7/28/23, 12:51 PM Web Programming with Java Mock 1

The getSession() method with "true" as its parameter [ getSession(true) ] *1/1


it will return the appropriate session object when

the session is completed

the session object is passed to another method

the session does not exists

the session is existing

In a Hibernate based application, in order to interact with the database, *1/1


we make use of various methods provided by EntityManager API. Which
statement is false in the context of these methods?

We can make use of the persist() method in order to have an object associated with
the EntityManager.

We can use the findReference() method, if we just need the reference to the
entity.

We can use the detach() method to detach an entity from the persistence context.

We can use the find() method to retrieve an object from the database.

Which option is true about session scope? * 1/1

Objects are accessible only from the page in which they are created

Objects are accessible only from the pages which are in same session

Objects are accessible only from the pages which are processing the same request

Objects are accessible only from the pages which reside in same application

https://docs.google.com/forms/d/e/1FAIpQLSecW_MwaAcyjh51F96AaHZiQ3TeXqcq3XAApQJZvtbnqvardA/viewscore?viewscore=AE0zAgBAvk… 7/22
7/28/23, 12:51 PM Web Programming with Java Mock 1

Name *

“out” is implicit object of which class in JSP? * 1/1

javax.servlet.jsp.SessionWriter

javax.servlet.jsp.PrintWriter

javax.servlet.jsp.JspWriter

Which resource(s)have their close() method called when this code runs? * 1/1
public static void runQuery(Connection conn) throws SQLException {
try (Statement stmt = conn.createStatement())
{ ResultSet rs = stmt.executeQuery("select * from abcd");
rs.next();
}
}

No close() methods are called.

Only Statement

Only Statement and Connection

Only Statement and ResultSet

https://docs.google.com/forms/d/e/1FAIpQLSecW_MwaAcyjh51F96AaHZiQ3TeXqcq3XAApQJZvtbnqvardA/viewscore?viewscore=AE0zAgBAvk… 8/22
7/28/23, 12:51 PM Web Programming with Java Mock 1

Which version of Java introduced annotation? * 1/1

Java 5

Java 6

Java 7

Java 8

GET methods are great for sending ....................amounts of information *1/1


that you do not mind having visible in a URL.

negligible

huge

small

both and b

if isThreadSafe attribute of page directive is set as true, then generated *1/1


servlet implements SingleThreadModel interface.

true

false

https://docs.google.com/forms/d/e/1FAIpQLSecW_MwaAcyjh51F96AaHZiQ3TeXqcq3XAApQJZvtbnqvardA/viewscore?viewscore=AE0zAgBAvk… 9/22
7/28/23, 12:51 PM Web Programming with Java Mock 1

Which of the following annotation is used to avoid execution of Junits? * 1/1

@NoTest

@explicit

@ignore

@avoid

Abbreviate the term JMS? * 1/1

Java Message Service

Java Monitor Service

Java Message Session

Java Monitor Session

Which of the following are the session tracking techniques? * 1/1

URL rewriting, using session object, using response object, using hidden fields

URL rewriting, using session object, using cookies, using hidden fields

URL rewriting, using servlet object, using response object, using cookies

URL rewriting, using request object, using response object, using session object

https://docs.google.com/forms/d/e/1FAIpQLSecW_MwaAcyjh51F96AaHZiQ3TeXqcq3XAApQJZvtbnqvardA/viewscore?viewscore=AE0zAgBAv… 10/22
7/28/23, 12:51 PM Web Programming with Java Mock 1

Which one of the following is correct for directive in JSP? * 1/1

<%!directive%>

<%directive%>

<%=directive%>

<%@directive%>

Which tag should be used to pass information from JSP to included JSP? * 1/1

Using <%jsp:page> tag

Using <%jsp:param> tag

Using <%jsp:import> tag

Using <%jsp:useBean> tag

When destroy() method of a filter is called? * 1/1

The destroyer() method is called after the filter has executed

The destroy() method is called only once at the end of the life cycle of a filter

The destroy() method is called after the filter has executed doFilter method

The destroy() method is called only once at the begining of the life cycle of a filter

https://docs.google.com/forms/d/e/1FAIpQLSecW_MwaAcyjh51F96AaHZiQ3TeXqcq3XAApQJZvtbnqvardA/viewscore?viewscore=AE0zAgBAv… 11/22
7/28/23, 12:51 PM Web Programming with Java Mock 1

Can servlet class declare constructor with ServletConfig object as an *1/1


argument?

False

True

Which HTTP method is used to create a new resource in RESTful API? * 1/1

GET

POST

PUT

DELETE

method can be used for any SQL statements(Select and Update *1/1
both).

executeQuery()

executeUpdate()

execute()

All of the above

https://docs.google.com/forms/d/e/1FAIpQLSecW_MwaAcyjh51F96AaHZiQ3TeXqcq3XAApQJZvtbnqvardA/viewscore?viewscore=AE0zAgBAv… 12/22
7/28/23, 12:51 PM Web Programming with Java Mock 1

What is the difference between PUT and PATCH methods in a RESTful *1/1
API?

PUT is used to create a new resource, while PATCH is used to update an existing
resource.

PUT requires the entire resource data to be provided, while PATCH allows partial
updates.

PUT is used for partial updates, while PATCH is used for complete updates.

There is no difference, PUT and PATCH can be used interchangeably.

How can you enable asynchronous method execution in Spring? * 1/1

Using the @Async annotation

Using the <async-method-execution> tagUsing

the @EnableAsync annotation

Setting the "async" attribute to "true" in XML configuration

https://docs.google.com/forms/d/e/1FAIpQLSecW_MwaAcyjh51F96AaHZiQ3TeXqcq3XAApQJZvtbnqvardA/viewscore?viewscore=AE0zAgBAv… 13/22
7/28/23, 12:51 PM Web Programming with Java Mock 1

Mary is working in a Hibernate based application as a web-application *1/1


developer. She has two entities in her application: Student & Address. She
is implementing a relation where One student can have multiple
addresses and one address can accommodate multiple students in a
bidirectional relationship. Mary doesn’t want hibernate to create one
additional table. Which of the following annotation and its attribute will
she use to fulfil the given requirement?

@ManyToMany and mappedBy

@ManyToOne and mappedBy

@OneToMany and MappedBy

@OneToOne and MappedBy

Spring is developed by * 1/1

Red Hat Software

Daniel Fernández

Apache

Pivotal Software

We can configure DispatcherServlet in * 1/1

web.xml

.java file

Both of the above

.properties file

https://docs.google.com/forms/d/e/1FAIpQLSecW_MwaAcyjh51F96AaHZiQ3TeXqcq3XAApQJZvtbnqvardA/viewscore?viewscore=AE0zAgBAv… 14/22
7/28/23, 12:51 PM Web Programming with Java Mock 1

Which of the following is INCORRECT about dependency injection in *1/1


Spring?

It helps in achieving loose coupling between objects.

It helps in testing the module by injecting the dependent Mock Objects.

It increases the scope of code reusability.

It helps in managing database connections.

What is the purpose of the @Autowired annotation in Spring? * 1/1

To define a bean in the Spring application context

To inject dependencies into a bean

To define the scope of a bean

To define the lifecycle of a bean

This content is neither created nor endorsed by Google. - T erms of Service - P rivacy Policy

Forms

https://docs.google.com/forms/d/e/1FAIpQLSecW_MwaAcyjh51F96AaHZiQ3TeXqcq3XAApQJZvtbnqvardA/viewscore?viewscore=AE0zAgBAv… 15/22
7/28/23, 12:51 PM Web Programming with Java Mock 1

https://docs.google.com/forms/d/e/1FAIpQLSecW_MwaAcyjh51F96AaHZiQ3TeXqcq3XAApQJZvtbnqvardA/viewscore?viewscore=AE0zAgBAv… 16/22
7/28/23, 12:51 PM Web Programming with Java Mock 1

https://docs.google.com/forms/d/e/1FAIpQLSecW_MwaAcyjh51F96AaHZiQ3TeXqcq3XAApQJZvtbnqvardA/viewscore?viewscore=AE0zAgBAv… 17/22
7/28/23, 12:51 PM Web Programming with Java Mock 1

https://docs.google.com/forms/d/e/1FAIpQLSecW_MwaAcyjh51F96AaHZiQ3TeXqcq3XAApQJZvtbnqvardA/viewscore?viewscore=AE0zAgBAv… 18/22
7/28/23, 12:51 PM Web Programming with Java Mock 1

https://docs.google.com/forms/d/e/1FAIpQLSecW_MwaAcyjh51F96AaHZiQ3TeXqcq3XAApQJZvtbnqvardA/viewscore?viewscore=AE0zAgBAv… 19/22
7/28/23, 12:51 PM Web Programming with Java Mock 1

https://docs.google.com/forms/d/e/1FAIpQLSecW_MwaAcyjh51F96AaHZiQ3TeXqcq3XAApQJZvtbnqvardA/viewscore?viewscore=AE0zAgBAv… 20/22
7/28/23, 12:51 PM Web Programming with Java Mock 1

https://docs.google.com/forms/d/e/1FAIpQLSecW_MwaAcyjh51F96AaHZiQ3TeXqcq3XAApQJZvtbnqvardA/viewscore?viewscore=AE0zAgBAv… 21/22
7/28/23, 12:51 PM Web Programming with Java Mock 1

https://docs.google.com/forms/d/e/1FAIpQLSecW_MwaAcyjh51F96AaHZiQ3TeXqcq3XAApQJZvtbnqvardA/viewscore?viewscore=AE0zAgBAv… 22/22

You might also like