MCQOPTIONS
Saved Bookmarks
This section includes 50 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$str = 'view ';print "Inter{$str}Mania";?> |
| A. | Error |
| B. | Interview |
| C. | Mania |
| D. | Interview Mania |
| E. | None of these |
| Answer» E. None of these | |
| 2. |
What will be the output of the following PHP code ?<?php$v = 'Mania';echo "Inter$view";?> |
| A. | Mania |
| B. | Inter |
| C. | view |
| D. | Inter$view |
| E. | None of these |
| Answer» E. None of these | |
| 3. |
What will be the output of the following PHP code ?<?php$str = 'view';echo 'Inter{$str}Mania';?> |
| A. | view |
| B. | error |
| C. | Mania |
| D. | Inter{$str}Mania |
| E. | None of these |
| Answer» E. None of these | |
| 4. |
What will be the output of the following PHP code ?<?php$str = 'view';print "Inter".$str."Mania";?> |
| A. | InterMania |
| B. | InterviewMania |
| C. | Error |
| D. | ManiaInter |
| E. | None of these |
| Answer» C. Error | |
| 5. |
What will be the output of the following PHP code ?<?php$num = '8' ;print + + $num;?> |
| A. | Error |
| B. | 8 |
| C. | Nothing |
| D. | 0 |
| E. | None of these |
| Answer» C. Nothing | |
| 6. |
What will be the output of the following PHP code ?<?php$n = 15;while (--$n > 0 && ++$n){ print $n;}?> |
| A. | Error |
| B. | 15 |
| C. | Nothing |
| D. | 15.......infinite time |
| E. | None of these |
| Answer» E. None of these | |
| 7. |
What will be the output of the following PHP code ?<?php$num = 8;while (--$num > 0 || ++$num){ print $num;}?> |
| A. | 76543211111111......infinite time |
| B. | Error |
| C. | Nothing |
| D. | 7654321 |
| E. | None of these |
| Answer» B. Error | |
| 8. |
What will be the output of the following PHP code ?<?php$k = 10;while (--$k > 0){ $k++; print $k; print "Interview Mania";}?> |
| A. | Error |
| B. | nothing |
| C. | Interview Mania......infinite time |
| D. | 10Interview Mania.....infinite time |
| E. | None of these |
| Answer» E. None of these | |
| 9. |
What will be the output of the following PHP code ?<?php$n = "";while ($n = 20){ print "Interview";}print "Mania";?> |
| A. | Interview Mania |
| B. | Interview |
| C. | Mania |
| D. | infinite loop |
| E. | None of these |
| Answer» E. None of these | |
| 10. |
What will be the output of the following PHP code ?<?php$k = 0;while ($k = 20){ print "Interview";}print "Mania";?> |
| A. | Interview |
| B. | infinite loop |
| C. | Interview Mania |
| D. | Mania |
| E. | None of these |
| Answer» D. Mania | |
| 11. |
What will be the output of the following PHP code ?<?php$p = 12;echo ++$p;echo $p++;echo $p;echo ++$p;?> |
| A. | Error |
| B. | 12 |
| C. | Nothing |
| D. | 13131415 |
| E. | None of these |
| Answer» E. None of these | |
| 12. |
What will be the output of the following PHP code ?<?php$t = 5;if ($t-- == ++$t){ echo $t;}?> |
| A. | Error |
| B. | 0 |
| C. | Nothing |
| D. | 5 |
| E. | None of these |
| Answer» E. None of these | |
| 13. |
What will be the output of the following PHP code ?<?php$s = 4;$t = 8;$s *= $t /= $s;echo $s, $t;?> |
| A. | 82 |
| B. | 4 |
| C. | 8 |
| D. | Nothing |
| E. | None of these |
| Answer» B. 4 | |
| 14. |
What will be the output of the following PHP code ?<?php$p = 5;$q = 6;if (++$p == $q++){ echo "true ", $q, $p;}?> |
| A. | true |
| B. | 7 |
| C. | 6 |
| D. | true 67 |
| E. | true 76 |
| Answer» F. | |
| 15. |
What will be the output of the following PHP code ?<?php$p = 20;$q = 10;if ($p || ($q = $p + 10)) { echo "True";}echo $q;?> |
| A. | 10 |
| B. | 20 |
| C. | True |
| D. | 10True |
| E. | True10 |
| Answer» F. | |
| 16. |
What will be the output of the following PHP code ?<?php$n = 10;$m = 10;if ($n && ($m = $n + 10)) { echo "True";}echo $m;?> |
| A. | 20 |
| B. | 10 |
| C. | True |
| D. | True20 |
| E. | None of these |
| Answer» E. None of these | |
| 17. |
What will be the output of the following PHP code ?<?phpecho 7 * 5 / 4 + 10;?> |
| A. | Error |
| B. | 10 |
| C. | 18 |
| D. | 18.75 |
| E. | None of these |
| Answer» E. None of these | |
| 18. |
What will be the output of the following PHP code ?<?php$m = 10; $n = -8; $t = 2; $k = ++$m && ++$n || ++$t;echo $k; echo $m;?> |
| A. | 10 |
| B. | -8 |
| C. | 111 |
| D. | 2 |
| E. | None of these |
| Answer» D. 2 | |
| 19. |
What will be the output of the following PHP code ?<?phpecho 10 * 15 / 12 + 14?> |
| A. | 10 |
| B. | 26.5 |
| C. | 15 |
| D. | 14 |
| E. | 12 |
| Answer» C. 15 | |
| 20. |
What will be the output of the following PHP code ?<?php$p = 10;$r = $p++; $q = ++$p;print $p; print $q; ?> |
| A. | Error |
| B. | 12 |
| C. | Nothing |
| D. | 1212 |
| E. | None of these |
| Answer» E. None of these | |
| 21. |
What will be the output of the following PHP code ?<?php$p = 3; $q = 4;$r = $p++ + ++$q;echo $r;?> |
| A. | Error |
| B. | 8 |
| C. | 3 |
| D. | 4 |
| E. | None of these |
| Answer» C. 3 | |
| 22. |
What will be the output of the following PHP code ?<?php$num = 20;$num = $num++ + 25; echo $num; ?> |
| A. | Nothing |
| B. | 20 |
| C. | 25 |
| D. | 45 |
| E. | Error |
| Answer» E. Error | |
| 23. |
What will be the output of the following PHP code ?<?php$p = 20; $q = 20;if ($p = 12) $q--;echo $p;echo $q--;?> |
| A. | 12 |
| B. | Error |
| C. | Nothing |
| D. | 1219 |
| E. | None of these |
| Answer» E. None of these | |
| 24. |
What will be the output of the following PHP code ?<?php$p = 2; $q = 2; $r = 2;echo ++$p + ++$p+$p++; print $p++ + ++$q; print ++$r + $r++ + $p++;?> |
| A. | Nothing |
| B. | 11812 |
| C. | 12811 |
| D. | Error |
| E. | Nothing |
| Answer» C. 12811 | |
| 25. |
What will be the output of the following PHP code ?<?php$num = 10;$num = ($num + 15)++; echo $num; ?> |
| A. | 10 |
| B. | 15 |
| C. | Error |
| D. | 16 |
| E. | 11 |
| Answer» D. 16 | |
| 26. |
What will be the output of the following PHP code ?<?php$num = 10 + ++15;echo $num; ?> |
| A. | 10 |
| B. | 15 |
| C. | Nothing |
| D. | Error |
| E. | None of these |
| Answer» E. None of these | |
| 27. |
What will be the output of the following PHP code ?<?phpecho 6 * 10 / 4 + 10;?> |
| A. | Error |
| B. | 25 |
| C. | 26 |
| D. | 10 |
| E. | None of these |
| Answer» C. 26 | |
| 28. |
What will be the output of the following PHP code ?<?php$p = 8; $r = 7; $q = 15; $s = $p + $r == $q;print $s;?> |
| A. | 15 |
| B. | 1 |
| C. | 8 |
| D. | 7 |
| E. | None of these |
| Answer» B. 1 | |
| 29. |
What will be the output of the following PHP code ?<?php$n1 = 13;print ++$n++;?> |
| A. | Error |
| B. | Nothing |
| C. | 13 |
| D. | 14 |
| E. | None of these |
| Answer» B. Nothing | |
| 30. |
What will be the output of the following PHP code ?<?php$n1 = 5;print $n = ++$n;?> |
| A. | 5 |
| B. | 3 |
| C. | 1 |
| D. | 0 |
| E. | None of these |
| Answer» D. 0 | |
| 31. |
What will be the output of the following PHP code ?<?php$p = 6; $q = -8; $r = 2; $s = ++$p && ++$q || ++$r;echo $s;echo $p;?> |
| A. | 17 |
| B. | 6 |
| C. | -8 |
| D. | 2 |
| E. | None of these |
| Answer» B. 6 | |
| 32. |
What will be the output of the following PHP code ?<?php$m = 8;echo $m = ++$m % 9 + ++$m; ?> |
| A. | 10 |
| B. | 9 |
| C. | 8 |
| D. | Error |
| E. | None of these |
| Answer» B. 9 | |
| 33. |
What will be the output of the following PHP code ?<?php$n = 15;$n = $n + 12; echo $n++; ?> |
| A. | 15 |
| B. | 12 |
| C. | Error |
| D. | Nothing |
| E. | 27 |
| Answer» F. | |
| 34. |
What will be the output of the following PHP code ?<?php$n = 'n' ;print $n * 8;?> |
| A. | n |
| B. | 8 |
| C. | 0 |
| D. | 1 |
| E. | None of these |
| Answer» C. 0 | |
| 35. |
What will be the output of the following PHP code ?<?php$n = 0x6db7;print $n<<8;?> |
| A. | Error |
| B. | 0 |
| C. | 7190272 |
| D. | 8 |
| E. | 0x6db7 |
| Answer» D. 8 | |
| 36. |
What will be the output of the following PHP code ?<?php$m = 10;$n = 11;$s = 12;print (( + + $m + $n) >! ($n - $s));?> |
| A. | 1 |
| B. | 10 |
| C. | 11 |
| D. | 12 |
| Answer» B. 10 | |
| 37. |
What will be the output of the following PHP code ?<?php$m = 10; $n = 11; $s = 12;print !(( + + $m + $n) > ($n - $s));?> |
| A. | 0 |
| B. | 1 |
| C. | Nothing |
| D. | Error |
| E. | None of these |
| Answer» D. Error | |
| 38. |
What will be the output of the following PHP code ?<?php$num1 = 5;$num2 = 5;if ($Res = (($num1 == 5) && ($num2 != 0))){ print "Result is $Res";}?> |
| A. | 5 |
| B. | true |
| C. | 0 |
| D. | Result is 1 |
| E. | None of these |
| Answer» E. None of these | |
| 39. |
What will be the output of the following PHP code ?<?phpecho $t-- != ++$t;?> |
| A. | 0 |
| B. | 1 |
| C. | true |
| D. | false |
| E. | None of these |
| Answer» C. true | |
| 40. |
What will be the output of the following PHP code ?<?php$k = 5;if (--$k <> ($k != $k++)){ echo $k;}?> |
| A. | 0 |
| B. | Error |
| C. | 55 |
| D. | 5 |
| E. | None of these |
| Answer» B. Error | |
| 41. |
What will be the output of the following PHP code ?<?php$k = 4;if (--$k == 4 || $k xor --$k){ echo $k;}?> |
| A. | Error |
| B. | 0 |
| C. | 4 |
| D. | 44 |
| E. | None of these |
| Answer» C. 4 | |
| 42. |
What will be the output of the following PHP code ?<?php$t = 21;if (**$t == 23){ echo $t;}?> |
| A. | 21 |
| B. | 23 |
| C. | Error |
| D. | Nothing |
| E. | None of these |
| Answer» D. Nothing | |
| 43. |
What will be the output of the following PHP code ?<?php$m = 10; $n = 11; $s = 12;print !(($m + $s) < ($n - $s));?> |
| A. | Error |
| B. | 1 |
| C. | Nothing |
| D. | 0 |
| E. | None of these |
| Answer» C. Nothing | |
| 44. |
What will be the output of the following PHP code ?<?php$str1 = "Hello ";$str2 = "Interview ";$str3 = "Mania "; $str1 .= $str2 .= $str3 ;echo $str1;echo $str2;?> |
| A. | Hello Interview Mania |
| B. | Interview Mania |
| C. | Hello Interview Mania Interview Mania |
| D. | Interview Mania Interview Mania |
| E. | None of these |
| Answer» D. Interview Mania Interview Mania | |
| 45. |
What will be the output of the following PHP code ?<?php$k = 15;--$k;echo $k++;?> |
| A. | 15 |
| B. | 14 |
| C. | Error |
| D. | Nothing |
| E. | None of these |
| Answer» C. Error | |
| 46. |
What will be the output of the following PHP code ?<?php$n = 9;while (++$n){ while (--$n > 0) print $n;}?> |
| A. | Error |
| B. | 9 |
| C. | 987654321 |
| D. | Nothing |
| E. | None of these |
| Answer» D. Nothing | |
| 47. |
What will be the output of the following PHP code ?<?php$n = 4;while (++$n){ while ($n --> 0) print $n;}?> |
| A. | 43210 |
| B. | 4 |
| C. | Error |
| D. | 01234 |
| E. | None of these |
| Answer» B. 4 | |
| 48. |
What will be the output of the following PHP code ?<?php$p = 2;while ((--$p > ++$p) - 2){ print $p;}?> |
| A. | 0000000000........infinite time |
| B. | 2222222.........infinite time |
| C. | -2-2-2-2-2-2-2-2.......infinite time |
| D. | All of above |
| E. | None of these |
| Answer» C. -2-2-2-2-2-2-2-2.......infinite time | |
| 49. |
What will be the output of the following PHP code ?<?php$k = -1;while (++$k && --$k){ print $k;}?> |
| A. | Nothing |
| B. | Error |
| C. | -1 |
| D. | 0 |
| E. | None of these |
| Answer» B. Error | |
| 50. |
What will be the output of the following PHP code ?<?php$p = 0;while(++$p || --$p){ print $p;}?> |
| A. | 123456789101112.......infinite time |
| B. | Error |
| C. | 12345 |
| D. | Nothing |
| E. | None of these |
| Answer» B. Error | |