0

programming languages Online Quiz - 148

Description: programming languages Online Quiz - 148
Number of Questions: 20
Created by:
Tags: programming languages
Attempted 0/20 Correct 0 Score 0

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


Correct Option: D

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


Correct Option: B

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

  1. Output Error

  2. Cool * 3

  3. Cool Cool Cool

  4. Cool


Correct Option: C

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

  1. 123

  2. 468

  3. 246

  4. 439


Correct Option: C

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

  1. True

  2. False


Correct Option: A

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


Correct Option: A,B,D

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


Correct Option: A,B,C,D

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


Correct Option: A,B,C,D

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


Correct Option: D

Which are valid JSP implicit variables?

  1. stream

  2. context

  3. exception

  4. application


Correct Option: C,D

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


Correct Option: A

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 element

  3. You can disable scripting via DD

  4. You can disable scripting programmatically by using the isScriptingEnabled page directive attribute


Correct Option: B

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


Correct Option: C

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)


Correct Option: C

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

  1. getParent()

  2. getAncestor()

  3. findAncestor()

  4. findParent()


Correct Option: A

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

  1. isUserInRole

  2. getUserPrincipal

  3. getCookies

  4. getHeader


Correct Option: A

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


Correct Option: B

Given in a JSP page, the line:

  1. Hello World

  2. out.print("Hello World");

  3. No output is generated by this line

  4. "Hello World"


Correct Option: C

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


Correct Option: C

Which method exist in HttpServlet?

  1. doGet

  2. doTrace

  3. doOptions

  4. doError


Correct Option: A,B,C
- Hide questions