

MCQOPTIONS
Saved Bookmarks
This section includes 1698 Mcqs, each offering curated multiple-choice questions to sharpen your General Awareness knowledge and support exam preparation. Choose a topic below to get started.
951. |
What will be the output of the following PHP code ? <?php for ($x = -1; $x < 10;--$x) { print $x; } ?> |
A. | 123456789101112 |
B. | 12345678910 |
C. | 1234567891011 |
D. | Infinite loop |
Answer» E. | |
952. |
What will be the output of the following PHP code ? <?php $x; for ($x = -3; $x < -5; ++$x) { print ++$x; } ?> |
A. | -3-4-5 |
B. | -3-4 |
C. | Infinite loop |
D. | No output |
Answer» E. | |
953. |
What will be the output of the following PHP code ? <?php for ($i++; $i == 1; $i = 2) print "In for loop "; print "After loop n"; ?> |
A. | In for loop |
B. | After for loop |
C. | In for loopAfter for loop |
D. | Infinite loop |
Answer» D. Infinite loop | |
954. |
What will be the output of the following PHP code ? <?php for (1; $i == 1; $i = 2) print "In for loop "; print "After loop n"; ?> |
A. | In for loop |
B. | After for loop |
C. | In for loopAfter for loop |
D. | Infinite loop |
Answer» C. In for loopAfter for loop | |
955. |
What will be the output of the following PHP code ? <?php for ($i == 2; ++$i == $i; ++$i) print "In for loop "; print "After loop n"; ?> |
A. | In for loopIn for loopIn for loopIn for loop infinitely |
B. | After for loopAfter for loopAfter for loop ..infinitely |
C. | In for loopAfter for loopIn for loopAfter for loopIn for loopAfter for loop ..infinitely |
D. | After for loop |
Answer» B. After for loopAfter for loopAfter for loop ..infinitely | |
956. |
What will be the output of the following PHP code ? <?php for ($x = 1; $x < 10; $x++) for ($y = 1; $y < 5; $y++) print "Hello"; ?> |
A. | Hello .36 times |
B. | Hello .45 times |
C. | Hello .50 times |
D. | Hello .40 times |
Answer» B. Hello .45 times | |
957. |
What will be the output of the following PHP code ? <?php switch($b) { case 2: print "hello"; break; case 1: print "hi"; break; } ?> |
A. | Hello |
B. | Hi |
C. | No output |
D. | Error |
Answer» D. Error | |
958. |
What will be the output of the following PHP code ? <?php for ($count = 1; $count != 20;$count++) { print $count; $count++; } ?> |
A. | Infinite |
B. | 123 .20 |
C. | 1357 19 |
D. | 13579 21 |
Answer» B. 123 .20 | |
959. |
What will be the output of the following PHP code ? <?php switch($b) { case 2: print "hello"; break; case b: print "hi"; break; } ?> |
A. | Hello |
B. | Hi |
C. | No output |
D. | Error |
Answer» D. Error | |
960. |
What will be the output of the following PHP code ? <?php while() { print "hi"; } ?> |
A. | Infinite loop |
B. | Hi |
C. | No output |
D. | Error |
Answer» E. | |
961. |
What will be the output of the following PHP code ? <?php do { print "hi"; } while(0); print "hello"; ?> |
A. | Infinite loop |
B. | Hihello |
C. | Hello |
D. | Error |
Answer» C. Hello | |
962. |
What will be the output of the following PHP code ? <?php $i = 0 while ($i < 3) { $i++; } print $i; ?> |
A. | 2 |
B. | 3 |
C. | 0 |
D. | 1 |
Answer» C. 0 | |
963. |
What will be the output of the following PHP code ? <?php $i = 0 do { $i++; } while ($i < 3); print $i; ?> |
A. | 2 |
B. | 3 |
C. | 0 |
D. | 1 |
Answer» C. 0 | |
964. |
What will be the output of the following PHP code ? <?php $i = 0 while ($i++) { print $i; } print $i; ?> |
A. | 0 |
B. | Infinite loop |
C. | 01 |
D. | 1 |
Answer» E. | |
965. |
What will be the output of the following PHP code ? <?php $i = ""; while($i) { print "hi"; } print "hello"; ?> |
A. | Hello |
B. | Infinite loop |
C. | Hihello |
D. | Error |
Answer» B. Infinite loop | |
966. |
What will be the output of the following PHP code ? <?php $i = 0; while($i = 10) { print "hi"; } print "hello"; ?> |
A. | Hello |
B. | Infinite loop |
C. | Hihello |
D. | Error |
Answer» C. Hihello | |
967. |
What will be the output of the following PHP code ? <?php $i = ""; while ($i) { print "hi"; } while($i < 8) $i++; print "hello"; ?> |
A. | Hi is printed 8 times, hello 7 times and then hi 2 times |
B. | Hi is printed 10 times, hello 7 times |
C. | Hi is printed once, hello 7 times |
D. | Hi is printed once, hello 7 times and then hi 2 times |
Answer» E. | |
968. |
What will be the output of the following PHP code ? <?php $i = 5; while (--$i > 0 && ++$i) { print $i; } ?> |
A. | 54321111111 .infinitely |
B. | 555555555 infinitely |
C. | 54321 |
D. | 5 |
Answer» B. 555555555 infinitely | |
969. |
What will be the output of the following PHP code ? <?php for ($count = 1; $count < 20; $count++); print $count; ?> |
A. | 20 |
B. | 19 |
C. | 12345678910 .19 |
D. | 12345678910 .1920 |
Answer» B. 19 | |
970. |
What will be the output of the following PHP code ? <?php for ($i = 0; $i < 5; $i++) { for(; $i < 5; $i++) print"i"; } ?> |
A. | Iiiii |
B. | Infinite loop |
C. | Iiiiiiiiiiiiiiiiiiiiiiiii |
D. | No output |
Answer» B. Infinite loop | |
971. |
What will be the output of the following PHP code ? <?php $a = "2"; switch ($a) { case 1: print "hi"; case 2: print "hello"; break; default: print "hi1"; } ?> |
A. | Hihellohi1 |
B. | Hello |
C. | Hihi1 |
D. | Hi1 |
Answer» C. Hihi1 | |
972. |
What will be the output of the following PHP code ? <?php $a = "1"; switch($a) { case 1: break; print "hi"; case 2: print "hello"; break; default: print "hi1"; } ?> |
A. | Hihellohi1 |
B. | No output |
C. | Hihi1 |
D. | Hi1 |
Answer» C. Hihi1 | |
973. |
What will be the output of the following PHP code ? <?php $a = "1"; $a = 1; $b = 1; switch($a) { case $a * $b: print "hi"; break; case $a / $b: print "hello"; break; default: print "hi1"; } ?> |
A. | Hihellohi1 |
B. | Hi |
C. | Hihello |
D. | Hi1 |
Answer» C. Hihello | |
974. |
What will be the output of the following PHP code ? <?php $a = 97; switch($a) { case "a": print "hi"; break; case 97: print "hello"; break; default: print "hi1"; } ?> |
A. | Hihellohi1 |
B. | Hi |
C. | Hihello |
D. | Hello |
Answer» E. | |
975. |
What will be the output of the following PHP code ? <?php $b = 1; switch($b) { case 1.0: print "hi"; break; case 1: print "hello"; break; default: print "hi1"; } ?> |
A. | Hihellohi1 |
B. | Hi |
C. | Hihello |
D. | Hello |
Answer» B. Hi | |
976. |
What will be the output of the following PHP code ? <?php const $b = 1; switch($b) { case 1: print "hi"; break; case 1: print "hello"; break; default: print "hi1"; } ?> |
A. | Error |
B. | Hi |
C. | Hihello |
D. | Hello |
Answer» B. Hi | |
977. |
What will be the output of the following PHP code ? <?php $b = 1; switch(print $b) { case 2: print "hello"; break; case 1: print "hi"; break; default: print "hi1"; } ?> |
A. | 1hello |
B. | 1hi |
C. | 1hi1 |
D. | Error |
Answer» C. 1hi1 | |
978. |
What will be the output of the following PHP code ? <?php $a = array("hi", "hello", "bye"); foreach ($a as $value) { if (count($a) == 2) print $value; } ?> |
A. | Hihellobye |
B. | Infinite loop |
C. | Hihello |
D. | No output |
Answer» E. | |
979. |
What will be the output of the following PHP code ? <?php $a = array("hi", "hello", "bye"); for (;count($a) < 5;) { if (count($a) == 3) print $a; } ?> |
A. | ArrayArrayArrayArrayArrayArray .infinitely |
B. | ( hi , hello , bye )( hi , hello , bye )( hi , hello , bye )( hi , hello , bye ) infinitely |
C. | hihellobyehihellobyehihellobyehihellobyehihellobyehihellobye ..infinitely |
D. | No output |
Answer» B. ( hi , hello , bye )( hi , hello , bye )( hi , hello , bye )( hi , hello , bye ) infinitely | |
980. |
What will be the output of the following PHP code ? <?php $a = 10; $b = 4; $c = fun(10,4); function fun($a,$b) { $b = 3; return $a - $b + $b - $a; } echo $a; echo $b; echo $c; ?> |
A. | 104 |
B. | 410 |
C. | 1400 |
D. | 4100 |
Answer» D. 4100 | |
981. |
What will be the output of the following PHP code ? <?php $a = "$winner"; $b = "/$looser"; echo $a,$b; ?> |
A. | $winner/$looser |
B. | /$looser |
C. | / |
D. | $looser |
Answer» D. $looser | |
982. |
What will be the output of the following PHP code ? <?php $x = 5; $y = 10; function fun() { $GLOBALS['y'] = $GLOBALS['x'] + $GLOBALS['y']; } fun(); echo $y; ?> |
A. | 5 |
B. | 10 |
C. | 15 |
D. | Error |
Answer» D. Error | |
983. |
What will be the output of the following PHP code ? <?php $x = 5; $y = 10; function fun() { $y = $GLOBALS['x'] + $GLOBALS['y']; } fun(); echo $y; ?> |
A. | 5 |
B. | 10 |
C. | 15 |
D. | Error |
Answer» C. 15 | |
984. |
What will be the output of the following PHP code ? <?php function fun() { $x = 0; echo $x; $x++; } fun(); fun(); fun(); ?> |
A. | 012 |
B. | 123 |
C. | 000 |
D. | 111 |
Answer» D. 111 | |
985. |
What will be the output of the following PHP code ? <?php function fun() { static $x = 0; echo $x; $x++; } fun(); fun(); fun(); ?> |
A. | 012 |
B. | 123 |
C. | 111 |
D. | Error |
Answer» B. 123 | |
986. |
What will be the output of the following PHP code ? <?php static $x = 0; function fun() { echo $x; $x++; } fun(); fun(); fun(); ?> |
A. | 012 |
B. | 123 |
C. | Nothing |
D. | Error |
Answer» D. Error | |
987. |
What will be the output of the following PHP code ? <?php $x=0; function fun() { echo $GLOBALS['x']; $GLOBALS['x']++; } fun(); fun(); fun(); ?> |
A. | 000 |
B. | 012 |
C. | 123 |
D. | Error |
Answer» C. 123 | |
988. |
Which constructor will be called from the object created in the code below? class A { int i; A() { i=0; cout<<i; } A(int x=0) { i=x; cout<<I; } }; A obj1; |
A. | Default constructor |
B. | Parameterized constructor |
C. | Compile time error |
D. | Run time error |
Answer» D. Run time error | |
989. |
Which constructor will be called from the object obj2 in the following program? class A { int i; A() { i=0; } A(int x) { i=x+1; } A(int y, int x) { i=x+y; } }; A obj1(10); A obj2(10,20); A obj3; |
A. | A(int x) |
B. | A(int y) |
C. | A(int y, int x) |
D. | A(int y, int x) |
Answer» D. A(int y, int x) | |
990. |
What is we only create an object but don t call any constructor for it in java? |
A. | Implicit constructor will be called |
B. | Object is initialized to some null values |
C. | Object is not created |
D. | Object is created but points to null |
Answer» E. | |
991. |
Which of the conditional statements is/are supported by PHP?i) if statementsii) if-else statementsiii) if-elseif statementsiv) switch statements |
A. | Only i) |
B. | I), ii) and iv) |
C. | Ii), iii) and iv) |
D. | All of the mentioned. |
Answer» E. | |
992. |
Which of the looping statements is/are supported by PHP?i) for loopii) while loopiii) do-while loopiv) foreach loop |
A. | I) and ii) |
B. | I), ii) and iii) |
C. | All of the mentioned |
D. | None of the mentioned |
Answer» D. None of the mentioned | |
993. |
Choose the correct sequence of destructors being called for the following code: class A{ }; class B{ }; class C: public A, public B{ }; |
A. | ~A(), ~B(), ~C() |
B. | ~B(), ~C(), ~A() |
C. | ~A(), ~C(), ~B() |
D. | ~C(), ~B(), ~A() |
Answer» E. | |
994. |
Which class destructor will be called first, when following code go out of scope? class A{ }; class B{ }; class C: public B{ }; A a; B b; C c; |
A. | ~A() |
B. | ~B() |
C. | ~C() |
D. | ~B() and ~C() |
Answer» D. ~B() and ~C() | |
995. |
Dot . operator in strings are called as |
A. | Assignment operator |
B. | Concatenation operator |
C. | Concatenating assignment operator |
D. | Literal operator |
Answer» C. Concatenating assignment operator | |
996. |
Which of the following is/are not an exception? i) BadFunctionCallException ii) BadMethodCallException iii) LogicException iv) DomainException |
A. | All of the mentioned |
B. | Only iv) |
C. | Iii) and iv) |
D. | None of the mentioned |
Answer» E. | |
997. |
Which of the following is/are an external data? i) Cookies ii) Input data from a form iii) Server Variables iv) Web services data |
A. | Only ii) |
B. | Ii) and iii) |
C. | None of the mentioned |
D. | All of the mentioned |
Answer» E. | |
998. |
Which of the following is/are an exception? i) OutOfBoundException ii) OutOfRangeException iii) OverflowException iv) UnderflowException |
A. | All of the mentioned |
B. | I) and iii) |
C. | I) and ii) |
D. | None of the mentioned |
Answer» B. I) and iii) | |
999. |
What will be the output of the following PHP code? <?php $num = "123"; if (!filter_var($num, FILTER_VALIDATE_INT)) echo("Integer is not valid"); else echo("Integer is valid"); ?> |
A. | No output is returned |
B. | Integer is not valid |
C. | Integer is valid |
D. | Error |
Answer» D. Error | |
1000. |
What will be the output of the following PHP code? <?php $var=300; $int_options = array("options"=>array ("min_range"=>0, "max_range"=>256)); if (!filter_var($var, FILTER_VALIDATE_INT, $int_options)) echo("Integer is not valid"); else echo("Integer is valid"); ?> |
A. | No output is returned |
B. | Integer is not valid |
C. | Integer is valid |
D. | Error |
Answer» C. Integer is valid | |