Đề Thi FE PRJ301 - SP26 - B5 - FE - RE

adminadmin is verified member.

Member
Thành viên BQT
Administrator
Học kỳ
SP2026
Thời Gian
6/5/26
Loại tài liệu
FE
Mã Đề
PRJ301_SP26_B5RE_817305
PRJ301 SP26 B5 FE RE
1. (Choose 1 answer)

What file is commonly used for packaging a Java web application, including servlets and JSP files?
A. .zip
B. .jar
C. .war
D. .ear
2. (Choose 1 answer)

When multiple filters are applied to a servlet, what determines the order of execution?
A. The order in which the filters are defined in the web.xml file.
B. The filter's priority attribute.
C. The order in which the filters were added to the web application.
D. The servlet's URL pattern.
3. (Choose 1 answer)

Which JSTL tag is used to loop over a collection of objects?
A. <c:forEach>
B. <c:iterate>
C. <c:loop>
D. <c:repeat>
4. (Choose 1 answer)

What is the role of a web server in a client-server architecture?
A. Hosts the website's static content
B. Processes client requests and returns dynamic content
C. Manages database connections
D. Authenticates user sessions
5. (Choose 1 answer)

After submitting you want to search all products that contain a part of name entered by the client in the servlet "SearchServlet", and then transfer the result to the page "SearchPage.jsp" to display. Which instructions should you write at TODO?
A. request.setAttribute("RESULT",result); response.sendRedirect("SearchPage.jsp");
B. request.setParameter("RESULT",result); request.getRequestDispatcher("SearchPage.jsp").forward(request,response);
C. response.getWriter().println("RESULT"); response.sendRedirect("SearchPage.jsp");
D. request.setAttribute("RESULT",result); request.getRequestDispatcher("SearchPage.jsp").forward(request,response);
6. (Choose 1 answer)

What is the purpose of the empty keyword in EL when used with a collection?
A. Checks if the collection is null
B. Checks if the collection is not empty
C. Checks if the collection is empty
D. Retrieves the size of the collection
7. (Choose 1 answer)

What concept BEST describes the relationship between a JSP and a Servlet?
A. A JSP is an entirely separate technology with no connection to Servlets.
B. A JSP is a simplified type of Servlet, specifically designed for handling client-side and server-side logic.
C. A JSP is ultimately translated into a Servlet before it can be executed by a web container.
D. A JSP acts as a controller that delegates requests to various Servlets for processing.
8. (Choose 1 answer)

Examine the following web.xml snippet. What servlet will be called for /login path?
A. LoginServlet
B. HomeServlet
C. MainServlet
D. ErrorHandler
9. (Choose 1 answer)

What is the primary benefit of using implicit objects in web development?
A. They simplify the code and reduce redundancy
B. They improve security by encapsulating sensitive data
C. They enhance performance by reducing memory usage
D. They enable parallel processing of requests
10. (Choose 1 answer)

When does HttpSessionListener's sessionCreated method get invoked?
A. When a user submits a form
B. When a new session is created
C. When the servlet context is initialized
D. When a session is invalidated
11. (Choose 1 answer)

Which method is called when a servlet is being removed from service?
A. destroy()
B. stop()
C. end()
D. dispose()
12. (Choose 1 answer)

Which directory in Java Web Application contains the.jar libraries used by the application?
A. /WEB-INF/classes/
B. /WEB-INF/lib/
C. /META-INF/
D. /WEB-INF/config/
13. (Choose 1 answer)

Within a Java web application environment, which server component is responsible for managing the execution of Java Servlets and JavaServer Pages (JSP), supporting database connectivity through connection pooling, and providing transaction management capabilities using Java Transaction API (JTA)?
A. Apache Tomcat
B. Nginx
C. Oracle WebLogic Server
D. Microsoft IIS Server
14. (Choose 1 answer)

When a web request enters a Java web application with filters, how can the operation of the filters be best described?
A. Filters are processed in a random order, not resembling any data structure.
B. Filters are added to a stack-like structure as the request proceeds.
C. Filters form a queue where the first filter in is the first one out.
D. Filters operate in the alphabetical order of the filters name.
15. (Choose 1 answer)

In a Java web application, you need to iterate over a List<Map<String, Object>> stored in the request scope under the key dataList. Each Map represents a row of data with keys "id", "name", and "status". Using JSTL, which of the following correctly iterates over this list and displays only the name of entries where status equals "active"?
A. <c:forEach var="row" items="${dataList}"><c:if test="${row.status eq 'active'}">${row.name}</c:if></c:forEach>
B. <c:forEach var="row" items="${dataList}"><c:if test="${row.status.equals("active")}">${row.name}</c:if></c:forEach>
C. <c:forEach var="row" items="${dataList}"><c:when test="${row.status == 'active'}">${row.name}</c:when></c:forEach>
D. <c:forEach var="dataList" items="${row}"><c:if test="${row.status == 'active'}">${row.name}</c:if></c:forEach>
16. (Choose 1 answer)

What is a common pitfall when updating mutable objects stored as session attributes?
A. The container may not detect the change if you don't re-set the attribute.
B. You must always remove the session attribute before updating its contents.
C. Session attributes must be immutable.
D. Updates are always automatically replicated.
17. (Choose 1 answer)

Which directory is used to store external libraries (JAR files) in a Java web application?
A. /WEB-INF/lib
B. /WEB-INF/classes
C. /META-INF
D. Root directory
18. (Choose 1 answer)

What happens to a database transaction if an error occurs during its execution in a web application?
A. It is automatically rolled back
B. It continues with the next statement
C. It is committed regardless of the error
D. It waits for user intervention
19. (Choose 1 answer)

Which of the following is NOT a valid attribute of the <c:forEach> JSTL tag?
A. var
B. items
C. step
D. case
20. (Choose 1 answer)

Which lifecycle method is invoked when a Simple Tag Handler is first initialized?
A. doTag()
B. init()
C. processTag()
D. doStartTag()
21. (Choose 2 answers)

Assuming that all fields, methods in the class Book are ready. Which of the following is a correct way to access an attribute named "book" stored in a request scope using EL and display book id, book name in a JSP page? (choose two options)
A. ${requestScope.book.getId()}, ${requestScope.book.getName()}
B. <%= request.getAttribute("book")%>
C. <jsp:getProperty name="book" property="id"/>, <jsp:getProperty name="book" property="name"/>
D. ${requestScope.book.id}, ${requestScope.book.name}
E. ${applicationScope.book.id}, ${applicationScope.book.name}
22. (Choose 1 answer)

Which HTTP header is used to send cookies from the server to the client in a web application?
A. Set-Cookie
B. Cookie-Set
C. Cookie
D. Set-Cookie-Header
23. (Choose 1 answer)

What happens if we declare a Java Bean with a request scope, but then try to access it in another JSP page via EL (${beanName})?
A. The bean still exists and can be accessed
B. The bean will be destroyed when the request ends
C. A runtime error occurs
D. The bean will be saved to the session automatically
24. (Choose 1 answer)

What will a HTTP request contain?
A. A request method
B. A request URL
C. Header fields
D. Body
E. All of the others
25. (Choose 1 answer)

What is the role of the <servlet-mapping> element in web.xml?
A. It defines the servlet's initialization parameters
B. It maps a servlet to a URL pattern
C. It sets the servlet's session timeout
D. It specifies the servlet's version
26. (Choose 1 answer)

Consider the code in the demoServlet:
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
PrintWriter out = response.getWriter();
int fontsize=request.getParameter("size");
out.println("<font size="+ fontsize + ">" + request.getParameter("content") + "</font>");
out.close();
} protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
PrintWriter out = response.getWriter();
int fontsize=request.getParameter("size");
out.println("<font size="+ fontsize + ">" + request.getParameter("content") + "</font>");
out.close();
}
The code on the page index.jsp
<a href="demoServlet?size=12&content=hello">click</a>
<form action="demoServlet" method="get">
<input type="text" value="12" name="size">
<input type="submit" value="submit"></form> What is the best description when the client clicks the link or clicks the submit button?
A. Both doGet() and doPost() run concurrently. they generate an HTML <font> tag to display the "hello" content in the specified font size "12".
B. we need to fix an syntax-error in the doGet(), and doPost() method:
int fontsize = Integer.parseInt(request.getParameter("size"));
to prevent a compilation error
C. Only fix the bug in the doGet() method:
int fontsize = Integer.parseInt(request.getParameter("size"));
to display the content 'hello' in the specified font size of 12 because the request method is always GET
D. The form's method always is POST. So, we must update method="post" to method="get" to prevent a compilation error.
27. (Choose 1 answer)

In the contextInitialized method, what kind of tasks would you typically perform during the initialization of the servlet context?
A. Handling user requests
B. Initializing objects for database connections
C. Creating session objects
D. Configuring global application settings
28. (Choose 1 answer)

What is the primary purpose of using a PreparedStatement instead of a Statement when executing SQL queries in a Java web application?
A. PreparedStatement prevents SQL injection attacks
B. PreparedStatement provides better performance
C. PreparedStatement allows for dynamic SQL generation
D. PreparedStatement returns a more detailed error message
29. (Choose 1 answer)

Which of the following is the correct order of servlet life cycle phase methods?
A. init(), service(), destroy()
B. initialize(), service(), destroy()
C. init(), execute(), destroy()
D. init(), service(), delete()
30. (Choose 1 answer)

The MVC2 architecture separates the ________ from the presentation logic, allowing for a cleaner design UI.
A. Model
B. View
C. Controller
D. Data Access
31. (Choose 1 answer)

When a Servlet receives multiple requests from multiple clients simultaneously, what happens?
A. The Servlet creates a new instance for each request
B. The Servlet runs on multiple threads within the same instance
C. The Servlet processes each request sequentially
D. A new thread is created for each request and each thread has its own instance of the Servlet
32. (Choose 1 answer)

Gemini lỗi khi xử lý PRJ301 SP26 B5 FE RE_031.jpg: This model is currently experiencing high demand. Spikes in demand are usually temporary. Please try again later.
33. (Choose 1 answer)

Gemini lỗi khi xử lý PRJ301 SP26 B5 FE RE_032.jpg: This model is currently experiencing high demand. Spikes in demand are usually temporary. Please try again later.
34. (Choose 1 answer)

What happens when session.invalidate() is called?
A. The session is paused, but data remains
B. The session is completely destroyed, and all attributes are unbound
C. The session data is backed up for later restoration
D. All sessions on the server are invalidated and the users are logged out
35. (Choose 1 answer)

Which is true about JDBC?
A. The JDBC API is an extension of the ODBC API
B. All JDBC drivers are pure Java.
C. JDBC is used to connect to MOM (Message-Oriented Middleware Product)
D. The JDBC API is included in J2SE
36. (Choose 1 answer)

When is a ServletContext attribute available to servlets in a web application?
A. Only during the initialization of the servlet
B. During the entire lifecycle of the servlet container
C. Only during the processing of a specific HTTP request
D. Only during the destruction of the servlet
37. (Choose 1 answer)

Which phase of the JSP life cycle is responsible for processing custom tags?
A. Compilation phase
B. Translation phase
C. Execution phase
D. Initialization phase
38. (Choose 1 answer)

What is the primary purpose of the <body> tag in HTML?
A. To define the structure of the webpage
B. To specify the background color of the webpage
C. To contain the visible content of the webpage
D. To include external JavaScript files
39. (Choose 1 answer)

What is the purpose of the web.xml file in a Java web application?
A. Configuring servlets and filters
B. Writing Java business logic
C. Defining custom tags
D. Configuring connection between web-app and database
40. (Choose 1 answer)

What is the primary purpose of a filter in a web application?
A. To modify the header content before sending it to the client
B. To intercept and manipulate requests and responses
C. To authenticate users before accessing public resources
D. To handle database operations
41. (Choose 1 answer)

Which of the following is true about expressions in JSP?
A. They are used to declare variables
B. They execute Java code and return a value to be displayed in the client's response
C. They can include method definitions
D. They are executed only once per page load
42. (Choose 1 answer)

What is the purpose of a DataSource object in JDBC?
A. To store and retrieve session data
B. To define the structure of a database table
C. To manage a pool of database connections
D. To execute SQL queries
43. (Choose 1 answer)

When a user sends a request in an MVC application, which step happens first?
A. The model processes the request
B. The controller receives the request and processes it
C. The view updates the data
D. The database returns the result
44. (Choose 1 answer)

In MVC2 architecture, what role does the servlet typically play?
A. View
B. Controller
C. Model
D. None, servlets are not used in MVC2 architecture
45. (Choose 1 answer)

For what purpose is the <listener> tag used in a web deployment descriptor?
A. Configuring context parameters
B. Mapping listener to URL patterns
C. Defining listener classes that handle web events
D. Specifying servlet initialization parameters
46. (Choose 1 answer)

What is the purpose of the HTML <input> element with the type attribute set to "text"?
A. Displaying a multiline text area
B. Creating a checkbox
C. Accepting single-line text input
D. Selecting items from a dropdown list
47. (Choose 1 answer)

Which method of the PreparedStatement interface is used to set a parameter value in the SQL query?
A. setValue(int index, Object value)
B. setParameter(int index, Object value)
C. setInt(int index, int value)
D. setObject(int index, Object value)
48. (Choose 1 answer)

Which of the following protocols is currently supported by Servlets in Java EE 7?
A. FTP
B. SMTP
C. HTTP
D. WebSocket
49. (Choose 1 answer)

Which directory in a Java web application typically contains the web.xml deployment descriptor file?
A. /src
B. /WEB-INF
C. /META-INF
D. /WEB-CONTENT
50. (Choose 1 answer)

Which object is used in JSP to manage session?
A. session
B. request
C. config
D. context
 

Đính kèm

  • PRJ301 SP26 B5 FE RE_01.webp
    PRJ301 SP26 B5 FE RE_01.webp
    21.5 KB · Lượt xem: 4
  • PRJ301 SP26 B5 FE RE_02.webp
    PRJ301 SP26 B5 FE RE_02.webp
    36.6 KB · Lượt xem: 4
  • PRJ301 SP26 B5 FE RE_03.webp
    PRJ301 SP26 B5 FE RE_03.webp
    19.3 KB · Lượt xem: 3
  • PRJ301 SP26 B5 FE RE_04.webp
    PRJ301 SP26 B5 FE RE_04.webp
    30.9 KB · Lượt xem: 3
  • PRJ301 SP26 B5 FE RE_05.webp
    PRJ301 SP26 B5 FE RE_05.webp
    78.1 KB · Lượt xem: 3
  • PRJ301 SP26 B5 FE RE_06.webp
    PRJ301 SP26 B5 FE RE_06.webp
    29.6 KB · Lượt xem: 3
  • PRJ301 SP26 B5 FE RE_07.webp
    PRJ301 SP26 B5 FE RE_07.webp
    52.6 KB · Lượt xem: 3
  • PRJ301 SP26 B5 FE RE_08.webp
    PRJ301 SP26 B5 FE RE_08.webp
    23.6 KB · Lượt xem: 3
  • PRJ301 SP26 B5 FE RE_09.webp
    PRJ301 SP26 B5 FE RE_09.webp
    37 KB · Lượt xem: 3
  • PRJ301 SP26 B5 FE RE_10.webp
    PRJ301 SP26 B5 FE RE_10.webp
    29.6 KB · Lượt xem: 3
  • PRJ301 SP26 B5 FE RE_11.webp
    PRJ301 SP26 B5 FE RE_11.webp
    20.2 KB · Lượt xem: 3
  • PRJ301 SP26 B5 FE RE_12.webp
    PRJ301 SP26 B5 FE RE_12.webp
    25.4 KB · Lượt xem: 3
  • PRJ301 SP26 B5 FE RE_13.webp
    PRJ301 SP26 B5 FE RE_13.webp
    49 KB · Lượt xem: 3
  • PRJ301 SP26 B5 FE RE_14.webp
    PRJ301 SP26 B5 FE RE_14.webp
    48.4 KB · Lượt xem: 3
  • PRJ301 SP26 B5 FE RE_15.webp
    PRJ301 SP26 B5 FE RE_15.webp
    94.7 KB · Lượt xem: 3
  • PRJ301 SP26 B5 FE RE_16.webp
    PRJ301 SP26 B5 FE RE_16.webp
    42.5 KB · Lượt xem: 3
  • PRJ301 SP26 B5 FE RE_17.webp
    PRJ301 SP26 B5 FE RE_17.webp
    24.1 KB · Lượt xem: 3
  • PRJ301 SP26 B5 FE RE_18.webp
    PRJ301 SP26 B5 FE RE_18.webp
    33.3 KB · Lượt xem: 3
  • PRJ301 SP26 B5 FE RE_19.webp
    PRJ301 SP26 B5 FE RE_19.webp
    19.3 KB · Lượt xem: 3
  • PRJ301 SP26 B5 FE RE_20.webp
    PRJ301 SP26 B5 FE RE_20.webp
    22.3 KB · Lượt xem: 3
  • PRJ301 SP26 B5 FE RE_21.webp
    PRJ301 SP26 B5 FE RE_21.webp
    69.1 KB · Lượt xem: 3
  • PRJ301 SP26 B5 FE RE_22.webp
    PRJ301 SP26 B5 FE RE_22.webp
    24.7 KB · Lượt xem: 3
  • PRJ301 SP26 B5 FE RE_23.webp
    PRJ301 SP26 B5 FE RE_23.webp
    39.8 KB · Lượt xem: 3
  • PRJ301 SP26 B5 FE RE_24.webp
    PRJ301 SP26 B5 FE RE_24.webp
    19.8 KB · Lượt xem: 3
  • PRJ301 SP26 B5 FE RE_25.webp
    PRJ301 SP26 B5 FE RE_25.webp
    29.7 KB · Lượt xem: 3
  • PRJ301 SP26 B5 FE RE_26.webp
    PRJ301 SP26 B5 FE RE_26.webp
    80.5 KB · Lượt xem: 3
  • PRJ301 SP26 B5 FE RE_27.webp
    PRJ301 SP26 B5 FE RE_27.webp
    36.5 KB · Lượt xem: 3
  • PRJ301 SP26 B5 FE RE_28.webp
    PRJ301 SP26 B5 FE RE_28.webp
    47.2 KB · Lượt xem: 3
  • PRJ301 SP26 B5 FE RE_29.webp
    PRJ301 SP26 B5 FE RE_29.webp
    28.6 KB · Lượt xem: 3
  • PRJ301 SP26 B5 FE RE_30.webp
    PRJ301 SP26 B5 FE RE_30.webp
    23.7 KB · Lượt xem: 3
  • PRJ301 SP26 B5 FE RE_31.webp
    PRJ301 SP26 B5 FE RE_31.webp
    44.8 KB · Lượt xem: 3
  • PRJ301 SP26 B5 FE RE_32.webp
    PRJ301 SP26 B5 FE RE_32.webp
    26.1 KB · Lượt xem: 3
  • PRJ301 SP26 B5 FE RE_33.webp
    PRJ301 SP26 B5 FE RE_33.webp
    26.1 KB · Lượt xem: 3
  • PRJ301 SP26 B5 FE RE_34.webp
    PRJ301 SP26 B5 FE RE_34.webp
    36.6 KB · Lượt xem: 3
  • PRJ301 SP26 B5 FE RE_35.webp
    PRJ301 SP26 B5 FE RE_35.webp
    29.8 KB · Lượt xem: 3
  • PRJ301 SP26 B5 FE RE_36.webp
    PRJ301 SP26 B5 FE RE_36.webp
    35.7 KB · Lượt xem: 3
  • PRJ301 SP26 B5 FE RE_37.webp
    PRJ301 SP26 B5 FE RE_37.webp
    24.8 KB · Lượt xem: 3
  • PRJ301 SP26 B5 FE RE_38.webp
    PRJ301 SP26 B5 FE RE_38.webp
    31.9 KB · Lượt xem: 3
  • PRJ301 SP26 B5 FE RE_39.webp
    PRJ301 SP26 B5 FE RE_39.webp
    29.6 KB · Lượt xem: 3
  • PRJ301 SP26 B5 FE RE_40.webp
    PRJ301 SP26 B5 FE RE_40.webp
    35 KB · Lượt xem: 3
  • PRJ301 SP26 B5 FE RE_41.webp
    PRJ301 SP26 B5 FE RE_41.webp
    34.1 KB · Lượt xem: 3
  • PRJ301 SP26 B5 FE RE_42.webp
    PRJ301 SP26 B5 FE RE_42.webp
    29.5 KB · Lượt xem: 3
  • PRJ301 SP26 B5 FE RE_43.webp
    PRJ301 SP26 B5 FE RE_43.webp
    31.4 KB · Lượt xem: 3
  • PRJ301 SP26 B5 FE RE_44.webp
    PRJ301 SP26 B5 FE RE_44.webp
    22.7 KB · Lượt xem: 3
  • PRJ301 SP26 B5 FE RE_45.webp
    PRJ301 SP26 B5 FE RE_45.webp
    33.1 KB · Lượt xem: 3
  • PRJ301 SP26 B5 FE RE_46.webp
    PRJ301 SP26 B5 FE RE_46.webp
    31 KB · Lượt xem: 4
  • PRJ301 SP26 B5 FE RE_47.webp
    PRJ301 SP26 B5 FE RE_47.webp
    34 KB · Lượt xem: 4
  • PRJ301 SP26 B5 FE RE_48.webp
    PRJ301 SP26 B5 FE RE_48.webp
    20 KB · Lượt xem: 4
  • PRJ301 SP26 B5 FE RE_49.webp
    PRJ301 SP26 B5 FE RE_49.webp
    24.1 KB · Lượt xem: 3
  • PRJ301 SP26 B5 FE RE_50.webp
    PRJ301 SP26 B5 FE RE_50.webp
    17.4 KB · Lượt xem: 4
Sửa lần cuối:

Tạo tài khoản hoặc đăng nhập để bình luận

Bạn phải là thành viên mới có thể bình luận.

Tạo tài khoản

Hãy tạo tài khoản trên cộng đồng của chúng tôi. Thật dễ dàng!

Đăng nhập

Bạn đã có tài khoản? Đăng nhập tại đây.

Back
Top