MCQ Bank
HTTP response code 100s indicates ________________ .
- A) do not continue with any request
- B) to continue without request
- C) to continue with partial request
- D) to continue with complete request
web.xml is a ___________
- A) java file
- B) configuration file
- C) jar file
- D) servlet file
Servlets are java technology’s answer to ________ programming.
- A) C++
- B) Perl
- C) CGI
- D) C
Which of the following is NOT a web technoloy of Java?
- A) ASP
- B) JSP
- C) JSF
- D) Servlet
Which of the following range of response code signify error by server?
- A) 200-299
- B) 400-499
- C) 500-599
- D) 300-399
Which of the following approach can used to create threads in java?
- A) Abstraction
- B) Composition
- C) Polymorphism
- D) Inheritance
Which of the following interface needs to implement while creating threads?
- A) ActionListener
- B) Serializable
- C) WindowListener
- D) Runnable
Which of the following problem occurs with lower priority threads?
- A) Average waiting time
- B) Starvation
- C) Process death
- D) Race condition
If attribute is "name" and value is "ahmad" then the GET request will be ____________________ .
- A) http://www.gmail.com/register&name=ahmad
- B) http://www.gmail.com/register?name=ahmad
- C) http://www.gmail.com/register?name.ahmad
- D) http://www.gmail.com/register#name=ahmad
Which of the following statements about Servlets is true?
- A) Servlets are written in PHP.
- B) Servlets are only used for static web content.
- C) Servlets handle requests and generate dynamic responses.
- D) Servlets are platform-specific and cannot run on different servers.
How to add a Cookie object to a HttpServletResponse in Java servlets?
- A) Using response.sendCookie(cookie);
- B) Using response.setCookie(cookie);
- C) Using response.addCookie(cookie);
- D) Using response.createCookie(cookie);
The method "getAttribute(String)" of HttpSession class extracts ______________ stored value from a session object.
- A) Previously
- B) Currently
- C) First
- D) Subsequently
Which keyword is used to declare a package in Java?
- A) import
- B) namespace
- C) include
- D) package
What is the purpose of JSP?
- A) To manage server configurations and deployments.
- B) To handle client-side scripting in web applications.
- C) To generate dynamic web content using Java code.
- D) To define the structure and styling of web pages.
Which method is used to encode a URL for URL rewriting in Java Servlets?
- A) response.encodeURL(String url)
- B) context.encodeURL(String url)
- C) session.encodeURL(String url)
- D) request.encodeURL(String url)
Servlet mapping is defined in ________
- A) html
- B) web.xml
- C) servlet
- D) JSP
Which of the following is the correct format of writing an include directive in JSP?
- A) <%# include {attribute=”val”} %>
- B) <%! include {attribute=”val”} %>
- C) <%$ include {attribute=”val”} %>
- D) <%@ include {attribute=”val”} %>
Which of the following object contains information specific to a servlet?
- A) ServletContext
- B) ServletRequest
- C) ServletResponse
- D) ServletConfig
Where are cookies typically stored?
- A) On the website's server
- B) In the website's HTML code
- C) In the user's computer's RAM
- D) In a specific folder on the user's device
Is it true "server considers each request independent from other even if the requests are made by the same client"?
- A) No
- B) Yes
- C)
- D)