Web Programming With Java Mock 1 - Kochi (1)
Web Programming With Java Mock 1 - Kochi (1)
BeanFactory
ApplicationContext
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
@Entity
@Query
@Column
@Basic
Which option is true for the role of BeanFactory in Spring Framework: * 1/1
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
@Id, @GeneratedValue
What is the appropriate HTTP status code for a successful response in a *1/1
RESTful API?
200 OK
201 Created
204 No Content
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
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
A design pattern that allows for greater control over an application's objects
A method for controlling an application's flow of control from the inside out
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
Session
Request
Prototype
Singleton
Servlet API
Hibernate ORM
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
It resolves ambiguity when multiple beans of the same type are present
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
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
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.
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 *
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();
}
}
Only Statement
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
Java 5
Java 6
Java 7
Java 8
negligible
huge
small
both and b
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
@NoTest
@explicit
@ignore
@avoid
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
<%!directive%>
<%directive%>
<%=directive%>
<%@directive%>
Which tag should be used to pass information from JSP to included JSP? * 1/1
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
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()
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.
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
Daniel Fernández
Apache
Pivotal Software
web.xml
.java file
.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
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