Sail E0 Webinar

MCQs

Total Questions : 29 | Page 2 of 3 pages
Question 11. How many functions does PHP offer for searching and modifying strings using Perl-compatible regular expressions.
  1.    10
  2.    8
  3.    7
  4.    9
 Discuss Question
Answer: Option B. -> 8
Question 12. What will be the output of the following PHP code?$foods = array("pasta", "steak", "fish", "potatoes");$food = preg_grep("/^s/", $foods);print_r($food);
  1.    Array ( [1] => steak )
  2.    Array ( [0] => pasta [1] => steak [2] => fish [3] => potatoes )
  3.    Array ( [0] => potatoes )
  4.    Array ( [3] => potatoes )
 Discuss Question
Answer: Option A. -> Array ( [1] => steak )
Question 13. Which one of the following functions will convert a string to all uppercase?
  1.    strtoupper()
  2.    str_uppercase()
  3.    uppercase()
  4.    struppercase()
 Discuss Question
Answer: Option A. -> strtoupper()
Question 14. Say we have two compare two strings which of the following function/functions can you use?1. strcmp()2. strcasecmp()3. strspn()4. strcspn()
  1.    All of the mentioned
  2.    None of the mentioned
  3.    1 and 2
  4.    3 and 4
 Discuss Question
Answer: Option A. -> All of the mentioned
Question 15. What will be the output of the following PHP code?echo str_pad("Salad", 5)." is good.";
  1.    is good SaladSaladSaladSaladSalad
  2.    Salad is good
  3.    is good Salad
  4.    SaladSaladSaladSaladSalad is good
 Discuss Question
Answer: Option B. -> Salad is good
Question 16. Which one of the following functions finds the last occurrence of a string, returning its numerical position?
  1.    strlastpos()
  2.    strlast()
  3.    strrpos()
  4.    strpos()
 Discuss Question
Answer: Option C. -> strrpos()
Question 17. 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.";
  1.    Error
  2.    Contact the author of this article at n@chiketh@ex@mple.com
  3.    Contact the author of this article at nachiketh@ex@mple.com
  4.    Cont@ct the @uthor of this @rticle @t n@chiketh@ex@mple.com
 Discuss Question
Answer: Option B. -> Contact the author of this article at n@chiketh@ex@mple.com
Question 18. Which one of the following functions can be used to concatenate array elements to form a single delimited string?
  1.    explode()
  2.    implode()
  3.    concat()
  4.    concatenate()
 Discuss Question
Answer: Option B. -> implode()
Question 19. What will be the output of the following PHP code?$url = "contact@examians.com";echo ltrim(strstr($url, "@"),"@");
  1.    contact
  2.    contact@examians.com
  3.    contact@
  4.    examians.com
 Discuss Question
Answer: Option D. -> examians.com
Question 20. What will be the output of the following PHP code?$number = array(0,1,two,three,four,5);$num = preg_grep("/[0-5]/", $number);print_r($num);
  1.    Array([0]=>0 [1]=>1 [2]=>two [3]=>three [4]=>four [5]=>5)
  2.    Array([0]=>0 [1]=>1 [5]=>5)
  3.    Array([2]=>two [3]=>three [4]=>four)
  4.    Array([1]=> 1)
 Discuss Question
Answer: Option B. -> Array([0]=>0 [1]=>1 [5]=>5)

Latest Videos

Latest Test Papers