Saturday, November 28, 2015

PHP MCQ




1.       $text = “php is popular.”;
$arr1 = array(“/php/”,”/popular/”,”/programming/”);
$arr2 = array(“asp”,”favorite”,”coding”);
echo preg_replace($arr1,$arr2,$text);
What is the output?
A. php is popular                  B. asp is popular
C. php is favorite                  D. asp is favorite
2. What is the output of strcasecmp(“hello”,”hellO”)?
A. 0                                       B. 1
C. -1                                      D. Null   
3..           What is the output of strpos(“I like programming”,”like”)?
A. 0                                       B. 1
C. 2                                                         D.3
4. What is the output of substr(“Bangladesh”,3,-3)?
A. glad                                  B. desh
C. bang                                 D. gla
5. Which of the following will return true for the regular expression “/^\D+/”?
A. 123dhk                         B. 123456
C. abcd                              D. ert222
6. To match only numerical character and contain at least two characters which regular expression is/are correct?
A. ([0-9]{2,10})                      B. ([:alnum:]{2,})
C. ([0-9][a-zA-Z]{2,})            D. ([0-9][^a-zA-Z]{2,})
7. Which of the following will return true for the regular expression “(^.{5}$)”
A. 55555                                 B. d22323
C. 232y3y                               D. 45gth
8. What is the output of echo strspn("1239ab","1123a459")?
A. 4                                     B. 5
C. 6                                      D.7

9. How to get the name of the file throwing the exception?
A. getFile()
B. getName()
C. getCode()
D. getMessage()
10. Which of the following statement is the default exception constructor?
A. thrown Exception()
B. throw new Exception()
C. throw new $Exception()

No comments:

Post a Comment