programming languages Online Quiz - 148

programming languages Online Quiz - 148

20 Questions Published

Questions

Question 1 Multiple Choice (Single Answer)

name = "Steve Lit" name_copy = name name << "t" print "name = ", name print " name_copy = ", name_copy, "\n" ===> Find the output

  1. name = Steve Li name_copy = Steve Lit
  2. name = Steve Li name_copy = Steve Li
  3. name = Steve Litt name_copy = Steve Lit
  4. name = Steve Litt name_copy = Steve Litt
Question 2 Multiple Choice (Single Answer)

What is the output? myname = "Steve was here" print myname[4, 8], "\n"

  1. e was he
  2. ve was h
  3. e was
  4. ve w
Question 3 Multiple Choice (Single Answer)

mystring = "Cool " * 3 print mystring, "\n" ===> Find the output

  1. Output Error
  2. Cool * 3
  3. Cool Cool Cool
  4. Cool
Question 4 Multiple Choice (Single Answer)

Find output? [1,2,3].each do |i| print i*2 end

  1. 123
  2. 468
  3. 246
  4. 439
Question 5 True/False

i=0 while i<3 print i, "\n" break end Output = 0

  1. True
  2. False
Question 6 Multiple Choice (Multiple Answers)

Which of the following variable declarations are valid. a.y2 b._x c.7x d.this_is_test

  1. a
  2. b
  3. c
  4. d
Question 7 Multiple Choice (Multiple Answers)

Which of the following will not result in error. x=10 y=20 a) puts x.to_s + "+" + y.to_s + "=" + (x+y).to_s b) puts "#{x} + #{y} = #{x + y}" c) puts x + y d) puts x

  1. a
  2. b
  3. c
  4. d
Question 8 Multiple Choice (Multiple Answers)

Which statement about jspInit() are true?

  1. It has access to a ServletConfig
  2. It has access to a ServeletContext
  3. It is only called once
  4. It can be overridden
Question 9 Multiple Choice (Multiple Answers)

Which directives specify an HTTP response that will be of type "image/svg"?

  1. <%@ page type ="image/svg"%>
  2. <%@ page mimetype="image/svg" %>
  3. <% page language="image/svg" %>
  4. <% page contentType="image/svg" %>
Question 10 Multiple Choice (Multiple Answers)

Which are valid JSP implicit variables?

  1. stream
  2. context
  3. exception
  4. application
Question 11 Multiple Choice (Multiple Answers)

Which statements concerning JSPs are true?

  1. Both jspInit() and jspDestroy can be overridden
  2. Only jspInit() can be overridden
  3. Only jspDestroy() can be overridden
  4. Only _jspService can be overridden
Question 12 Multiple Choice (Multiple Answers)

Which statements about disabling scripting elements are true?

  1. You can only disable scripting at the application level
  2. You can disable scripting via DD by using <scripting-invalid> element
  3. You can disable scripting via DD
  4. You can disable scripting programmatically by using the isScriptingEnabled page directive attribute
Question 13 Multiple Choice (Multiple Answers)

Which is true about tag files

  1. A tag file may be placed in any subdirectory of WEB-INF
  2. A tag file may NOT be placed in a JAR file in the WEB-INF/lib directory
  3. A tag file must have the file extension of .tag or .tagx
  4. A TLD file must be used to map the symbolic tag name to the actual tag file
Question 14 Multiple Choice (Multiple Answers)

Which is the most efficient JspContext method to call to access an attribute that is known to be in application scope?

  1. getPageContext()
  2. findAttribute(String)
  3. getAttribute(String, int)
  4. getAttribute(String)
Question 15 Multiple Choice (Multiple Answers)

Which returns the enclosing tag when called from within a tag handler class?

  1. getParent()
  2. getAncestor()
  3. findAncestor()
  4. findParent()
Question 16 Multiple Choice (Multiple Answers)

Which HttpServletRequest method is most closely associated with the use of the element

  1. isUserInRole
  2. getUserPrincipal
  3. getCookies
  4. getHeader
Question 17 Multiple Choice (Single Answer)

Which authentication types require a specific type of HTML action?

  1. HTTP Basic Authentication
  2. Form Based Authentication
  3. HTTP Digest based Authentication
  4. HTTPS Client Authentication
Question 18 Multiple Choice (Single Answer)

Given in a JSP page, the line: <%-- out.print("Hello World"); --%>

  1. Hello World
  2. out.print("Hello World");
  3. No output is generated by this line
  4. "Hello World"
Question 19 Multiple Choice (Single Answer)

This statement describes the potential benefit of a design pattern: The pattern reduces network rountrips between a client and an Enterprise Bean and gives the client a local copy of the data encapsulated by an Enterprise Bean after a single method call, instead of requiring several method calls. Which design pattern is being described?

  1. Model -View-Controller
  2. Business Delegate
  3. Transfer Object
  4. Intercepting filter
Question 20 Multiple Choice (Multiple Answers)

Which method exist in HttpServlet?

  1. doGet
  2. doTrace
  3. doOptions
  4. doError