MULTIPLE CHOICE QUSTION-SET 5
Control Structures - Part 21. What will be the output of the following
PHP code? for ($i = 0; $i < 3; $i++) { echo $i . "
"; } a) 0 1 2 Answer: a) 0 1 2 2. What will be the result of the following
PHP code? $i = 0; while ($i < 5) { echo $i . "
"; $i += 2; } a) 0 2 4 Answer: a) 0 2 4 3. What will be the output of the following
PHP code? $i = 0; do { echo $i . "
"; $i++; } while ($i < 3); a) 0 1 2 Answer: a) 0 1 2 4. What is the result of the following PHP
code if $x is 5? php Copy code for ($i = 0; $i < $x; $i++) { if ($i == 3) { break; } echo $i . "
"; } a) 0 1 2 3 Answer: b) 0 1 2 5. What will be the output of the following
PHP code? for ($i = 0; $i < 4; $i++) { if ($i % 2 == 0) { continue; } echo $i . "
"; } a) 1 3 Answer: a) 1 3 6. What will be the result of the following
PHP code? php Copy code $i = 1; while ($i <= 3) { echo $i . "
"; $i++; if ($i == 2) { continue; } break; } a) 1 2 3 Answer: d) 1 7. What will be the output of the following
PHP code? for ($i = 1; $i <= 5; $i++) { if ($i == 3) { continue; } if ($i == 4) { break; } echo $i . "
"; } a) 1 2 3 Answer: c) 1 2 8. What will be the result of this PHP code? $i = 0; do { echo $i . "
"; $i++; } while ($i < 0); a) 0 Answer: a) 0 9. What will be the output of the following
PHP code if $n is 4? for ($i = 1; $i <= $n; $i++) { if ($i == 3) { continue; } echo $i . "
"; } a) 1 2 4 Answer: a) 1 2 4 10. What will be the result of the following
PHP code? $x = 0; while ($x < 3) { if ($x == 1) { $x++; continue; } echo $x . "
"; $x++; } a) 0 1 2 Answer: b) 0 2 11. What will be the output of the following
PHP code? $i = 1; while ($i < 5) { if ($i == 3) { $i++; continue; } echo $i . "
"; $i++; } a) 1 2 3 4 Answer: b) 1 2 4 12. What will be the result of the following
PHP code? for ($i = 0; $i < 3; $i++) { for ($j = 0; $j <
2; $j++) { if
($j == 1) { break; } echo
$i . $j . " "; } } a) 00 01 10 11 Answer: c) 00 01 13. What will be the output of the following
PHP code? $x = 0; while ($x < 5) { if ($x % 2 == 0) { echo
$x . " "; } $x++; if ($x == 4) { break; } } a) 0 2 4 Answer: b) 0 2 14. What will be the result of the following
PHP code? $i = 1; do { echo $i . "
"; $i++; if ($i > 3) { break; } } while ($i < 5); a) 1 2 3 Answer: a) 1 2 3 15. What will be the output of the following
PHP code if $n is 3? for ($i = 0; $i < 5; $i++) { if ($i % $n == 0) { continue; } echo $i . "
"; } a) 1 2 3 4 Answer: b) 1 2 4 16. What will be the result of the following
PHP code? $i = 0; do { $i++; if ($i == 3) { continue; } echo $i . "
"; } while ($i < 5); a) 1 2 3 4 Answer: b) 1 2 4 17. What will be the output of the following
PHP code? for ($i = 0; $i < 3; $i++) { for ($j = 0; $j <
3; $j++) { if
($j == 2) { continue
2; } echo
$i . $j . " "; } } a) 00 01 10 11 20 Answer: b) 00 01 10 18. What will be the result of the following
PHP code? $i = 1; while ($i < 5) { if ($i == 2) { $i++; continue; } echo $i . "
"; $i++; } a) 1 2 3 4 Answer: b) 1 3 4 19. What will be the output of the following
PHP code? $x = 0; for ($i = 0; $i < 4; $i++) { if ($i == 2) { continue; } $x += $i; } echo $x; a) 4 Answer: a) 4 20. What will be the result of the following
PHP code? $i = 0; while ($i < 5) { $i++; if ($i == 3) { continue; } echo $i . "
"; } a) 1 2 3 4 5 Answer: b) 1 2 4 5 21. What will be the output of the following
PHP code? $i = 0; while ($i < 5) { if ($i == 3) { break; } echo $i . "
"; $i++; } a) 0 1 2 3 Answer: b) 0 1 2 22. What will be the result of the following
PHP code? for ($i = 0; $i < 3; $i++) { for ($j = 0; $j <
3; $j++) { if
($i == 1 && $j == 1) { continue
1; } echo
$i . $j . " "; } } a) 00 01 02 10 12 20 21 22 Answer: d) 00 01 02 10 20 23. What will be the output of the following
PHP code? $i = 0; do { if ($i == 2) { break; } echo $i . "
"; $i++; } while ($i < 5); a) 0 1 2 Answer: b) 0 1 24. What will be the result of this PHP code? $i = 1; while ($i < 5) { if ($i == 3) { $i++; continue; } echo $i . "
"; $i++; } a) 1 2 3 4 Answer: b) 1 2 4 25. What will be the output of the following
PHP code? for ($i = 1; $i <= 4; $i++) { if ($i % 2 != 0) { continue; } echo $i . "
"; } a) 1 2 3 4 Answer: b) 2 4 26. What will be the result of the following
PHP code? $i = 0; while ($i < 4) { $i++; if ($i == 2) { continue; } echo $i . "
"; } a) 1 2 3 4 Answer: b) 1 3 4 27. What will be the output of the following
PHP code? $x = 0; for ($i = 0; $i < 3; $i++) { for ($j = 0; $j <
3; $j++) { if
($i == 1 && $j == 1) { continue
2; } echo
$i . $j . " "; } } a) 00 01 02 10 20 21 22 Answer: b) 00 01 02 10 20 28. What will be the result of the following
PHP code? $i = 1; do { if ($i == 2) { $i++; continue; } echo $i . "
"; $i++; } while ($i < 4); a) 1 2 3 Answer: b) 1 3 29. What will be the output of the following
PHP code? for ($i = 0; $i < 5; $i++) { if ($i % 2 == 0) { continue; } echo $i . "
"; } a) 1 3 5 Answer: a) 1 3 30. What will be the result of the following
PHP code? $i = 0; do { if ($i == 2) { $i++; continue; } echo $i . "
"; $i++; } while ($i < 5); a) 0 1 2 3 4 Answer: b) 0 1 3 4 31. What will be the output of the following
PHP code? for ($i = 0; $i < 3; $i++) { if ($i == 1) { continue
2; } echo $i . "
"; } a) 0 1 2 Answer: c) 0 32. What will be the result of this PHP code? $i = 0; while ($i < 5) { if ($i % 2 != 0) { $i++; continue; } echo $i . "
"; $i++; } a) 0 2 4 Answer: a) 0 2 4 33. What will be the output of the following
PHP code? for ($i = 1; $i <= 4; $i++) { if ($i == 2) { continue; } echo $i . "
"; } a) 1 2 3 4 Answer: b) 1 3 4 34. What will be the result of the following
PHP code? $i = 0; do { if ($i == 2) { $i++; continue; } echo $i . "
"; $i++; } while ($i < 4); a) 0 1 2 3 Answer: b) 0 1 3 35. What will be the output of this PHP code? $x = 0; while ($x < 3) { $x++; if ($x == 2) { break; } echo $x . "
"; } a) 1 2 Answer: b) 1 36. What will be the result of the following
PHP code? for ($i = 0; $i < 3; $i++) { for ($j = 0; $j <
3; $j++) { if
($j == 1) { continue
2; } echo
$i . $j . " "; } } a) 00 01 02 10 20 21 22 Answer: b) 00 01 10 20 37. What will be the output of this PHP code? $i = 0; while ($i < 4) { if ($i == 1) { $i++; continue; } if ($i == 2) { break; } echo $i . "
"; $i++; } a) 0 1 Answer: a) 0 1 38. What will be the result of the following
PHP code? $i = 0; do { if ($i == 1) { $i++; continue; } echo $i . "
"; $i++; } while ($i < 3); a) 0 1 2 Answer: b) 0 2 39. What will be the output of the following
PHP code? for ($i = 0; $i < 5; $i++) { if ($i % 2 == 0) { continue; } echo $i . "
"; } a) 0 2 4 Answer: b) 1 3 40. What will be the result of the following
PHP code? $i = 1; do { if ($i == 2) { break; } echo $i . "
"; $i++; } while ($i < 4); a) 1 2 Answer: b) 1 41. What will be the output of the following
PHP code? $i = 0; do { if ($i == 2) { $i++; continue; } if ($i == 4) { break; } echo $i . "
"; $i++; } while ($i < 5); a) 0 1 2 3 Answer: a) 0 1 3 42. What will be the result of this PHP code? php Copy code for ($i = 0; $i < 3; $i++) { if ($i == 1) { break; } echo $i . "
"; } a) 0 1 Answer: b) 0 43. What will be the output of the following
PHP code? $i = 0; while ($i < 4) { $i++; if ($i == 2) { continue; } if ($i == 3) { break; } echo $i . "
"; } a) 1 2 3 Answer: d) 1 44. What will be the result of the following
PHP code? php Copy code for ($i = 1; $i <= 4; $i++) { if ($i % 2 == 0) { continue
2; } echo $i . "
"; } a) 1 2 3 4 Answer: b) 1 3 45. What will be the output of the following
PHP code? $i = 1; while ($i <= 5) { if ($i == 3) { $i++; continue; } echo $i . "
"; $i++; } a) 1 2 3 4 5 Answer: b) 1 2 4 5 46. What will be the result of the following
PHP code? php Copy code for ($i = 0; $i < 4; $i++) { if ($i == 2) { continue
1; } echo $i . "
"; } a) 0 1 2 3 Answer: a) 0 1 3 47. What will be the output of this PHP code? $i = 1; do { if ($i == 4) { break; } echo $i . "
"; $i++; } while ($i < 5); a) 1 2 3 4 Answer: b) 1 2 3 48. What will be the result of the following
PHP code? $i = 0; while ($i < 5) { if ($i % 2 == 0) { $i++; continue; } echo $i . "
"; $i++; } a) 0 2 4 Answer: b) 1 3 49. What will be the output of the following
PHP code? for ($i = 0; $i < 3; $i++) { if ($i == 1) { break; } echo $i . "
"; } a) 0 1 Answer: b) 0 50. What will be the result of the following
PHP code? php Copy code $i = 0; do { if ($i == 2) { $i++; continue; } echo $i . "
"; $i++; } while ($i < 5); a) 0 1 2 3 4 Answer: b) 0 1 3 4 51. What will be the output of the following
PHP code? $i = 0; while ($i < 4) { if ($i == 1) { $i++; continue; } if ($i == 2) { break; } echo $i . "
"; $i++; } a) 0 1 Answer: a) 0 1 52. What will be the result of this PHP code? for ($i = 0; $i < 4; $i++) { if ($i == 2) { continue
2; } echo $i . "
"; } a) 0 1 2 3 Answer: b) 0 1 3 53. What will be the output of the following
PHP code? $i = 0; do { if ($i == 1) { $i++; continue; } if ($i == 3) { break; } echo $i . "
"; $i++; } while ($i < 5); a) 0 1 2 Answer: a) 0 1 2 54. What will be the result of the following
PHP code? for ($i = 0; $i < 3; $i++) { if ($i == 1) { $i++; continue; } echo $i . "
"; } a) 0 1 2 Answer: b) 0 2 55. What will be the output of this PHP code? php Copy code $x = 0; for ($i = 0; $i < 4; $i++) { if ($x == 2) { break; } if ($i % 2 == 0) { $x++; } echo $i . "
"; } a) 0 1 2 Answer: a) 0 1 2 56. What will be the result of the following
PHP code? $i = 0; while ($i < 5) { if ($i == 3) { $i++; continue; } if ($i == 4) { break; } echo $i . "
"; $i++; } a) 0 1 2 3 Answer: a) 0 1 2 57. What will be the output of the following
PHP code? for ($i = 0; $i < 5; $i++) { if ($i == 2) { continue; } if ($i == 4) { break; } echo $i . "
"; } a) 0 1 2 3 Answer: b) 0 1 3 58. What will be the result of the following
PHP code? $i = 0; do { if ($i == 1) { $i++; continue
2; } echo $i . "
"; $i++; } while ($i < 4); a) 0 1 2 3 Answer: b) 0 2 3 59. What will be the output of the following
PHP code? php Copy code $i = 0; while ($i < 5) { if ($i == 3) { $i++; continue; } if ($i == 4) { break; } echo $i . "
"; $i++; } a) 0 1 2 3 Answer: a) 0 1 2 60. What will be the result of the following
PHP code? for ($i = 0; $i < 4; $i++) { if ($i == 2) { break
2; } echo $i . "
"; } a) 0 1 2 Answer: b) 0 1 61. What will be the output of the following
PHP code? for ($i = 0; $i < 4; $i++) { if ($i == 1) { continue
1; } echo $i . "
"; } a) 0 1 2 3 Answer: c) 0 2 3 62. What will be the result of this PHP code? $i = 0; while ($i < 4) { if ($i == 2) { $i++; continue
2; } echo $i . "
"; $i++; } a) 0 1 2 3 Answer: b) 0 1 3 63. What will be the output of the following
PHP code? $i = 0; do { if ($i == 1) { $i++; continue; } if ($i == 3) { break; } echo $i . "
"; $i++; } while ($i < 5); a) 0 1 2 Answer: a) 0 1 2 64. What will be the result of the following
PHP code? $i = 0; while ($i < 5) { if ($i % 2 == 0) { $i++; continue; } echo $i . "
"; $i++; } a) 0 1 2 3 4 Answer: b) 1 3 65. What will be the output of this PHP code? for ($i = 0; $i < 5; $i++) { if ($i == 3) { continue
2; } echo $i . "
"; } a) 0 1 2 3 4 Answer: b) 0 1 2 66. What will be the result of the following
PHP code? $i = 0; do { if ($i == 1) { $i++; continue; } if ($i == 4) { break; } echo $i . "
"; $i++; } while ($i < 6); a) 0 1 2 3 Answer: a) 0 1 2 3 67. What will be the output of the following
PHP code? for ($i = 0; $i < 3; $i++) { if ($i == 1) { $i++; continue; } echo $i . "
"; } a) 0 1 2 Answer: b) 0 2 68. What will be the result of the following
PHP code? $i = 0; while ($i < 5) { if ($i == 3) { $i++; continue
2; } echo $i . "
"; $i++; } a) 0 1 2 3 Answer: b) 0 1 2 4 69. What will be the output of this PHP code? $i = 0; do { if ($i == 2) { $i++; break; } echo $i . "
"; $i++; } while ($i < 4); a) 0 1 2 Answer: b) 0 1 70. What will be the result of the following
PHP code? for ($i = 0; $i < 3; $i++) { if ($i == 1) { $i++; continue; } if ($i == 2) { break; } echo $i . "
"; } a) 0 1 Answer: a) 0 71. What will be the output of the following
PHP code? $i = 1; while ($i < 4) { if ($i == 2) { $i++; continue; } echo $i . "
"; $i++; } a) 1 2 3 Answer: b) 1 3 72. What will be the result of this PHP code? for ($i = 0; $i < 4; $i++) { if ($i == 2) { $i++; continue; } if ($i == 3) { break; } echo $i . "
"; } a) 0 1 Answer: a) 0 1 73. What will be the output of the following
PHP code? $i = 0; do { if ($i == 1) { $i++; continue
2; } echo $i . "
"; $i++; } while ($i < 4); a) 0 1 2 Answer: b) 0 2 3 74. What will be the result of the following
PHP code? $i = 0; for ($i = 0; $i < 5; $i++) { if ($i == 3) { break
2; } echo $i . "
"; } a) 0 1 2 Answer: a) 0 1 2 75. What will be the output of this PHP code? $i = 0; while ($i < 5) { if ($i == 3) { $i++; continue; } echo $i . "
"; $i++; } a) 0 1 2 3 4 Answer: b) 0 1 2 4 76. What will be the result of this PHP code? $i = 0; for ($i = 0; $i < 4; $i++) { if ($i == 2) { continue; } if ($i == 3) { break; } echo $i . "
"; } a) 0 1 2 Answer: c) 0 1 77. What will be the output of the following
PHP code? $i = 0; do { if ($i == 2) { $i++; break; } echo $i . "
"; $i++; } while ($i < 4); a) 0 1 2 Answer: b) 0 1 78. What will be the result of this PHP code? $i = 0; while ($i < 5) { if ($i == 2) { $i++; continue; } if ($i == 4) { break; } echo $i . "
"; $i++; } a) 0 1 2 3 Answer: a) 0 1 2 3 79. What will be the output of the following
PHP code? for ($i = 0; $i < 3; $i++) { if ($i == 1) { $i++; continue
2; } echo $i . "
"; } a) 0 1 2 Answer: b) 0 2 80. What will be the result of this PHP code? $i = 0; for ($i = 0; $i < 5; $i++) { if ($i == 4) { continue
2; } echo $i . "
"; } a) 0 1 2 3 4 Answer: b) 0 1 2 3 81. What will be the output of the following
PHP code? $i = 0; while ($i < 3) { if ($i == 1) { $i++; continue; } echo $i . "
"; $i++; } a) 0 1 2 Answer: b) 0 2 82. What will be the result of this PHP code? for ($i = 0; $i < 4; $i++) { if ($i == 2) { continue
2; } echo $i . "
"; } a) 0 1 2 3 Answer: d) 0 1 3 83. What will be the output of the following
PHP code? $i = 0; do { if ($i == 1) { $i++; continue; } if ($i == 3) { break; } echo $i . "
"; $i++; } while ($i < 5); a) 0 1 2 Answer: a) 0 1 2 84. What will be the result of the following
PHP code? $i = 0; for ($i = 0; $i < 4; $i++) { if ($i == 2) { $i++; continue; } if ($i == 3) { break; } echo $i . "
"; } a) 0 1 Answer: a) 0 1 85. What will be the output of this PHP code? $i = 0; while ($i < 5) { if ($i == 2) { $i++; continue
2; } echo $i . "
"; $i++; } a) 0 1 2 3 4 Answer: b) 0 1 3 4 86. What will be the result of the following
PHP code? $i = 0; do { if ($i == 2) { $i++; break; } echo $i . "
"; $i++; } while ($i < 4); a) 0 1 2 Answer: b) 0 1 87. What will be the output of this PHP code? for ($i = 0; $i < 5; $i++) { if ($i == 3) { $i++; continue; } if ($i == 4) { break; } echo $i . "
"; } a) 0 1 2 3 Answer: b) 0 1 2 88. What will be the result of the following
PHP code? $i = 0; while ($i < 3) { if ($i == 1) { $i++; continue
2; } echo $i . "
"; $i++; } a) 0 1 2 Answer: b) 0 2 89. What will be the output of this PHP code? $i = 0; do { if ($i == 1) { $i++; continue
2; } echo $i . "
"; $i++; } while ($i < 4); a) 0 1 2 Answer: b) 0 2 3 90. What will be the result of the following
PHP code? for ($i = 0; $i < 4; $i++) { if ($i == 2) { continue; } if ($i == 3) { break; } echo $i . "
"; } a) 0 1 Answer: a) 0 1 |