1.  [:alpha:] can also be specified as.


[A-Za-z0-9]
[A-za-z]
[A-z]
[a-z]


Answer

 Option

[:alpha:] is nothing but Lowercase and uppercase alphabetical characters.

Workspace

Report
Mail id: Report Error:

Answer Workspace Report

2.  Which of the following would be a potential match for the Perl-based regular expression /fo{2,4}/ ?
i. fol
ii. fool
iii. fooool
iv. fooooool


Only i
ii and iii
i, iii and iv
i and iv


Answer

 Option

This matches f followed by two to four occurrences of o.

Workspace

Report
Mail id: Report Error:

Answer Workspace Report

3.  What will be the output of the following PHP code ?
$foods = array(‘‘pasta’‘, ‘‘steak’‘, ‘‘fish’‘, ‘‘potatoes’‘);
$food = preg_grep(‘‘/^s/’‘, $foods);
print_r($food);
?>


Array ( [0] => pasta [1] => steak [2] => fish [3] => potatoes )
Array ( [3] => potatoes )
Array ( [1] => steak )
Array ( [0] => potatoes )


Answer

 Option

This function is used to search an array for foods beginning with s.

Workspace

Report
Mail id: Report Error:

Answer Workspace Report

4.  What will be the output of the following PHP code ?
$title = ‘‘O'malley wins the heavyweight championship!’‘;
echo ucwords($title);
?>


O’Malley Wins The Heavyweight Championship!
O’malley Wins The Heavyweight Championship!
O’Malley wins the heavyweight championship!
o’malley wins the heavyweight championship!


Answer

 Option

The ucwords() function capitalizes the first letter of each word in a string. Its prototype follows: string ucwords(string str).

Workspace

Report
Mail id: Report Error:

Answer Workspace Report

5.  What will be the output of the following PHP code ?
$author = ‘‘nachiketh@example.com’‘;
$author = str_replace(‘‘a’‘,’‘@’‘,$author);
echo ‘‘Contact the author of this article at $author.’‘;
?>


Contact the author of this article at nachiketh@ex@mple.com
Cont@ct the @uthor of this @rticle @t n@chiketh@ex@mple.com
Contact the author of this article at n@chiketh@ex@mple.com
Error


Answer

 Option

The str_replace() function case sensitively replaces all instances of a string with another.

Workspace

Report
Mail id: Report Error:

Answer Workspace Report