- Học kỳ
- SP2026
- Thời Gian
- 29/4/26
- Loại tài liệu
- FE
- Campus
- Hà Nội
PRJ301 SP26 B5 FE 10H50
Dưới đây là toàn bộ 50 câu hỏi trắc nghiệm từ tài liệu bạn cung cấp, giữ nguyên ngôn ngữ gốc, sắp xếp theo thứ tự tăng dần và bao gồm yêu cầu chọn đáp án:
Câu 1 (Multiple Choice - Choose 1 answer) What is inside a HTTP response?
- A. A result code and Header fields
- B. A request code and response code
- C. Body and ACK flag
- D. Body and Header fields
- E. Both A and D is true
- F. All of above
Câu 2 (Multiple Choice - Choose 1 answer) How does the GET method handle sensitive data compared to the POST method?
- A. GET encrypts data, ensuring secure transmission.
- B. POST is more suitable for secure data transfer.
- C. GET exposes sensitive data in the URL.
- D. GET can handle larger data volumes than POST.
Câu 3 (Multiple Choice - Choose 1 answer) What happens to request attributes when sendRedirect() is used?request.setAttribute("data", "value");<span>response.sendRedirect("result.jsp");</span>
- A. Attributes are retained
- B. Attributes are lost
- C. They are automatically sent to the next page
- D. They are converted to session attributes
Câu 4 (Multiple Choice - Choose 1 answer) How can you create a drop-down list in an HTML form?
- A. Using the <span><dropdown></span> element
- B. Using the <span><list></span> element
- C. Using the <span><select></span> element
- D. Using the <span><options></span> element
Câu 5 (Multiple Choice - Choose 1 answer) In a standard Java web application, where is the deployment descriptor (web.xml) typically located?
- A. /WEB-INF
- B. /META-INF
- C. /WEB-INF/classes
- D. Root directory
Câu 6 (Multiple Choice - Choose 1 answer) What is the primary function of a Servlet container in a Java web application?
- A. Handling static resources like HTML and CSS
- B. Executing server-side Java code (Servlets)
- C. Managing database connections
- D. Running JavaScript code on the client-side
Câu 7 (Multiple Choice - Choose 1 answer) Where is the deployment descriptor located?
- A. The deployment descriptor is located in the WEB-INF directory of the web application.
- B. The deployment descriptor is located in the WEB-INFS directory of the web application.
- C. The deployment descriptor is located in the WEBS-INF directory of the web application.
- D. The deployment descriptor is located in the WEBS directory of the web application.
Câu 8 (Multiple Choice - Choose 1 answer) Which of the following is NOT typically configured in the web.xml file of a Java web application?
- A. Servlet and URL mapping
- B. Initialization parameters
- C. Database table schema
- D. Filter configuration
Câu 9 (Multiple Choice - Choose 1 answer) What method is called in HttpServlet when using a href link to pass parameters to servlet?
- A. doPost(HttpServletRequest request, HttpServletResponse response)
- B. doPut(HttpServletRequest request, HttpServletResponse response)
- C. doGet(HttpServletRequest request, HttpServletResponse response)
- D. doDelete(HttpServletRequest request, HttpServletResponse response)
Câu 10 (Multiple Choice - Choose 1 answer) Examine this servlet codeWebServlet("/showParams")public class ShowParams Servlet extends HttpServlet { ... }(Context: uses <span>ctx.getInitParameterNames()</span> with web.xml entries <span>settingOne: foo</span> and <span>settingTwo: bar</span>) What will the servlet output?
- A. foo bar
- B. settingOne: foo settingTwo: bar
- C. settingTwo: bar settingOne: foo
- D. settingOne settingTwo
Câu 11 (Multiple Choice - Choose 1 answer) What is the function of the <span><jsp:forward></span> tag in JSP?
- A. Sends a permanent redirect to the browser
- B. Includes another JSP page's content during request processing
- C. Transfers request control to another resource on the server
- D. Returns the response to the calling servlet
Câu 12 (Multiple Choice - Choose 1 answer) Which servlet method retrieves a servlet's initialization parameter defined in the web.xml?
- A. <span>getServletConfig().getInitParameter("paramName")</span>
- B. <span>getServletContext().getInitParameter("paramName")</span>
- C. <span>getInitParameter("paramName")</span>
- D. <span>getConfig().getParameter("paramName")</span>
Câu 13 (Multiple Choice - Choose 1 answer) What is the purpose of request attributes in servlet collaboration?
- A. To store data that can be shared across multiple servlets within the same request.
- B. To store data that can be shared only within the same servlet.
- C. To store data that can be shared across multiple servlets in the same session.
- D. To store data that can be accessed by any servlet in the application.
Câu 14 (Multiple Choice - Choose 1 answer) What is the purpose of the <span><url-pattern></span> element in the servlet mapping configuration?
- A. To define the servlet's class name
- B. To specify the context path of the web application
- C. To set the URL address that maps to a servlet
- D. To configure filter mappings
Câu 15 (Multiple Choice - Choose 1 answer) Consider the code:<%@ taglib uri="You do not have permission to view link Đăng nhập hoặc Đăng ký." prefix="c" %><span><c:set var="x" value="10" /> <c:set var="y" value="5" /> ${x+y}</span> What is the incorrect output produced by the JSP page above?
- A. 15
- B. 10 + 5
- C. 510
- D. 105
Câu 16 (Multiple Choice - Choose 1 answer) For generating an HTML page in JSP, which content type must be set using the page directive?
- A. text/xml
- B. text/plain
- C. text/html
- D. application/json
Câu 17 (Multiple Choice - Choose 1 answer) Which tag is used to declare a variable or method in JSP?
- A. <span><var></span>
- B. <span><declare></span>
- C. <span><scriptlet></span>
- D. <%! <span>%></span>
Câu 18 (Multiple Choice - Choose 1 answer) Which implicit object in JSP provides access to the servlet context and can be used to store and retrieve application-wide information?
- A. pageContext
- B. request
- C. application
- D. session
Câu 19 (Multiple Choice - Choose 1 answer) Through which implicit object can you access parameters passed to the JSP page?
- A. params
- B. request
- C. input
- D. getParameters
Câu 20 (Multiple Choice - Choose 1 answer) Which of the following statements about JSTL is not valid?
- A. JSTL improves readability over scriptlets
- B. JSTL completely replaces servlets for business logic
- C. JSTL requires importing core and optional tag libraries
- D. JSTL provides tags for iteration, conditionals, and internationalization
Câu 21 (Multiple Choice - Choose 1 answer) If you forget to close the JDBC connection (Connection), what can happen?
- A. Data can be lost
- B. The application will automatically release the connection
- C. The number of connections to the database can be exhausted (Connection Leak)
- D. Nothing happens
Câu 22 (Multiple Choice - Choose 1 answer) When to use PreparedStatement instead of Statement?
- A. When there is a static SQL query that does not change
- B. When executing the same query multiple times with different parameters
- C. When a stored procedure needs to be called
- D. When the query has no parameters
Câu 23 (Multiple Choice - Choose 1 answer) How do you manage database transaction with JDBC driver?
- A. Explicit transaction management by invoke con.beginTrans()
- B. Turn off auto commit mode from DBSM for implicit transaction
- C. It is automatically managed by DBMS
- D. Invoke con.commit() or con.rollback()
Câu 24 (Multiple Choice - Choose 1 answer) Which component of the MVC architecture is responsible for presenting data to the user in a web application?
- A. Model
- B. View
- C. Controller
- D. Service
Câu 25 (Multiple Choice - Choose 1 answer) Given the code: <span>HttpSession session = request.getSession(); session.setAttribute("username", "HuyNM");</span> Which of the following is incorrect?
- A. The session must exist or be created automatically
- B. The attribute "username" can be retrieved later using the same session
- C. The attribute will persist across multiple HTTP requests
- D. The attribute is stored in the client browser's local storage
Câu 26 (Multiple Choice - Choose 1 answer) Which is NOT considered a standard component of a typical MVC architecture in web applications?
- A. Database
- B. Model
- C. View
- D. Controller
Câu 27 (Multiple Choice - Choose 1 answer) In a multi-tier data model, which layer is responsible for handling application logic?
- A. User Interface App Layer
- B. Application Logic Layer
- C. Data Layer
- D. Connection Layer
Câu 28 (Multiple Choice - Choose 1 answer) To get the value of an attribute saved in the session, which method do we use?
- A. session.getParameter(String name)
- B. session.getValue(String name)
- C. session.getAttribute(String name)
- D. session.fetchAttribute(String name)
Câu 29 (Multiple Choice - Choose 1 answer) What happens if you call <span>request.getSession(false);</span> when no session exists?
- A. A new session is created
- B. Returns null
- C. IllegalStateException is thrown
- D. The old session is reset
Câu 30 (Multiple Choice - Choose 1 answer) In the doGet method, how to create a Cookie and send it to the client?
- A. <span>Cookie newCookie = new Cookie("username", "john_doe"); response.addCookie(newCookie);</span>
- B. <span>response.setCookie("username", "john_doe");</span>
- C. <span>request.createCookie("username", "john_doe"); response.sendCookie();</span>
- D. <span>Cookie.create("username", "john_doe"); response.writeCookie();</span>
Câu 31 (Multiple Choice - Choose 1 answer) How to store a value in ServletContext from a Servlet?
- A. <span>context.setAttribute("key", value);</span>
- B. <span>request.setAttribute("key", value);</span>
- C. <span>session.setAttribute("key", value);</span>
- D. <span>response.setAttribute("key", value);</span>
Câu 32 (Multiple Choice - Choose 1 answer) Consider the code in the <span>LoggingFilter</span> and the <span>web.xml</span> configuration. Arrange the following steps correctly to describe the processing inside server when a client requests <span>index.jsp</span>:
- LoggingFilter intercepts the request.
- Server compiles and processes JSP to HTML.
- HTML content is sent to client's browser.
- Request continues to index.jsp.
- HTML response is sent back to LoggingFilter.
- A. 1-4-2-5-3
- B. 1-5-4-2-3
- C. 1-2-5-3
- D. 1-4-5-3
Câu 33 (Multiple Choice - Choose 1 answer) Given a Java class Employee with a field named <span>tel</span>, consider EL code <span>${emp.tel}</span>. Which statement accurately describes the requirements for accessing the <span>tel</span> field?
- A. The tel field must be declared as public, and no getter method is required.
- B. The tel field may be private, but a getTel() method must be provided.
- C. Both A and B are correct
- D. Neither A nor B is correct
Câu 34 (Multiple Choice - Choose 1 answer) When accessing <span>${sessionScope.cart.items[0]}</span>, what happens?
- A. Retrieve the first element of the items array in the cart object from the session
- B. EL will return null if the cart does not exist in the session
- C. Error because EL does not support array retrieval
- D. Both A and B are correct
Câu 35 (Multiple Choice - Choose 1 answer) How would you use EL to access a property named <span>title</span> from a Map object within a List named <span>bookList</span> at index 2?
- A. <span>${bookList[12].title}</span>
- B. <span>${bookList.get(2).title}</span>
- C. <span>${bookList["2"].title}</span>
- D. <span>${bookList.title[2]}</span>
- E. <span>${bookList[2].title}</span>
Câu 36 (Multiple Choice - Choose 1 answer) Which interface must be implemented to create a custom listener for session-related events?
- A. HttpSessionListener
- B. ServletRequestListener
- C. ServletContextListener
- D. ServletResponseListener
Câu 37 (Multiple Choice - Choose 1 answer) In Java web development, what is the primary role of a ServletContextListener?
- A. Handling HTTP requests and generating responses.
- B. Managing sessions and cookies for clients.
- C. Observing changes in the lifecycle of the ServletContext.
- D. Interacting with databases to perform CRUD operations.
Câu 38 (Multiple Choice - Choose 1 answer) What does a session listener do in a web application?
- A. It listens to and records conversations
- B. It watches for changes in user sessions, like when someone logs in or out
- C. It changes session data
- D. It helps users navigate through the application
Câu 39 (Multiple Choice - Choose 1 answer) What is the purpose of a Session Listener in a Java web application?
- A. To listen for changes in session attributes
- B. To listen for changes in application context parameters
- C. To listen for changes in request parameters
- D. To listen for changes in session lifecycle events
Câu 40 (Multiple Choice - Choose 1 answer) Given JSTL code: <span><c:url value="/app/item" var="myUrl"> <caram name="type" value="book" /> ... </c:url></span> What is the correct output of <span>${myUrl}</span>?
- A. /app/item?type=book&id=123
- B. /app/item?type=id&book=123
- C. /app/item
- D. Nothing will be printed out
- E. The JSP failed to compile
Câu 41 (Multiple Choice - Choose 1 answer) What is the purpose of the <span><c:catch></span> tag in JSTL?
- A. It catches exceptions thrown during the execution of its body content.
- B. It handles errors thrown by JSP expressions.
- C. It catches HTTP errors and redirects to an error page.
- D. It encapsulates code to be executed asynchronously.
Câu 42 (Multiple Choice - Choose 1 answer) Which JSTL tag is used to format dates and times according to the user's locale?
- A. <span><fmt:setTimeZone></span>
- B. <span><fmt:setLocale></span>
- C. <span><fmt:formatDate></span>
- D. <span><fmt:setBundle></span>
Câu 43 (Multiple Choice - Choose 1 answer) What's the point of using <span><fmt:setLocale></span> in a JSP?
- A. To pick the main language for the website.
- B. To tell other tags which language and country format to use.
- C. To change the user's language settings.
- D. To choose the language for database information.
Câu 44 (Multiple Choice - Choose 1 answer) Which interface needs to be implemented to create a custom tag handler class?
- A. javax.servlet.Servlet
- B. javax.servlet.filter.Filter
- C. javax.servlet.jsp.tagext.Tag
- D. javax.servlet.http.HttpServlet
Câu 45 (Multiple Choice - Choose 1 answer) Which attribute of the <span><jsp:directive.tag></span> element is used to specify the Java class that implements a Simple Tag Handler?
- A. tagclass
- B. class
- C. handler
- D. implementation
Câu 46 (Multiple Choice - Choose 1 answer) What is the role of the setBodyContent() method in the BodyTag interface?
- A. It sets the body content of the custom tag.
- B. It returns the body content as a string.
- C. It initializes the BodyContent object for the tag.
- D. It releases any resources associated with the body content.
Câu 47 (Multiple Choice - Choose 1 answer) In the context of web filters, what does "pre-processing" of a request mean?
- A. Changing the response sent to the client.
- B. Handling the request before it reaches the servlet or resource.
- C. Altering the client's browser settings.
- D. Encrypting the request data.
Câu 48 (Multiple Choice - Choose 1 answer) Filter can be defined in which file?
- A. web.xml
- B. In Java @WebFilter annotation
- C. Both A and B
- D. No need to define, just implement in Servlet
Câu 49 (Multiple Choice - Choose 1 answer) When is the destroy() method of a servlet filter called?
- A. At the end of the filter's lifecycle
- B. Before each doFilter() method call
- C. After the web application is undeployed
- D. Immediately after the filter's first invocation
Câu 50 (Multiple Choice - Choose 1 answer) In a Java web application, when two filters match an incoming request—one via a URL pattern and the other via a Servlet name—which filter takes precedence?
- A. The filter matching the request via a URL pattern.
- B. The filter matching the request via a servlet name.
- C. The filter declared first in the deployment descriptor.
- D. The filter processed in alphabetical order based on its name.
Đính kèm
-
PRJ301 SP26 B5 FE_001.webp45.3 KB · Lượt xem: 5 -
PRJ301 SP26 B5 FE_002.webp52.8 KB · Lượt xem: 4 -
PRJ301 SP26 B5 FE_003.webp45.1 KB · Lượt xem: 5 -
PRJ301 SP26 B5 FE_004.webp42.4 KB · Lượt xem: 4 -
PRJ301 SP26 B5 FE_005.webp32.3 KB · Lượt xem: 4 -
PRJ301 SP26 B5 FE_006.webp52.8 KB · Lượt xem: 5 -
PRJ301 SP26 B5 FE_007.webp68 KB · Lượt xem: 5 -
PRJ301 SP26 B5 FE_008.webp37.7 KB · Lượt xem: 5 -
PRJ301 SP26 B5 FE_009.webp67 KB · Lượt xem: 6 -
PRJ301 SP26 B5 FE_010.webp137.6 KB · Lượt xem: 4 -
PRJ301 SP26 B5 FE_011.webp59.3 KB · Lượt xem: 1 -
PRJ301 SP26 B5 FE_012.webp53.2 KB · Lượt xem: 1 -
PRJ301 SP26 B5 FE_013.webp64.9 KB · Lượt xem: 1 -
PRJ301 SP26 B5 FE_014.webp48.7 KB · Lượt xem: 1 -
PRJ301 SP26 B5 FE_015.webp62.4 KB · Lượt xem: 1 -
PRJ301 SP26 B5 FE_016.webp31.4 KB · Lượt xem: 1 -
PRJ301 SP26 B5 FE_017.webp29.6 KB · Lượt xem: 1 -
PRJ301 SP26 B5 FE_018.webp32.5 KB · Lượt xem: 1 -
PRJ301 SP26 B5 FE_019.webp30.8 KB · Lượt xem: 1 -
PRJ301 SP26 B5 FE_020.webp62.1 KB · Lượt xem: 1 -
PRJ301 SP26 B5 FE_021.webp50.1 KB · Lượt xem: 1 -
PRJ301 SP26 B5 FE_022.webp60.8 KB · Lượt xem: 1 -
PRJ301 SP26 B5 FE_023.webp58.8 KB · Lượt xem: 1 -
PRJ301 SP26 B5 FE_024.webp27.7 KB · Lượt xem: 1 -
PRJ301 SP26 B5 FE_025.webp81 KB · Lượt xem: 1 -
PRJ301 SP26 B5 FE_026.webp29.5 KB · Lượt xem: 1 -
PRJ301 SP26 B5 FE_027.webp41.9 KB · Lượt xem: 1 -
PRJ301 SP26 B5 FE_028.webp49.8 KB · Lượt xem: 1 -
PRJ301 SP26 B5 FE_029.webp42.4 KB · Lượt xem: 1 -
PRJ301 SP26 B5 FE_030.webp89 KB · Lượt xem: 1 -
PRJ301 SP26 B5 FE_031.webp48.7 KB · Lượt xem: 1 -
PRJ301 SP26 B5 FE_032.webp133.6 KB · Lượt xem: 1 -
PRJ301 SP26 B5 FE_033.webp68.7 KB · Lượt xem: 1 -
PRJ301 SP26 B5 FE_034.webp55.1 KB · Lượt xem: 1 -
PRJ301 SP26 B5 FE_035.webp38 KB · Lượt xem: 1 -
PRJ301 SP26 B5 FE_036.webp37.5 KB · Lượt xem: 1 -
PRJ301 SP26 B5 FE_037.webp60.7 KB · Lượt xem: 1 -
PRJ301 SP26 B5 FE_038.webp52.2 KB · Lượt xem: 2 -
PRJ301 SP26 B5 FE_039.webp59 KB · Lượt xem: 1 -
PRJ301 SP26 B5 FE_040.webp70.7 KB · Lượt xem: 1 -
PRJ301 SP26 B5 FE_041.webp60.3 KB · Lượt xem: 2 -
PRJ301 SP26 B5 FE_042.webp35.9 KB · Lượt xem: 1 -
PRJ301 SP26 B5 FE_043.webp55.8 KB · Lượt xem: 1 -
PRJ301 SP26 B5 FE_044.webp43.3 KB · Lượt xem: 1 -
PRJ301 SP26 B5 FE_045.webp29.9 KB · Lượt xem: 2 -
PRJ301 SP26 B5 FE_046.webp59.4 KB · Lượt xem: 1 -
PRJ301 SP26 B5 FE_047.webp56.6 KB · Lượt xem: 1 -
PRJ301 SP26 B5 FE_048.webp36 KB · Lượt xem: 1 -
PRJ301 SP26 B5 FE_049.webp49.8 KB · Lượt xem: 2 -
PRJ301 SP26 B5 FE_050.webp55.2 KB · Lượt xem: 4