0

programming languages Online Quiz - 328

Description: programming languages Online Quiz - 328
Number of Questions: 20
Created by:
Tags: programming languages
Attempted 0/20 Correct 0 Score 0
  1. 1) It is a valid line that can be used to initialize the servlet that implements the jsp file.

  2. 2) It won't compile as no identifer can start with jsp not _jsp.

  3. 3) It will serve as the servlet initialization if the function's name is _jspInit.

  4. 4) There is no way to initialize a jsp's implementation class servlet.


Correct Option: A
  1. 1) It won't compile.

  2. 2) It will print the default client's Web browser locale.

  3. 3) It will print the default web server Locale.

  4. 4) It will the first language specified in the Accept-Language request's header.


Correct Option: A
  1. 1)It won't compile

  2. 2)It will print the session id.

  3. 3)It will produce a NullPointerException as the getSession(false) method's call returns null, cause no session had been created.

  4. 4)It will produce an empty page.


Correct Option: B

What statements are correct about the method PageContext.findAttribute(String name)?

  1. 1) There is no such method.

  2. 2) It searches the attribute in all 4 scopes.

  3. 3) It searches the attribute in page scope.

  4. 4) The method is findAttribute(String name, int scope)


Correct Option: B
  1. 1) web-resource-name

  2. 2) url-pattern

  3. 3) http-method

  4. 4) auth-constraint


Correct Option: A,B
  1. 1) ServletContext doesn't have one of these two methods.

  2. 2) String and InputStream

  3. 3) URL and InputStream

  4. 4) URL and StreamReader


Correct Option: C
  1. 1) getHeaderNames returns an Enumeration

  2. 2) getHeaders returns a String[]

  3. 3) getHeaderValues returns a String[]

  4. 4) getIntParameter returns an int


Correct Option: A

Which statements are correct about the method PageContext.include?

  1. 1) There is no such method.

  2. 2) It has two paramters: request and response

  3. 3) It has one parameter of type String which is the relative URL of the page to include.

  4. 4) This method is appropiate to use within a Tag class.


Correct Option: C,D
  1. 1) pushBody is called by the jsp container after doStartTag and before doAfterBdy

  2. 2) pushBody is called by the jsp container before doInitBody

  3. 3) popBody is called by the jsp container after doAfterBody and before doEndTag

  4. 4) popBody is called by the jsp container after doEndTag


Correct Option: A,C
  1. 1) yes

  2. 2) no

  3. 3) only the second part of the statement is true.

  4. 3) only the first part of the statement is true.


Correct Option: A

You are calling the method HttpServletResponse.sendRedirect(String path) and you want to make sure that the user continues in the same session. How do you that?

  1. 1) By calling the method with an absolute path as the argument

  2. 2) By enconding the path with HttpServletResponse.endcodeURL method

  3. 3) By enconding the path with HttpServletResponse.endcodeRedirectURL method

  4. 4) If you use sendRedirect the session is lost.


Correct Option: C

Which statements are true about the auth-constraint element?

  1. 1) It only contains the element role-name (besides element description)

  2. 2) Only the role-name specified in security-role-ref can be used

  3. 3) It is a subelement of web-resource-collection

  4. 4) It is related to authentication


Correct Option: A

Find the output of this program. main() { int a[10]; printf("%d",*a+1-*a+3) ; }

  1. Compiler error

  2. 3

  3. -2

  4. 4


Correct Option: D
- Hide questions