MCQOPTIONS
Saved Bookmarks
This section includes 20 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?<?php$Country = array("INDIA", "ENGLAND", "ISRAEL", "USA");array_pop($Country);print_r($Country);?> |
| A. | Error |
| B. | Nothing |
| C. | None of these |
| Answer» B. Nothing | |
| 2. |
What will be the output of the following PHP code?<?php$City = array("A"=>"Chennai", "B"=>"Noida", "C"=>"Delhi");echo array_shift($City);print_r ($City);?> |
| A. | None of these |
| Answer» C. | |
| 3. |
What will be the output of the following PHP code?<?php$Student1 = array("Neha", "Rahul");$Student2 = array("Sujit", "Vivek", "Rohan");print_r(array_merge($Student1, $Student2));?> |
| A. | None of these |
| Answer» D. | |
| 4. |
What will be the output of the following PHP code?<?php$Student = array ("Ajit", "Rahul", "Ats","Aju");echo (array_search ("Aju", $Student) );?> |
| A. | 1 |
| B. | 2 |
| C. | 3 |
| D. | True |
| E. | False |
| Answer» D. True | |
| 5. |
What will be the output of the following PHP code?<?php$Flower = array ("Rose", "Lily ", "Sunflower");echo (next($Flower)); echo (next($Flower));?> |
| A. | Sunflower |
| B. | Lily |
| C. | Rose |
| D. | Sunflower Lily |
| E. | Lily Sunflower |
| Answer» F. | |
| 6. |
What will be the output of the following PHP code?<?php$Employee = array ("Ajit", "Abhay", array ("Prayag", "Imroj"),"krishana");echo (count($Employee, 1));?> |
| A. | 6 |
| B. | 5 |
| C. | 4 |
| D. | 3 |
| E. | None of these |
| Answer» B. 5 | |
| 7. |
What will be the output of the following PHP code?<?php$Color = array("Green", "White", "Green", "Red", "Yellow", "White");print_r(array_count_values($Color));?> |
| A. | None of these |
| Answer» B. | |
| 8. |
What will be the output of the following PHP code?<?php$EmpName = array("Ajit Kumar Gupta", "Ats Yogi", "Aju Jayaraj");$Salary = array("35000", "37000", "43000");$Result = array_combine($EmpName, $Salary);print_r($Result);?> |
| A. | None of these |
| Answer» E. | |
| 9. |
What will be the output of the following PHP code?<?php$Flower = array("Daffodil", "Dahlia", "Daisy", "Daphne", "Delphinium", "Dianella");print_r(array_chunk($Flower, 3));?> |
| A. | None of these |
| Answer» D. | |
| 10. |
What will be the output of the following PHP code?<?php$Profile = array("Ajit"=>"22", "Ats"=>"23", "Aju"=>"24");print_r(array_change_key_case($Profile, CASE_UPPER));?> |
| A. | None of these |
| Answer» B. | |
| 11. |
What will be the output of the following PHP code?<?php$Flower = array("Rose", "Lily", "Sunflower");echo "I like " . $Flower[0] . ", " . $Flower[1] . " and " . $Flower[2] . ".";?> |
| A. | Error |
| B. | Nothing |
| C. | Rose Lily Sunflower |
| D. | I like Rose, Lily and Sunflower. |
| E. | None of these |
| Answer» E. None of these | |
| 12. |
What will be the output of the following PHP code ?<?php$Emp1 = array("Ajit", "Rahul");$Emp2 = array("Ats", "Aju");print_r(array_replace($Emp1, $Emp2));?> |
| A. | Nothing |
| B. | Error |
| C. | None of these |
| Answer» B. Error | |
| 13. |
What will be the output of the following PHP code ?<?php$num = array(2, 15, 20, 1);echo(array_product($num));?> |
| A. | 2 |
| B. | 15 |
| C. | 20 |
| D. | 1 |
| E. | 600 |
| Answer» F. | |
| 14. |
What will be the output of the following PHP code?<?php$Country = array("India", "England", "USA");echo "I like " . $Country[2] . ", " . $Country[1] . " and " . $Country[0] . ".";?> |
| A. | Error |
| B. | Nothing |
| C. | India England USA |
| D. | I like USA, England and India. |
| E. | None of these |
| Answer» E. None of these | |
| 15. |
What will be the output of the following PHP code ?<?php$Color1 = array("A" => "Red", "B" => "Green", "C" => "Blue", "D" => "Yellow");$Color2 = array("E" => "Red","F" => "Green", "H" => "Blue");$Result = array_intersect($Color1, $Color2);print_r($Result);?> |
| A. | Nothing |
| B. | Error |
| C. | None of these |
| Answer» C. None of these | |
| 16. |
What will be the output of the following PHP code?<?php$Student = array("Ajit", "Rahul", "Ats");echo $names[0] . "is the friend of " . $names[1] . " and " . $names[1] . ".".$friend;?> |
| A. | Error |
| B. | Ajit is the friend of Rahul and Ats. |
| C. | Nothing |
| D. | Ajit Rahul Ats |
| E. | None of these |
| Answer» B. Ajit is the friend of Rahul and Ats. | |
| 17. |
What will be the output of the following PHP code?<?php$Student = array("Rahul", "Ajit", "Ats");echo $Student[0] . " is the friend of " . $Student[1] . " and " . $Student[2] . ".";?> |
| A. | Rahul |
| B. | Error |
| C. | Rahul is the friend of Ajit and Ats. |
| D. | Nothing |
| E. | None of these |
| Answer» D. Nothing | |
| 18. |
What will be the output of the following PHP code?<?php$Name1 = array_fill(2, 3, "Ajit Kumar Gupta");$Name2 = array_fill(1, 2, "Ats Yogi");print_r($Name1);print_r($Name2);?> |
| A. | None of these |
| Answer» B. | |
| 19. |
What will be the output of the following PHP code?<?php$flowre1 = array("001"=>"Daffodil", "002"=>"Dahlia", "003"=>"Daisy", "004"=>"Dianella", "005"=>"Delphinium");$flowre2 = array("006"=>"Daffodil", "007"=>"Dahlia", "008"=>"Daisy");$Res = array_diff($flowre1, $flowre2);print_r($Res);?> |
| A. | None of these |
| Answer» E. | |
| 20. |
PHP s numerically indexed array begin with position ___________. |
| A. | 0 |
| B. | -1 |
| C. | 2 |
| D. | 1 |
| E. | None of these |
| Answer» B. -1 | |