

MCQOPTIONS
Saved Bookmarks
This section includes 33 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 = "Inter";if ($str.length) print $str.view;else print "Mania";?> |
A. | Inter |
B. | view |
C. | Mania |
D. | Interview |
E. | None of these |
Answer» E. None of these | |
2. |
What will be the output of the following PHP code ?<?php$p = 22;if ($p-- - --$p - $p) print "Interview";else print "Mania";?> |
A. | 0 |
B. | 1 |
C. | Mania |
D. | Interview |
E. | None of these |
Answer» E. None of these | |
3. |
What will be the output of the following PHP code ?<?php$p = "0";$q = "1";if ((int)$p && $q) print"Interview";else print "Mania";?> |
A. | Mania |
B. | Interview |
C. | true |
D. | false |
E. | None of these |
Answer» B. Interview | |
4. |
What will be the output of the following PHP code ?<?php$s = "hey";if (strlen($s)) print strlen($s);else print "nice";?> |
A. | 3 |
B. | 5 |
C. | hey |
D. | nice |
E. | None of these |
Answer» E. None of these | |
5. |
What will be the output of the following PHP code ?<?php$n = 5;if ($n++) print "Hello Interview Mania";else print "Hey Interview Mania";?> |
A. | Hello Interview Mania |
B. | Hey Interview Mania |
C. | Error |
D. | Nothing |
E. | None of these |
Answer» B. Hey Interview Mania | |
6. |
What will be the output of the following PHP code ?<?php$n;if ($n == 0) print "Inter" ;else print "Mania"; print "view"?> |
A. | Inter |
B. | Mania |
C. | view |
D. | Interview |
E. | None of these |
Answer» E. None of these | |
7. |
What will be the output of the following PHP code?<?php$str;if ($str) print "Interview" ;else print "Mania";?> |
A. | Error |
B. | Interview |
C. | Mania |
D. | Interview Mania |
E. | None of these |
Answer» D. Interview Mania | |
8. |
What will be the output of the following PHP code ?<?phpif (print "Ninth" - 9) print "Tenth"?> |
A. | Ninth |
B. | Tenth |
C. | -9Ninth |
D. | -9Tenth |
E. | None of these |
Answer» E. None of these | |
9. |
What will be the output of the following PHP code ?<?php$num1 = 25;$num2 = 27;if ($num1 > $num2 && 1||1) print "Manjesh" ;else print "Ojha";?> |
A. | Ojha |
B. | 25 |
C. | Manjesh |
D. | 27 |
E. | None of these |
Answer» D. 27 | |
10. |
What will be the output of the following PHP code ?<?php$n1 = 17;$n2 = 19;if ($n1 > $n2 + $n2 != 3) print "Interview" ;else print "Mania";?> |
A. | Mania |
B. | Interview |
C. | 17 |
D. | 19 |
E. | None of these |
Answer» C. 17 | |
11. |
What will be the output of the following PHP code ?<?php$str = "s";if ($str) print "Executed....";else print "Not Executed...";?> |
A. | Nothing |
B. | Error |
C. | Not Executed... |
D. | Executed.... |
E. | None of these |
Answer» E. None of these | |
12. |
What will be the output of the following PHP code ?<?php$num = "";if ($num) print "Second";else print "First";?> |
A. | True |
B. | Second |
C. | First |
D. | False |
E. | None of these |
Answer» D. False | |
13. |
What will be the output of the following PHP code ?<?phpif (print "Program ") print "Executed..." ;else print "Not Executed...";?> |
A. | Program |
B. | Executed... |
C. | Not Executed... |
D. | Program Executed... |
E. | Program Not Executed... |
Answer» E. Program Not Executed... | |
14. |
What will be the output of the following PHP code ?<?php$num = 20;if (1) print "First";else print "Second";else print "Third";?> |
A. | Error |
B. | First |
C. | Second |
D. | Third |
E. | None of these |
Answer» B. First | |
15. |
What will be the output of the following PHP code ?<?php$num = 15;if (print $num) print "Interview";else print "Mania"; ?> |
A. | Nothing |
B. | Interview |
C. | Mania |
D. | 15Interview |
E. | 15Mania |
Answer» E. 15Mania | |
16. |
What will be the output of the following PHP code ?<?php$num = 12;if (echo $num) print "True";else print "False"; ?> |
A. | 0 |
B. | 1 |
C. | True |
D. | False |
E. | Error |
Answer» F. | |
17. |
What will be the output of the following PHP code ?<?php$num = 1;if ($num--) print "False";if ($num++) print "True"; ?> |
A. | Nothing |
B. | False |
C. | True |
D. | Error |
E. | None of these |
Answer» D. Error | |
18. |
What will be the output of the following PHP code ?<?php$n = 0;if ($n == 1) if ($n >= 0) print "True"; else print "False"; ?> |
A. | 0 |
B. | 1 |
C. | True |
D. | False |
E. | Nothing |
Answer» F. | |
19. |
What will be the output of the following PHP code ?<?phpif (0.0) print "First" ;else print "Second";?> |
A. | True |
B. | First |
C. | False |
D. | Second |
E. | None of these |
Answer» E. None of these | |
20. |
What will be the output of the following PHP code ?<?phpif (0.25) print "Ajit" ;else print "Gupta";?> |
A. | 0.25 |
B. | Error |
C. | Ajit |
D. | Gupta |
E. | None of these |
Answer» D. Gupta | |
21. |
What will be the output of the following PHP code ?<?phpif (-200) print "Mania" ;else print "Interview";?> |
A. | -200 |
B. | 0 |
C. | 1 |
D. | Mania |
E. | Interview |
Answer» E. Interview | |
22. |
What will be the output of the following PHP code ?<?php$p = 50;$q = 60;if ($p > $q && 1||1) print "Executed...." ;else print "Not Executed....";?> |
A. | Not Executed.... |
B. | True |
C. | Executed.... |
D. | False |
E. | None of these |
Answer» D. False | |
23. |
What will be the output of the following PHP code ?<?php$p = 150;if ($p > 25) printf("Ajit");else if ($p > 35) printf("Ats");else if($p > 45) printf("Aju");?> |
A. | Ajit |
B. | Ats |
C. | Aju |
D. | All of above |
E. | None of these |
Answer» B. Ats | |
24. |
What will be the output of the following PHP code ?<?php$t = 11;if ($t = $t&0) print $t;else break;?> |
A. | True |
B. | False |
C. | 11 |
D. | 0 |
E. | Error |
Answer» F. | |
25. |
What will be the output of the following PHP code ?<?php$p = 25;$q = 26;if ($p < ++$p || $q < ++$q) print "if statement executed...";else print "else statement executed...";?> |
A. | else statement executed... |
B. | Error |
C. | if statement executed... |
D. | Nothing |
E. | None of these |
Answer» B. Error | |
26. |
What will be the output of the following PHP code ?<?php$num = 1;if ($num--) print "First" $num--;else print "Second"?> |
A. | Nothing |
B. | Error |
C. | First |
D. | Second |
E. | None of these |
Answer» C. First | |
27. |
What will be the output of the following PHP code ?<?php$p = 20;if ($p = $p&0) print $p ;else print "Executed...";?> |
A. | Error |
B. | Nothing |
C. | 20 |
D. | Executed... |
E. | None of these |
Answer» E. None of these | |
28. |
What will be the output of the following PHP code ?<?php$num = 5;if ($num = $num&0) print $num ;else print "Else statement executed...";?> |
A. | True |
B. | Error |
C. | 5 |
D. | Else statement executed... |
E. | None of these |
Answer» E. None of these | |
29. |
What will be the output of the following PHP code ?<?php$num = 5;if ($num == 6) print "Interveiw" ;else if($num = 6) print $num;else print "Mania";?> |
A. | 6 |
B. | 5 |
C. | Mania |
D. | Interview |
E. | None of these |
Answer» B. 5 | |
30. |
What will be the output of the following PHP code ?<?phpif (!print "First") if (print "Second")print "Third";?> |
A. | Error |
B. | Nothing |
C. | First |
D. | Second |
E. | Third |
Answer» D. Second | |
31. |
What will be the output of the following PHP code ?<?php$p = 25;$q = 50;$r = 15;if ($p / $q / $r) print "Interview";else print "Mania";?> |
A. | true |
B. | False |
C. | Interview |
D. | Mania |
E. | None of these |
Answer» D. Mania | |
32. |
What will be the output of the following PHP code ?<?php$num = 5;if (5) print "First"; if else print "Second";?> |
A. | Nothing |
B. | Error |
C. | First |
D. | Second |
E. | None of these |
Answer» C. First | |
33. |
What will be the output of the following PHP code ?<?php$n = 12;if ($n-- - --$n - $n) print "First";else print "Second";?> |
A. | Error |
B. | First |
C. | Nothing |
D. | Second |
E. | None of these |
Answer» C. Nothing | |