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.
Questions
Correct validate () method?
- public ActionErrors validate(ActionMapping mapping,HttpServletReuest reuest)
- public ActionError validate(ActionMapping mapping, HttpServletReuest reuest)
- public ActionError validate(HttpServletReuest reuest, HttpServletResponse response)
- None of the above
Struts framework is use following servlet?
- BasicServlet
- EntryServlet
- ActionServlet
- StrutsServlet
ActionServlet is acts like as?
- SessionFacade
- Filter
- Front controller
- Back controller
To defeating browser cache?
- nocache=true
- cache=false
- nocachereuired=false
- None of the above
ActionForm is not populate following object from reuest parameters?
- List
- String
- Boolean
- Collection
Which initialize parameter is used to specify Struts configuration?
- initialize
- config
- setup
- param
Which file contains java script for client side validation using validation framework in struts?
- validation.xml
- validator-rules.xml
- both files
- None
What are the scopes available in struts?
- Session , request
- Page, request, session
- Page, request, session, application
- request, session, application
Struts Framework is well suited for application of ____ size
- Small
- Any
- Average
- Verysmall
Other name of Struts 2 was
- WorkWeb 2
- WebWork 2
- Jstruts 2
- None of the above
In Struts 1.1, you can change how Struts populates a form by
- Overriding the populateBean method of the ActionMapping
- Overriding the processPopulate method of the Request Processor
- Overriding the populate method of the ActionForm
- None of the above
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
- W
- X
- Y
- Z
Suppose the variable $var has the value abc123abc . What is the value of $var after the following substitution? $var=~ s/(\d+)/ $1*2 /e ;
- “abc”
- It will produce error
- “ABC123ABC”
- ”abc246abc”
Which Perl function can be used to identify the first found occurrence of a substring?
- find
- index
- locate
- allocate
Assume that $var has the value hello . What is the value of the following sting? q (It’s time to say $var);
- It’s time to say $var
- It’s time to say hello
- Both
- None
If $string contains abcdefghijiklmdef , what will the following call return? rindex($string , "def", 11 );
- 14
- 3
- 4
- 15
Consider the following lines of code: @array1 = ("apples", "oranges", "pears", "plums"); foreach (@array1) {print "$_\n"}; What is the result of these lines of code?
- applesorangespearsplums
- apples oranges pears plums
- apples
- apples oranges pears plums
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?
- The code will fail at line 1 because a hash cannot contain both numeric and string data.
- The code will execute without error but will output nothing.
- The code will output the following:32oz 16oz 8oz
- The code will output the following:large medium small
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”, “2”, “3”, “4”, “test1”, “test2”)
- ( “2”, “3”, “4”, “test1”, “test2”)
- (“1”, “3”, “4”, “test1”, “test2”)
- (“1”, “test1”, test2”, “2”, “3”, “4” )
If $string contains abcdefgh , what will the following call return?
- substr($string, -2, 2);
- abc
- efgh
- gh