Perl and Struts Framework Programming Quiz

Questions covering Perl programming concepts including string manipulation, arrays, hashes, and Struts framework features including ActionServlet, validation, and configuration.

20 Questions Published

Questions

Question 1 Multiple Choice (Single Answer)

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
Question 2 Multiple Choice (Single Answer)

Struts framework is use following servlet?

  1. BasicServlet
  2. EntryServlet
  3. ActionServlet
  4. StrutsServlet
Question 3 Multiple Choice (Single Answer)

ActionServlet is acts like as?

  1. SessionFacade
  2. Filter
  3. Front controller
  4. Back controller
Question 4 Multiple Choice (Single Answer)

To defeating browser cache?

  1. nocache=true
  2. cache=false
  3. nocachereuired=false
  4. None of the above
Question 5 Multiple Choice (Single Answer)

ActionForm is not populate following object from reuest parameters?

  1. List
  2. String
  3. Boolean
  4. Collection
Question 6 Multiple Choice (Single Answer)

Which initialize parameter is used to specify Struts configuration?

  1. initialize
  2. config
  3. setup
  4. param
Question 7 Multiple Choice (Single Answer)

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
Question 8 Multiple Choice (Single Answer)

What are the scopes available in struts?

  1. Session , request
  2. Page, request, session
  3. Page, request, session, application
  4. request, session, application
Question 9 Multiple Choice (Single Answer)

Struts Framework is well suited for application of ____ size

  1. Small
  2. Any
  3. Average
  4. Verysmall
Question 10 Multiple Choice (Single Answer)

Other name of Struts 2 was

  1. WorkWeb 2
  2. WebWork 2
  3. Jstruts 2
  4. None of the above
Question 11 Multiple Choice (Single Answer)

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
Question 12 Multiple Choice (Single Answer)

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
Question 13 Multiple Choice (Single Answer)

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”
Question 14 Multiple Choice (Single Answer)

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

  1. find
  2. index
  3. locate
  4. allocate
Question 15 Multiple Choice (Single Answer)

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
Question 16 Multiple Choice (Single Answer)

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

  1. 14
  2. 3
  3. 4
  4. 15
Question 17 Multiple Choice (Single Answer)

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
Question 18 Multiple Choice (Single Answer)

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
Question 19 Multiple Choice (Single Answer)

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” )
Question 20 Multiple Choice (Single Answer)

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

  1. substr($string, -2, 2);
  2. abc
  3. efgh
  4. gh