

MCQOPTIONS
Saved Bookmarks
This section includes 24 Mcqs, each offering curated multiple-choice questions to sharpen your Php knowledge and support exam preparation. Choose a topic below to get started.
1. |
*/*_What will be the output of the following PHP code?? |
A. | Error |
B. | Username must be all lowercase! |
C. | Username is all lowercase! |
D. | No Output is returned |
Answer» C. Username is all lowercase! | |
2. |
*/*_Parameter flags was added in which version of PHP?? |
A. | PHP 4.0 |
B. | PHP 4.1 |
C. | PHP 4.2 |
D. | PHP 4.3 |
Answer» E. | |
3. |
*/*_Which one of the following preg PHP function is used to do a find and replace on a string or an array?? |
A. | preg_replace() |
B. | preg_find() |
C. | preg_find_replace() |
D. | preg_findre() |
Answer» B. preg_find() | |
4. |
*/*_What will be the output of the following PHP code?? |
A. | contact@examveda.com |
B. | contact |
C. | contact@ |
D. | examveda.com |
Answer» E. | |
5. |
*/*_Which among the following is/are not a metacharacter?1. /a2. /A3. /b4. /B? |
A. | Only 1 |
B. | 1 and 3 |
C. | 2, 3 and 4 |
D. | 2 and 4 |
Answer» B. 1 and 3 | |
6. |
_ How many functions does PHP offer for searching strings using POSIX style regular expression?$? |
A. | 7 |
B. | 8 |
C. | 9 |
D. | 10 |
Answer» B. 8 | |
7. |
_ Which one of the following is not a preg PHP function?$? |
A. | preg_match |
B. | preg_match_all |
C. | preg_matchall |
D. | preg_split |
Answer» D. preg_split | |
8. |
_ What will be the output of the following PHP code?$? |
A. | My name is Will Pitt I am great |
B. | My name is not Will Pitt I am great |
C. | My name is Will Pitt I am not great |
D. | My name is not Will Pitt I am not great |
Answer» D. My name is not Will Pitt I am not great | |
9. |
_ What will be the output of the following PHP code?$? |
A. | Contact the author of this article at nachiketh@ex@mple.com |
B. | Cont@ct the @uthor of this @rticle @t n@chiketh@ex@mple.com |
C. | Contact the author of this article at n@chiketh@ex@mple.com |
D. | Error |
Answer» D. Error | |
10. |
_ Which one of the following functions will convert a string to all uppercase?$? |
A. | strtoupper() |
B. | uppercase() |
C. | str_uppercase() |
D. | struppercase() |
Answer» B. uppercase() | |
11. |
_ Which of the following would be a potential match for the Perl-based regular expression /fo{2,4}/ ?1. fol2. fool3. fooool4. fooooool$? |
A. | Only 1 |
B. | 2 and 3 |
C. | 1, 3 and 4 |
D. | 1 and 4 |
Answer» C. 1, 3 and 4 | |
12. |
_[:alpha:] can also be specified as.$? |
A. | [A-Za-z0-9] |
B. | [A-za-z] |
C. | [A-z] |
D. | [a-z] |
Answer» C. [A-z] | |
13. |
What will be the output of the following PHP code?$? |
A. | You like dogs. I hate dogs. We should marry. |
B. | Array([0]=>You like dogs. I hate dogs. We should marry.) |
C. | Array([0]=>You like dogs. [1]=>I hate dogs. [2]=>We should marry.) |
D. | Error |
Answer» D. Error | |
14. |
Which one of the following functions is used to search a string?$? |
A. | preg_match |
B. | preg_search |
C. | preg_find |
D. | preg_found |
Answer» B. preg_search | |
15. |
Which one of the following functions finds the last occurrence of a string, returning its numerical position?$? |
A. | strlastpos() |
B. | strpos() |
C. | strlast() |
D. | strrpos() |
Answer» E. | |
16. |
Say we have two compare two strings which of the following function/functions can you use?1. strcmp()2. strcasecmp()3. strspn()4. strcspn()$? |
A. | 1 and 2 |
B. | 3 and 4 |
C. | None of the mentioned |
D. | All of the mentioned |
Answer» E. | |
17. |
What will be the output of the following PHP code?$? |
A. | this is some text that we might like to parse. |
B. | Array ( [0] => some text that [1] => we might like to parse. ) |
C. | Array ( [0] => this is [1] => some text that [2] => we might like to parse. ) |
D. | [0] => this is [1] => some text that [2] => we might like to parse. |
Answer» E. | |
18. |
Which one of the following regular expression matches any string containing zero or one p?? |
A. | p+ |
B. | p* |
C. | P? |
D. | p# |
Answer» D. p# | |
19. |
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);?$ |
A. | Array([0]=>0 [1]=>1 [2]=>two [3]=>three [4]=>four [5]=>5) |
B. | Array([2]=>two [3]=>three [4]=>four) |
C. | Array([1]=> 1) |
D. | Array([0]=>0 [5]=>5) |
Answer» C. Array([1]=> 1) | |
20. |
What will be the output of the following PHP code? |
A. | Array ( [0] => pasta [1] => steak [2] => fish [3] => potatoes ) |
B. | Array ( [3] => potatoes ) |
C. | Array ( [1] => steak ) |
D. | Array ( [0] => potatoes ) |
Answer» D. Array ( [0] => potatoes ) | |
21. |
PHP has long supported two regular expression implementations known as _______ and _______.1. Perl2. PEAR3. Pearl4. POSIX |
A. | 1 and 2 |
B. | 2 and 4 |
C. | 1 and 4 |
D. | 2 and 3 |
Answer» D. 2 and 3 | |
22. |
What will be the output of the following PHP code? |
A. | Hello! My name was Cameron Fox. tea? |
B. | Hello! My name is Cameron Fox. tea? |
C. | Hello! My name is Cameron Fox. Coffee? |
D. | Hello! My name was Cameron Fox. Coffee? |
Answer» E. | |
23. |
What will be the output of the following PHP code? |
A. | Array([0]=>0 [1]=>1 [2]=>two [3]=>three [4]=>four [5]=>5) |
B. | Array([2]=>two [3]=>three [4]=>four) |
C. | Array([1]=> 1) |
D. | Array([0]=>0 [1]=>1 [5]=>5) |
Answer» E. | |
24. |
What will be the output of the following PHP code? |
A. | SaladSaladSaladSaladSalad is good |
B. | is good SaladSaladSaladSaladSalad |
C. | is good Salad |
D. | Salad is good |
Answer» E. | |