Sail E0 Webinar

MCQs

Total Questions : 29 | Page 3 of 3 pages
Question 21. What will be the output of the following PHP code?$name = "What is your name?";if (preg_match("/name/"),$name)echo "My name is Will Pitt ";elseecho "My name is not Will Pitt ";if (preg_match("/are/"))echo "I am great"else echo "I am not great";
  1.    My name is not Will Pitt I am not great
  2.    My name is Will Pitt I am great
  3.    My name is not Will Pitt I am great
  4.    My name is Will Pitt I am not great
 Discuss Question
Answer: Option D. -> My name is Will Pitt I am not great
Question 22. Which one of the following functions is used to search a string?
  1.    preg_find
  2.    preg_match
  3.    preg_found
  4.    preg_search
 Discuss Question
Answer: Option B. -> preg_match
Question 23. What will be the output if we replace the line $num = preg_grep(“/[0-5]/”, $number); with $num = preg_grep(“/[0-5]/”, $number, PREG_GREP_INVERT);?
  1.    Array([2]=>two [3]=>three [4]=>four)
  2.    Array([1]=> 1)
  3.    Array([0]=>0 [5]=>5)
  4.    Array([0]=>0 [1]=>1 [2]=>two [3]=>three [4]=>four [5]=>5)
 Discuss Question
Answer: Option A. -> Array([2]=>two [3]=>three [4]=>four)
Question 24. Which one of the following preg PHP function is used to do a find and replace on a string or an array?
  1.    preg_find()
  2.    preg_findre()
  3.    preg_find_replace()
  4.    preg_replace()
 Discuss Question
Answer: Option D. -> preg_replace()
Question 25. What will be the output of the following PHP code?$str = "Hello! My name is Cameron Fox. Coffee?";$find = array('/is/','/coffee/');$replace = array('/was/','/tea/');echo preg_replace ($find, $replace, $str);
  1.    Hello! My name was Cameron Fox. Coffee?
  2.    Hello! My name is Cameron Fox. tea?
  3.    Hello! My name is Cameron Fox. Coffee?
  4.    Hello! My name was Cameron Fox. tea?
 Discuss Question
Answer: Option A. -> Hello! My name was Cameron Fox. Coffee?
Question 26. What will be the output of the following PHP code?$line = "You like dogs. I hate dogs. We should marry."$sen = preg_split('/./', $line);print_r($sen);
  1.    Error
  2.    Array([0]=>You like dogs. [1]=>I hate dogs. [2]=>We should marry.)
  3.    You like dogs. I hate dogs. We should marry.
  4.    Array([0]=>You like dogs. I hate dogs. We should marry.)
 Discuss Question
Answer: Option B. -> Array([0]=>You like dogs. [1]=>I hate dogs. [2]=>We should marry.)
Question 27. Which one of the following preg PHP functions is used to take a string, and put it in an array?
  1.    preg_divide()
  2.    preg_unchain()
  3.    preg_split()
  4.    preg_destroy()
 Discuss Question
Answer: Option C. -> preg_split()
Question 28. Parameter flags was added in which version of PHP?
  1.    PHP 4.1
  2.    PHP 4.2
  3.    PHP 4.0
  4.    PHP 4.3
 Discuss Question
Answer: Option D. -> PHP 4.3
Question 29. Which one of the following is not a preg PHP function?
  1.    preg_match_all
  2.    preg_match
  3.    preg_split
  4.    preg_matchall
 Discuss Question
Answer: Option D. -> preg_matchall

Latest Videos

Latest Test Papers