0
Alien head

programming languages Online Quiz - 220

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

If $string contains abcdefgh , what will the following call return?

  1. substr($string, -2, 2);

  2. abc

  3. efgh

  4. gh


Correct Option: C

Assume @list contains (“1”, “2”, “3”, “4”, “5” ). What is the content of @list after the following statement splice (@list, -1, 1, “test1”. “test2”);

  1. (“1”, “2”, “3”, “4”, “test1”, “test2”)

  2. ( “2”, “3”, “4”, “test1”, “test2”)

  3. (“1”, “3”, “4”, “test1”, “test2”)

  4. (“1”, “test1”, test2”, “2”, “3”, “4” )


Correct Option: A

Consider the following program code: %hash = (small => 8oz, medium => 16oz, large => 32oz); @keys = sort(keys(%hash)); for ($i = 0; $i < 3; $i++) { print($hash{$keys[$i]}\n); } What is the result of executing this program code?

  1. The code will fail at line 1 because a hash cannot contain both numeric and string data.

  2. The code will execute without error but will output nothing.

  3. The code will output the following:32oz 16oz 8oz

  4. The code will output the following:large medium small


Correct Option: C

Consider the following lines of code: @array1 = ("apples", "oranges", "pears", "plums"); foreach (@array1) {print "$_\n"}; What is the result of these lines of code?

  1. applesorangespearsplums

  2. apples oranges pears plums

  3. apples

  4. apples oranges pears plums


Correct Option: D

If $string contains abcdefghijiklmdef , what will the following call return? rindex($string , "def", 11 );

  1. 14

  2. 3

  3. 4

  4. 15


Correct Option: B

Assume that $var has the value hello . What is the value of the following sting? q (It’s time to say $var);

  1. It’s time to say $var

  2. It’s time to say hello

  3. Both

  4. None


Correct Option: A

Which Perl function can be used to identify the first found occurrence of a substring?

  1. find

  2. index

  3. locate

  4. allocate


Correct Option: B

Suppose the variable $var has the value abc123abc . What is the value of $var after the following substitution? $var=~ s/(\d+)/ $1*2 /e ;

  1. “abc”

  2. It will produce error

  3. “ABC123ABC”

  4. ”abc246abc”


Correct Option: D

Consider the following program code @array= (“Y”,”W”,”X”); @array=sort(@array); unshift(@array , ”Z”); print($array[0]); What is the output of this code

  1. W

  2. X

  3. Y

  4. Z


Correct Option: D

In Struts 1.1, you can change how Struts populates a form by

  1. Overriding the populateBean method of the ActionMapping

  2. Overriding the processPopulate method of the Request Processor

  3. Overriding the populate method of the ActionForm

  4. None of the above


Correct Option: B

Other name of Struts 2 was

  1. WorkWeb 2

  2. WebWork 2

  3. Jstruts 2

  4. None of the above


Correct Option: B

Struts Framework is well suited for application of ____ size

  1. Small

  2. Any

  3. Average

  4. Verysmall


Correct Option: B

What are the scopes available in struts?

  1. Session , request

  2. Page, request, session

  3. Page, request, session, application

  4. request, session, application


Correct Option: A

Which file contains java script for client side validation using validation framework in struts?

  1. validation.xml

  2. validator-rules.xml

  3. both files

  4. None


Correct Option: B

Which initialize parameter is used to specify Struts configuration?

  1. initialize

  2. config

  3. setup

  4. param


Correct Option: B

ActionForm is not populate following object from reuest parameters?

  1. List

  2. String

  3. Boolean

  4. Collection


Correct Option: D

To defeating browser cache?

  1. nocache=true

  2. cache=false

  3. nocachereuired=false

  4. None of the above


Correct Option: A

ActionServlet is acts like as?

  1. SessionFacade

  2. Filter

  3. Front controller

  4. Back controller


Correct Option: C

Struts framework is use following servlet?

  1. BasicServlet

  2. EntryServlet

  3. ActionServlet

  4. StrutsServlet


Correct Option: C

Correct validate () method?

  1. public ActionErrors validate(ActionMapping mapping,HttpServletReuest reuest)

  2. public ActionError validate(ActionMapping mapping, HttpServletReuest reuest)

  3. public ActionError validate(HttpServletReuest reuest, HttpServletResponse response)

  4. None of the above


Correct Option: A
+ View questions