Tag: web technology

Questions Related to web technology

What is wrong with the following code? } else { } %>

  1. Unmatched bracket in for statement

  2. Flush attribute must be false

  3. Keyword 'file' should be used instead of 'page' in the action

  4. Actions cannot be used within scriptlet blocks


Correct Option: D
  1. Cookie class can not take parameters in it's constructor

  2. The request object is used for creating cookies

  3. Although no error will be reported the use of the action means that the response object can't be used to create cookies

  4. The action must be placed inside the script block


Correct Option: C

In which file do we define a servlet mapping ?

  1. web.xml

  2. servlet.mappings

  3. servlet.xml

  4. Servlet.java


Correct Option: A
  1. java.servlet

  2. javax.servlet

  3. .servlet

  4. All are same


Correct Option: B
Explanation:

To solve this question, the user needs to know about the Java Servlets API and its interface.

The correct answer is:

B. javax.servlet

Explanation:

All the servlets must implement the Servlet interface of the javax.servlet package. The javax.servlet package contains a number of interfaces and classes that define the contracts between a servlet class and the runtime environment provided for an instance of such a class by a conforming servlet container. The javax.servlet package provides the base classes for defining HTTP servlets. Thus option B is correct.

Option A is incorrect because there is no package named java.servlet.

Option C is incorrect because the option is incomplete and doesn't provide the package name.

Option D is incorrect because there is only one correct option, and that is option B.

Therefore, the answer is: B. javax.servlet

A get request gets information from a client. A post request posts data to a client?

  1. True

  2. False

  3. Not always

  4. None of these


Correct Option: B