- Học kỳ
- SP2026
- Thời Gian
- 29/4/26
- Loại tài liệu
- FE
- Campus
- Hà Nội
PRJ302 SP26 B5 FE 10H50
Dưới đây là toàn bộ 50 câu hỏi trắc nghiệm từ tệp tin bạn cung cấp, được sắp xếp theo thứ tự tăng dần:
Câu 1: What is inside a HTTP response? Multiple Choice 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: How does the GET method handle sensitive data compared to the POST method? Multiple Choice 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: What happens to request attributes when sendRedirect() is used? request.setAttribute("data", "value"); response.sendRedirect("result.jsp"); Multiple Choice 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: How can you create a drop-down list in an HTML form? Multiple Choice A Using the element B Using the element C Using the element D Using the element
Câu 5: In a standard Java web application, where is the deployment descriptor (web.xml) typically located? Multiple Choice A WEB-INF B /META-INF C /WEB-INF/classes D Root directory
Câu 6: What is the primary function of a Servlet container in a Java web application? Multiple Choice 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: Where is the deployment descriptor located? Multiple Choice 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: Which of the following is NOT typically configured in the web.xml file of a Java web application? Multiple Choice A Servlet and URL mapping B Initialization parameters C Database table schema D Filter configuration
Câu 9: What method is called in HttpServlet when using a href link to pass parameters to servlet? Multiple Choice 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: Examine this servlet code: @WebServlet("/showParams") public class ShowParams Servlet extends HttpServlet { } @Override protected void doGet(HttpServletRequest request, HttpServletResponse response) } throws ServletException, IOException { ServletContext ctx = getServletContext(); PrintWriter out = response.getWriter(); Enumeration paramNames = ctx.getInitParameterNames(); while(paramNames.hasMoreElements()) { } String name paramNames.nextElement(); out.println(name + ":" + ctx.getInitParameter(name)); If web.xml has the following entries: settingOne foo setting Two bar What will the servlet output? Multiple Choice A foo bar B settingOne: foo setting Two: bar C setting Two: bar settingOne: foo D settingOne setting Two
Câu 11: What is the function of theYou do not have permission to view link Đăng nhập hoặc Đăng ký.tag in JSP? Multiple Choice 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: Which servlet method retrieves a servlet's initialization parameter defined in the web.xml? Multiple Choice A getServletConfig().getInitParameter("paramName") B getServletContext().getInitParameter("paramName") C getInitParameter("paramName") D getConfig().getParameter("paramName")
Câu 13: What is the purpose of request attributes in servlet collaboration? Multiple Choice 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: What is the purpose of the element in the servlet mapping configuration? Multiple Choice 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: Consider the code written on a JSP page that has the following content. <%@ taglib uri="You do not have permission to view link Đăng nhập hoặc Đăng ký." prefix ="c" %> <c:set var ="x" value ="10" /> <c:set var ="y" value ="5" /> ${x+y} What is the incorrect output produced by the JSP page above? Multiple Choice A 15 B 10+5 C 510 D 105
Câu 16: For generating an HTML page in JSP, which content type must be set using the page directive? Multiple Choice A text/xml B text/plain C text/html D application/json
Câu 17: Which tag is used to declare a variable or method in JSP? Multiple Choice A B C D <%! %>
Câu 18: Which implicit object in JSP provides access to the servlet context and can be used to store and retrieve application-wide information? Multiple Choice A pageContext B request C application D session
Câu 19: Through which implicit object can you access parameters passed to the JSP page? Multiple Choice A params B request C input D getParameters
Câu 20: Which of the following statements about JSTL is not valid? Multiple Choice 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: If you forget to close the JDBC connection (Connection), what can happen? Multiple Choice 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: When to use PreparedStatement instead of Statement? Multiple Choice 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: How do you manage database transaction with JDBC driver? Multiple Choice 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: Which component of the MVC architecture is responsible for presenting data to the user in a web application? Multiple Choice A Model B View C Controller D Service
Câu 25: Given the code below: HttpSession session = request.getSession(); session.setAttribute("username", "HuyNM"); Which of the following is incorrect? Multiple Choice 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: Which is NOT considered a standard component of a typical MVC architecture in web applications? Multiple Choice A Database B Model C View D Controller
Câu 27: In a multi-tier data model, which layer is responsible for handling application logic? Multiple Choice A User Interface App Layer B Application Logic Layer C Data Layer D Connection Layer
Câu 28: To get the value of an attribute saved in the session, which method do we use? Multiple Choice A session.getParameter(String name) B session.getValue(String name)) C session.getAttribute(String name) D session.fetchAttribute(String name)
Câu 29: What happens if you call request.getSession(false); when no session exists? Multiple Choice A A new session is created B Returns null C IllegalStateException is thrown D The old session is reset
Câu 30: In the doGet method, how to create a Cookie and send it to the client? Multiple Choice A Cookie newCookie = new Cookie("username", "john_doe"); response.addCookie(newCookie); B response.setCookie("username", "john_doe"); C request.createCookie("username", "john_doe"); response.sendCookie(); D Cookie.create("username", "john_doe"); response.writeCookie();
Câu 31: How to store a value in ServletContext from a Servlet? Multiple Choice A context.setAttribute("key", value); B request.setAttribute("key", value); C session.setAttribute("key", value); D response.setAttribute("key", value);
Câu 32: Assuming that the client sends a request to open the index.jsp page, arrange the following steps correctly to describe the processing inside server. 1: the LoggingFilter intercepts the request to display current date. 2: the server compiles and processes the JSP file to generates an HTML response. 3: The final HTML content from index.jsp is sent back to the client's browser. 4: the request continues to index.jsp. 5: the HTML response from index.jsp is sent back to the LoggingFilter. Multiple Choice 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: Given a Java class Employee with a field named tel, consider the following Expression Language (EL) code, where emp is an instance of the Employee class: $(emp.tel) Which of the following statements accurately describes the requirements for accessing and displaying the tel field using this EL expression? Multiple Choice 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: When accessing $(sessionScope.cart.items[0] , what happens? Multiple Choice 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: How would you use EL to access a property named title from a Map object within a List named bookList at index 2? Multiple Choice A $(bookList[12].title} B $(bookList.get(2).title) C $ bookList["2"].title} D $ bookList.title[2]) E $(bookList[2].title)
Câu 36: Which interface must be implemented to create a custom listener for session-related events in Java web development? Multiple Choice A HttpSessionListener B ServletRequestListener C ServletContextListener D ServletResponseListener
Câu 37: In Java web development, what is the primary role of a ServletContextListener? Multiple Choice 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: What does a session listener do in a web application? Multiple Choice 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: What is the purpose of a Session Listener in a Java web application? Multiple Choice 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: Given this JSTL code, what is the correct output of ${myUrl}? <c:url value="/app/item" var="myUrl" scope="page"> <caram name="type" value="book" /> <c
aram name ="id" value ="123" /> </c:url> ${myUrl} Multiple Choice 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: What is the purpose of the <c:catch> tag in JSTL? Multiple Choice 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: Which JSTL tag is used to format dates and times according to the user's locale? Multiple Choice A BYou do not have permission to view link Đăng nhập hoặc Đăng ký.CYou do not have permission to view link Đăng nhập hoặc Đăng ký.DYou do not have permission to view link Đăng nhập hoặc Đăng ký.
Câu 43: What's the point of using in a JSP? Multiple Choice 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: Which interface needs to be implemented to create a custom tag handler class? Multiple Choice A javax.servlet.Servlet B javax.servlet.filter Filter C javax.servlet.jsp.tagext.Tag D javax.servlet.http.HttpServlet
Câu 45: Which attribute of theYou do not have permission to view link Đăng nhập hoặc Đăng ký.element is used to specify the Java class that implements a Simple Tag Handler? Multiple Choice A tagclass B class C handler D implementation
Câu 46: What is the role of the setBodyContent() method in the Body Tag interface? Multiple Choice 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: In the context of web filters, what does "pre-processing" of a request mean? Multiple Choice 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: Filter can be defined in which file? Multiple Choice 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: When is the destroy() method of a servlet filter called? Multiple Choice 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: 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 in the processing chain? Multiple Choice 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
-
PRJ302 SP26 B5 FE_001.webp45.9 KB · Lượt xem: 5 -
PRJ302 SP26 B5 FE_002.webp53.1 KB · Lượt xem: 3 -
PRJ302 SP26 B5 FE_003.webp45 KB · Lượt xem: 2 -
PRJ302 SP26 B5 FE_004.webp42.7 KB · Lượt xem: 3 -
PRJ302 SP26 B5 FE_005.webp32 KB · Lượt xem: 2 -
PRJ302 SP26 B5 FE_006.webp54.1 KB · Lượt xem: 2 -
PRJ302 SP26 B5 FE_007.webp69.6 KB · Lượt xem: 2 -
PRJ302 SP26 B5 FE_008.webp37.7 KB · Lượt xem: 1 -
PRJ302 SP26 B5 FE_009.webp67.7 KB · Lượt xem: 1 -
PRJ302 SP26 B5 FE_010.webp137.8 KB · Lượt xem: 1 -
PRJ302 SP26 B5 FE_011.webp61.3 KB · Lượt xem: 1 -
PRJ302 SP26 B5 FE_012.webp53.9 KB · Lượt xem: 1 -
PRJ302 SP26 B5 FE_013.webp66.2 KB · Lượt xem: 1 -
PRJ302 SP26 B5 FE_014.webp48 KB · Lượt xem: 1 -
PRJ302 SP26 B5 FE_015.webp62.8 KB · Lượt xem: 1 -
PRJ302 SP26 B5 FE_016.webp30.8 KB · Lượt xem: 1 -
PRJ302 SP26 B5 FE_017.webp29.3 KB · Lượt xem: 1 -
PRJ302 SP26 B5 FE_018.webp32.3 KB · Lượt xem: 1 -
PRJ302 SP26 B5 FE_019.webp30.9 KB · Lượt xem: 1 -
PRJ302 SP26 B5 FE_020.webp63.8 KB · Lượt xem: 1 -
PRJ302 SP26 B5 FE_021.webp49.9 KB · Lượt xem: 1 -
PRJ302 SP26 B5 FE_022.webp62.8 KB · Lượt xem: 1 -
PRJ302 SP26 B5 FE_023.webp60.8 KB · Lượt xem: 1 -
PRJ302 SP26 B5 FE_024.webp27.1 KB · Lượt xem: 1 -
PRJ302 SP26 B5 FE_025.webp83 KB · Lượt xem: 1 -
PRJ302 SP26 B5 FE_026.webp29.1 KB · Lượt xem: 1 -
PRJ302 SP26 B5 FE_027.webp42.2 KB · Lượt xem: 1 -
PRJ302 SP26 B5 FE_028.webp50.6 KB · Lượt xem: 1 -
PRJ302 SP26 B5 FE_029.webp42.2 KB · Lượt xem: 1 -
PRJ302 SP26 B5 FE_030.webp90.6 KB · Lượt xem: 1 -
PRJ302 SP26 B5 FE_031.webp49.6 KB · Lượt xem: 1 -
PRJ302 SP26 B5 FE_032.webp134 KB · Lượt xem: 1 -
PRJ302 SP26 B5 FE_033.webp69.1 KB · Lượt xem: 1 -
PRJ302 SP26 B5 FE_034.webp55.9 KB · Lượt xem: 1 -
PRJ302 SP26 B5 FE_035.webp37.8 KB · Lượt xem: 1 -
PRJ302 SP26 B5 FE_036.webp37.3 KB · Lượt xem: 1 -
PRJ302 SP26 B5 FE_037.webp61.2 KB · Lượt xem: 1 -
PRJ302 SP26 B5 FE_038.webp52.6 KB · Lượt xem: 1 -
PRJ302 SP26 B5 FE_039.webp60.8 KB · Lượt xem: 1 -
PRJ302 SP26 B5 FE_040.webp72 KB · Lượt xem: 1 -
PRJ302 SP26 B5 FE_041.webp61.7 KB · Lượt xem: 1 -
PRJ302 SP26 B5 FE_042.webp36.3 KB · Lượt xem: 1 -
PRJ302 SP26 B5 FE_043.webp57.9 KB · Lượt xem: 1 -
PRJ302 SP26 B5 FE_044.webp43.4 KB · Lượt xem: 1 -
PRJ302 SP26 B5 FE_045.webp29.7 KB · Lượt xem: 1 -
PRJ302 SP26 B5 FE_046.webp60.9 KB · Lượt xem: 1 -
PRJ302 SP26 B5 FE_047.webp58.4 KB · Lượt xem: 1 -
PRJ302 SP26 B5 FE_048.webp36.5 KB · Lượt xem: 2 -
PRJ302 SP26 B5 FE_049.webp51.1 KB · Lượt xem: 2 -
PRJ302 SP26 B5 FE_050.webp55.6 KB · Lượt xem: 5