Operators and Expressions | PHP Questions
Que. | What will be the output of the following PHP code ? $a = '12345'; echo 'qwe{$a}rty'; ?> |
|
a. | qwe12345rty | |
b. | error | |
c. | no output | |
d. | qwe{$a}rty | |
Answer: qwe{$a}rty |
Que. | What will be the output of the following PHP code ? $color = "red"; $color = "green"; echo "$color"; ?> |
|
a. | red green | |
b. | red | |
c. | green | |
d. | error | |
Answer: green |
Que. | What will be the output of the following PHP code ? $i = 0; while (++$i && --$i) { print $i; } ?> |
|
a. | error | |
b. | 1234567891011121314….infinitely | |
c. | no output | |
d. | 01234567891011121314…infinitely | |
Answer: no output |
Que. | What will be the output of the following PHP code ? $color1 = "red"; $color2 = "red"; echo "$color1" + "$color2"; ?> |
|
a. | redgreen | |
b. | 0 | |
c. | 1 | |
d. | red green | |
Answer: 0 |
Que. | What will be the output of the following PHP code ? define('IF', ; echo "IF: ", IF; ?> |
|
a. | ERROR | |
b. | IF: | |
c. | No output | |
d. | IF:42 | |
ERROR
Que. | What will be the output of the following PHP code ? $x = "test"; $y = "this"; $z = "also"; $x .= $y .= $z ; echo $x; echo $y; ?> |
|
a. | testthis | |
b. | error at line 4 | |
c. | testthisthisalso | |
d. | testthisalsothisalso | |
Answer: testthisalsothisalso |
Que. | What will be the output of the following PHP code ? $four4 = 4; $three3 = 3; $two2 = 2; echo $four4 + $three3 / $two2 - 1; ?> |
|
a. | Error | |
b. | 3.5 | |
c. | 7 | |
d. | 4.5 | |
Answer: 4.5 |
Que. | What will be the output of the following PHP code ? $var1 = 3; print $var = ++$var; ?> |
|
a. | 3 | |
b. | 0 | |
c. | 1 | |
d. | 2 | |
Answer: 1 |
Que. | What will be the output of the following PHP code ? $a = 12; --$a; echo $a++; ?> |
|
a. | 11 | |
b. | 10 | |
c. | error | |
d. | 12 | |
Answer: 11 |
Que. | What will be the output of the following PHP code ? function fun() { static $x = 0; echo $x; $x++; } fun(); fun(); fun(); ?> |
|
a. | Error | |
b. | 111 | |
c. | 123 | |
d. | 012 | |
012
Que. | What will be the output of the following PHP code ? static $x = 0; function fun() { echo $x; $x++; } fun(); fun(); fun(); ?> |
|
a. | 012 | |
b. | 123 | |
c. | Error | |
d. | Nothing | |
Answer: Nothing |
Que. | What will be the output of the following PHP code ? $x = 10; $y = 4; $z = 3; echo $x % $y % $z; ?> |
|
a. | 0 | |
b. | 2 | |
c. | Error | |
d. | 1 | |
Answer: 2 |
Que. | What will be the output of the following PHP code ? $i = 0; while ((--$i > ++$i) - 1) { print $i; } ?> |
|
a. | no output | |
b. | 00000000000000000000….infinitely | |
c. | -1-1-1-1-1-1-1-1-1-1…infinitely | |
d. | error | |
Answer: 00000000000000000000….infinitely |
Que. | What will be the output of the following PHP code ? echo "This", "was", "a", "bad", "idea"; ?> |
|
a. | This, was, a, bad, idea | |
b. | Thiswasabadidea | |
c. | This was a bad idea | |
d. | Error | |
Answer: Thiswasabadidea |
Que. | What will be the output of the following PHP code ? $a = 'a' ; print $a * 2; ?> |
|
a. | 192 | |
b. | 0 | |
c. | 2 | |
d. | error | |
0
Que. | What will be the output of the following PHP code ? $color1 = "red"; $color2 = "green"; echo "$color1" . "$color2"; ?> |
|
a. | redgreen | |
b. | red | |
c. | green | |
d. | red green | |
Answer: redgreen |
Que. | What will be the output of the following PHP code ? $var1 = 1; echo $var1 = ++$var1 % 2 + ++$var1; ?> |
|
a. | 3 | |
b. | 1 | |
c. | 2 | |
d. | 0 | |
Answer: 3 |
Que. | What will be the output of the following PHP code ? echo "echo "Hello World""; ?> |
|
a. | Error | |
b. | Hello world | |
c. | echo “Hello world” | |
d. | echo Hello world | |
Answer: Error |
Que. | What will be the output of the following PHP code ? $i = 1; if ($i++ && ($i == 1)) printf("Yesn$i"); else printf("Non$i"); ?> |
|
a. | Yes 2 | |
b. | No 2 | |
c. | Yes 1 | |
d. | No 1 | |
Answer: No 2 |
Que. | What will be the output of the following PHP code ? echo "This","was"|"a","bad"."idea"; ?> |
|
a. | Thiswas abadidea | |
b. | Thiswasabadidea | |
c. | Thiswas a badidea | |
d. | Thiswasbadidea | |
Thiswasbadidea
Que. | What will be the output of the following PHP code ? $x = 5; function fun() { echo "$x"; } fun(); ?> |
|
a. | 0 | |
b. | Error | |
c. | 5 | |
d. | Nothing | |
Answer: Nothing |
Que. | What will be the output of the following PHP code ? $y = 2; if (**$y == 4) { echo $y; } ?> |
|
a. | no output | |
b. | error at line2 | |
c. | 2 | |
d. | 4 | |
Answer: error at line2 |
Que. | What will be the output of the following PHP code ? class Constants { define('MIN_VALUE', '0.0'); define('MAX_VALUE', '1.0'); public static function getMinValue() { return self::MIN_VALUE; } public static function getMaxValue() { return self::MAX_VALUE; } } echo Constants::getMinValue(); echo Constants::getMaxValue(); ?> |
|
a. | ERROR | |
b. | 01 | |
c. | 0.01.0 | |
d. | No output | |
Answer: ERROR |
Que. | What will be the output of the following PHP code ? $x = 5; function fun() { $x = 10; echo "$x"; } fun(); echo "$x"; ?> |
|
a. | Error | |
b. | 105 | |
c. | 510 | |
d. | 0 | |
Answer: 105 |
Que. | What will be the output of the following PHP code ? $color1 = "1"; $color2 = "1"; echo "$color1" + "$color2"; ?> |
|
a. | 0 | |
b. | 1 | |
c. | 2 | |
d. | 11 | |
2
Que. | What will be the output of the following PHP code ? echo "Hello world"; ?> ?> |
|
a. | Hello world | |
b. | Hello | |
c. | Error | |
d. | Nothing | |
Answer: Error |
Que. | What will be the output of the following PHP code ? $color1 = "red"; $color2 = "1"; $color3 = "grey" echo "$color1" + "$color2" . "$color3"; ?> |
|
a. | grey | |
b. | red1grey | |
c. | 1grey | |
d. | 0 | |
Answer: 1grey |
Que. | What will be the output of the following PHP code ? $On_e = 1; $tw_o = 2; $thre_e = 3; $fou_r = 4; echo $on_e / $tw_o + $thre_e / $fou_r; ?> |
|
a. | 0.05 | |
b. | 0.75 | |
c. | Error | |
d. | 1.25 | |
Answer: 0.75 |
Que. | What will be the output of the following PHP code ? $var1 = 3; print ++$var++; ?> |
|
a. | 3 | |
b. | 5 | |
c. | 4 | |
d. | error | |
Answer: error |
Que. | What will be the output of the following PHP code ? $color1 = red; $color2 = green; echo "$color1"."$color2"; ?> |
|
a. | red green | |
b. | green | |
c. | red | |
d. | error | |
error
Que. | What will be the output of the following PHP code ? $a = "$winner"; $b = "/$looser"; echo $a,$b; ?> |
|
a. | $looser | |
b. | / | |
c. | /$looser | |
d. | $winner/$looser | |
Answer: / |
Que. | What will be the output of the following PHP code ? $one = "Hello"; $two = "World"; echo $one, $two; ?> |
|
a. | Hello World | |
b. | HelloWorld | |
c. | World | |
d. | Hello | |
Answer: HelloWorld |
Que. | What will be the output of the following PHP code ? $i = ""; while ($i = { print "hi"; } print "hello"; ?> |
|
a. | hihello | |
b. | error | |
c. | infinite loop | |
d. | hello | |
Answer: infinite loop |
Que. | What will be the output of the following PHP code ? $color1 = "red"; $color2 = "green"; echo "$color1" + "$color2"; ?> |
|
a. | 0 | |
b. | error | |
c. | red green | |
d. | redgreen | |
Answer: 0 |
Que. | What will be the output of the following PHP code ? $y = 2; if (--$y == 2 || $y xor --$y) { echo $y; } ?> |
|
a. | 1 | |
b. | 2 | |
c. | 0 | |
d. | no output | |
0
Que. | What will be the output of the following PHP code ? $auth = 1; $status = 1; if ($result = (($auth == 1) && ($status != 0))) { print "result is $result"; } ?> |
|
a. | result is true | |
b. | result is 1 | |
c. | no output | |
d. | error | |
Answer: result is 1 |
Que. | What will be the output of the following PHP code ? print "echo hello world"; ?> |
|
a. | echo hello world | |
b. | nothing | |
c. | error | |
d. | hello world | |
Answer: echo hello world |
Que. | What will be the output of the following PHP code ? $a = 1; $b = 1; $d = 1; print ++$a + ++$a+$a++; print $a++ + ++$b; print ++$d + $d++ + $a++; ?> |
|
a. | 368 | |
b. | 869 | |
c. | 742 | |
d. | error | |
Answer: 869 |
Que. | What will be the output of the following PHP code ? $i = 0; $x = $i++; $y = ++$i; print $x; print $y; ?> |
|
a. | 01 | |
b. | 12 | |
c. | 02 | |
d. | 21 | |
Answer: 02 |
Que. | What will be the output of the following PHP code ? $x = 5; $y = 10; $z = "$x + $y"; echo "$z"; ?> |
|
a. | 15 | |
b. | $x + $y | |
c. | $z | |
d. | 10 + 5 | |
10 + 5
Que. | What will be the output of the following PHP code ? echo $x-- != ++$x; ?> |
|
a. | 1 | |
b. | 0 | |
c. | no output | |
d. | error | |
Answer: 1 |
Que. | What will be the output of the following PHP code ? define("GREETING", "PHP is a scripting language"); echo $GREETING; ?> |
|
a. | no output | |
b. | $GREETING | |
c. | GREETING | |
d. | PHP is a scripting language | |
Answer: no output |
Que. | What will be the output of the following PHP code ? $one = "one"; $two = "two"; print($one,$two); ?> |
|
a. | one, two | |
b. | onetwo | |
c. | one | |
d. | error | |
Answer: error |
Que. | The result of below two statements will be: Round(2.5) Round(-2.5) |
|
a. | 3.5, -3.5 | |
b. | 2.5, -2 | |
c. | 3, -3 | |
d. | 2, -2 | |
Answer: 3, -3 |
Que. | What will be the output of the following PHP code ? "Hello World" ?> |
|
a. | Error | |
b. | Missing semicolon error | |
c. | Hello World | |
d. | Nothing | |
Nothing
Que. | What will be the output of the following PHP code ? $x = 30; $y = 20; $z = 10; echo $x + $y - $z / ($z - $y); ?> |
|
a. | 51 | |
b. | -4 | |
c. | -5 | |
d. | 41 | |
Answer: 51 |
Que. | What will be the output of the following PHP code ? $one = "Hello"; $two = "World"; echo "$one"+"$two"; ?> |
|
a. | 0 | |
b. | HelloWorld | |
c. | Hello+World | |
d. | Error | |
Answer: 0 |
Que. | What will be the output of the following PHP code ? $i = 0; $j = 0; if ($i && ($j = $i + ) { echo "true"; } echo $j; ?> |
|
a. | true10 | |
b. | 10 | |
c. | 0 | |
d. | true0 | |
Answer: 0 |
Que. | What will be the output of the following PHP code ? $i = 10; $j = 0; if ($i || ($j = $i + ) { echo "true"; } echo $j; ?> |
|
a. | 0 | |
b. | 20 | |
c. | true0 | |
d. | true20 | |
Answer: true0 |
Que. | What will be the output of the following PHP code ? $one = "Hello"; $two = "World"; echo "$one$two"; ?> |
|
a. | Hello | |
b. | Error | |
c. | $one$two | |
d. | HelloWorld | |
HelloWorld
Que. | What will be the output of the following PHP code ? $a = "$winner"; $b = "$looser"; echo $a, $b; ?> |
|
a. | $winner$looser | |
b. | $looser | |
c. | $looser | |
d. | \ | |
Answer: \ |
Que. | What will be the output of the following PHP code ? $color = red; echo "$color" . red ; ?> |
|
a. | red | |
b. | error | |
c. | red red | |
d. | nothing | |
Answer: error |
Que. | What will be the output of the following PHP code ? $i = 0;$j = 1;$k = 2; print (( + + $i + $j) >! ($j - $k)); ?> |
|
a. | error | |
b. | 1 | |
c. | no output | |
d. | 0 | |
Answer: 1 |
Que. | What will be the output of the following PHP code ? $cars = array("Volvo", "BMW", "Toyota"); echo "My car is a {$cars[0]}"; ?> |
|
a. | My car is a Volvo | |
b. | My car is a BMW | |
c. | My car is a Toyota | |
d. | Error | |
Answer: My car is a Volvo |
Que. | What will be the output of the following PHP code ? echo 5 * 9 / 3 + 9; ?> |
|
a. | 3.7 | |
b. | 0 | |
c. | 3.85 | |
d. | 24 | |
24
Que. | What will be the output of the following PHP code ? $on_e = 1; $tw_o = 2; $thre_e = 3; $fou_r = 4; echo $on_e / $tw_o + $thre_e / $fou_r; ?> |
|
a. | 0.75 | |
b. | Error | |
c. | 1.25 | |
d. | 0.05 | |
Answer: 1.25 |
Que. | What will be the output of the following PHP code ? echo $red; ?> |
|
a. | Error | |
b. | Nothing | |
c. | True | |
d. | 0 | |
Answer: Nothing |
Que. | What will be the output of the following PHP code ? define("NEW_GOOD_NAME_CONSTANT", "I have a value"); define("OLD_BAD_NAME_CONSTANT", NEW_GOOD_NAME_CONSTANT); echo NEW_GOOD_NAME_CONSTANT; echo OLD_BAD_NAME_CONSTANT; ?> |
|
a. | I have a value | |
b. | I have a valueI have a value | |
c. | I have a valueNEW_GOO_NAME_CONSTANTS | |
d. | ERROR | |
Answer: I have a valueI have a value |
Que. | What will be the output of the following PHP code ? $i = 0; $j = 1; $k = 2; print !(($i + $k) < ($j - $k)); ?> |
|
a. | 0 | |
b. | 1 | |
c. | false | |
d. | true | |
Answer: 1 |
Que. | What will be the output of the following PHP code ? $i = 5; while (--$i > 0) { $i++; print $i; print "hello"; } ?> |
|
a. | 4hello4hello4hello4hello4hello…..infinite | |
b. | 5hello5hello5hello5hello5hello…..infinite | |
c. | error | |
d. | no output | |
4hello4hello4hello4hello4hello…..infinite
Que. | What will be the output of the following PHP code ? $color1 = "red"; $color2 = "1"; echo "$color1" + "$color2"; ?> |
|
a. | 1 | |
b. | 0 | |
c. | red1 | |
d. | red 1 | |
Answer: 1 |
Que. | What will be the output of the following PHP code ? $4four = 4; $3three = 3; $2two = 2; echo $4four + $3three / $2two - 1; ?> |
|
a. | Error | |
b. | 4.5 | |
c. | 7 | |
d. | 3.5 | |
Answer: Error |
Que. | What will be the output of the following PHP code ? echo "This"."was"."a"."bad"."idea"; ?> |
|
a. | Error | |
b. | Thiswasabadidea | |
c. | This, was, a, bad, idea | |
d. | This was a bad idea | |
Answer: Thiswasabadidea |
Que. | What will be the output of the following PHP code ? $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. | 4100 | |
b. | 410 | |
c. | 104 | |
d. | 1400 | |
Answer: 1400 |
Que. | What will be the output of the following PHP code ? $y = 2; if ($y-- == ++$y) { echo $y; } ?> |
|
a. | 1 | |
b. | 2 | |
c. | 3 | |
d. | no output | |
2
Que. | What will be the output of the following PHP code ? echo "Hello World" ?> |
|
a. | Error | |
b. | Hello world | |
c. | Nothing | |
d. | Hello world in italics | |
Answer: Hello world in italics |
Que. | What will be the output of the following PHP code ? $a = 0x6db7; print $a<<6; ?> |
|
a. | 1797568 | |
b. | error | |
c. | no output | |
d. | 0x6dc0 | |
Answer: 1797568 |
Que. | What will be the output of the following PHP code ? $x; echo "$x"; ?> |
|
a. | Nothing | |
b. | 0 | |
c. | 1 | |
d. | Error | |
Answer: Nothing |
Que. | What will be the output of the following PHP code ? $hello = "Hello World"; $bye = "Bye"; echo $hello;"$bye"; ?> |
|
a. | Error | |
b. | Bye | |
c. | Hello worldBye | |
d. | Hello World | |
Answer: Hello World |
Que. | In PHP the integer 45 is stored exactly as 45. The floating point number 46.3 could be stored as. | |
a. | 46.2999999 | |
b. | 46.3 | |
c. | 46 | |
d. | none of above | |
46.2999999
Que. | What will be the output of the following PHP code ? $i = 5; while (--$i > 0 || ++$i) { print $i; } ?> |
|
a. | 5 | |
b. | 555555555…infinitely | |
c. | 54321 | |
d. | 54321111111….infinitely | |
Answer: 54321111111….infinitely |
Que. | If you do something to an integer that makes it larger than the maximum allowable integer or smaller than the minimum possible integer, the PHP interpreter converts the result into a . . . . . |
|
a. | String | |
b. | Floating point number | |
c. | Integers | |
d. | None of above | |
Answer: Floating point number |
Que. | What will be the output of the following PHP code ? $color = red; echo "$color"; ?> |
|
a. | red | |
b. | red | |
c. | $color | |
d. | Error | |
Answer: $color |
Que. | What will be the output of the following PHP code ? $one = "one"; $two = "two"; print("$one$two"); ?> |
|
a. | error | |
b. | onetwo | |
c. | $one$two | |
d. | one | |
Answer: onetwo |
Que. | What will be the output of the following PHP code ? $a = '12345'; echo "qwe$arty"; ?> |
|
a. | qwe$arty | |
b. | qwe | |
c. | qwe12345rty | |
d. | error | |
qwe
Que. | What will be the output of the following PHP code ? $a = 10; $b = 10; if ($a = 5) $b--; print $a;print $b--; ?> |
|
a. | 58 | |
b. | 109 | |
c. | 59 | |
d. | 108 | |
Answer: 59 |
Que. | What will be the output of the following PHP code ? class myObject { } define('myObject::CONSTANT', 'test'); echo myObject::CONSTANT; ?> |
|
a. | test | |
b. | error | |
c. | no output | |
d. | myObject::CONSTANT | |
Answer: error |
Que. | What will be the output of the following PHP code ? $x = 5; { echo "$x"; } ?> |
|
a. | Nothing | |
b. | Error | |
c. | 0 | |
d. | 5 | |
Answer: 5 |
Que. | What will be the output of the following PHP code ? $var1 = 0; $var1 = $var1++ + 5; echo $var1; ?> |
|
a. | 6 | |
b. | 7 | |
c. | error | |
d. | 5 | |
Answer: 5 |
Que. | What will be the output of the following PHP code ? define("__LINE__", "PHP is a scripting language"); echo __LINE__; ?> |
|
a. | __LINE__ | |
b. | ERROR | |
c. | PHP is a scripting language | |
d. | 2 | |
2
Que. | What will be the output of the following PHP code ? $x = 4; $y = 3 $z = 1; $z = $z + $x + $y; echo "$z"; ?> |
|
a. | $z | |
b. | 8 | |
c. | 15 | |
d. | 1 | |
Answer: 8 |
Que. | What will be the output of the following PHP code ? # echo "Hello world"; echo "# Hello world"; ?> |
|
a. | Hello world# Hello world | |
b. | Error | |
c. | # Hello world | |
d. | Hello world | |
Answer: # Hello world |
Que. | What will be the output of the following PHP code ? $x = 5; $y = 10; function fun() { $GLOBALS['y'] = $GLOBALS['x'] + $GLOBALS['y']; } fun(); echo $y; ?> |
|
a. | Error | |
b. | 15 | |
c. | 5 | |
d. | 10 | |
Answer: 15 |
Que. | What will be the output of the following PHP code ? $a = '4' ; print + + $a; ?> |
|
a. | 5 | |
b. | no output | |
c. | error | |
d. | 0 | |
Answer: 5 |
Que. | What will be the output of the following PHP code ? $one = "one"; $two = "one"; print($one == $two); ?> |
|
a. | error | |
b. | false | |
c. | true | |
d. | 1 | |
1
Que. | What will be the output of the following PHP code ? $i = 2; while (++$i) { while (--$i > 0) print $i; } ?> |
|
a. | no output | |
b. | 10 | |
c. | infinite loop | |
d. | 210 | |
Answer: infinite loop |
Que. | What will be the output of the following PHP code ? $b = 1; $c = 4; $a = 5; $d = $b + $c == $a; print $d; ?> |
|
a. | 10 | |
b. | 0 | |
c. | 5 | |
d. | 1 | |
Answer: 1 |
Que. | What will be the output of the following PHP code ? $a = 10; echo ++$a; echo $a++; echo $a; echo ++$a; ?> |
|
a. | 11121213 | |
b. | 11111112 | |
c. | 11111212 | |
d. | 11111213 | |
Answer: 11111213 |
Que. | What will be the output of the following PHP code ? $i = 5; while (--$i > 0 && ++$i) { print $i; }< ?> |
|
a. | error | |
b. | 5 | |
c. | 555555555…infinitely | |
d. | 54321 | |
Answer: 555555555…infinitely |
Que. | PHP can automatically convert integers to floating point numbers and floating point numbers to integers. |
|
a. | Option A | |
b. | FALSE | |
c. | NA | |
d. | TRUE | |
na
Que. | What will be the output of the following PHP code ? $a = '12345'; print "qwe{$a}rty"; ?> |
|
a. | qwe12345rty | |
b. | qwe{$a}rty | |
c. | no output | |
d. | error | |
Answer: qwe12345rty |
Que. | What will be the output of the following PHP code ? $var1 = 0; $var1 = ++$var1 + 5; echo $var1; ?> |
|
a. | 5 | |
b. | error | |
c. | 7 | |
d. | 6 | |
Answer: 6 |
Que. | What will be the output of the following PHP code ? $cars = array("Volvo", "BMW", "Toyota"); print $cars[2]; ?> |
|
a. | Toyota | |
b. | Error | |
c. | Volvo | |
d. | BMW | |
Answer: Toyota |
Que. | What will be the output of the following PHP code ? $i = 2; while (++$i) { while ($i --> 0) print $i; } ?> |
|
a. | no output | |
b. | 210 | |
c. | infinite loop | |
d. | 10 | |
Answer: 210 |
Que. | What will be the output of the following PHP code ? $x = 1; $y = 2; if (++$x == $y++) { echo "true ", $y, $x; } ?> |
|
a. | true 33 | |
b. | no output | |
c. | true 22 | |
d. | true 23 | |
true 23
Que. | What will be the output of the following PHP code ? one = 1; two = 2; three = 3; four = 4; echo "one / two + three / four"; ?> |
|
a. | 0.05 | |
b. | 0.75 | |
c. | Error | |
d. | 1.25 | |
Answer: Error |
Que. | What will be the output of the following PHP code ? var $one = 1; var $two = 2; echo $one / $two * $one / $two * $two; ?> |
|
a. | 0.5 | |
b. | Error | |
c. | 0 | |
d. | 1 | |
Answer: Error |
Que. | What will be the output of the following PHP code ? print("this"."was"."a"."bad"."idea"); ?> |
|
a. | this was a bad idea | |
b. | error | |
c. | thiswasabadidea | |
d. | nothing | |
Answer: thiswasabadidea |
Que. | What will be the output of the following PHP code ? $x = 5; $y = 10; function fun() { $y = $GLOBALS['x'] + $GLOBALS['y']; } fun(); echo $y; ?> |
|
a. | Error | |
b. | 10 | |
c. | 5 | |
d. | 15 | |
Answer: 10 |
Que. | What will be the output of the following PHP code ? $y = 2; if (--$y <> ($y != $y++)) { echo $y; } ?> |
|
a. | 1 | |
b. | 0 | |
c. | 2 | |
d. | no output | |
0
Que. | What will be the output of the following PHP code ? $a = "$winner"; $b = "$looser"; echo $a, $b; ?> |
|
a. | $looser | |
b. | $looser | |
c. | $winner$looser | |
d. | \ | |
Answer: $looser |
Que. | What will be the output of the following PHP code ? $x = 10; $y = 4; $z = 3; echo ($x % ($y) + $z); ?> |
|
a. | 0 | |
b. | 1 | |
c. | 3 | |
d. | 5 | |
Answer: 5 |
Que. | What will be the output of the following PHP code ? $x = 4; $y = -3; $z = 11; echo 4 + $y * $z / $x; ?> |
|
a. | 3.25 | |
b. | -3.25 | |
c. | -4.25 | |
d. | 4.25 | |
Answer: -4.25 |
Que. | What will be the output of the following PHP code ? $one = "one"; $two = "two"; print($one$two); ?> |
|
a. | nothing | |
b. | error | |
c. | one | |
d. | onetwo | |
Answer: error |
Que. | What will be the output of the following PHP code ? $a = 1; $b = 3; $d = $a++ + ++$b; echo $d; ?> |
|
a. | 4 | |
b. | 5 | |
c. | error | |
d. | 3 | |
5
Que. | What will be the output of the following PHP code ? $var1 = 0; $var1 = $var1 + 5; echo $var1++; ?> |
|
a. | 7 | |
b. | error | |
c. | 6 | |
d. | 5 | |
Answer: 5 |
Que. | What will be the output of the following PHP code ? $i = 0; while ($i = { print "hi"; } print "hello"; ?> |
|
a. | hihello | |
b. | infinite loop | |
c. | error | |
d. | hello | |
Answer: infinite loop |
Que. | What will be the output of the following PHP code ? $a = '12345'; print "qwe".$a."rty"; ?> |
|
a. | error | |
b. | qwe12345rty | |
c. | qwe$arty | |
d. | no output | |
Answer: qwe12345rty |
Que. | What will be the output of the following PHP code ? $i = 0; while(++$i || --$i) { print $i; } ?> |
|
a. | 01234567891011121314…infinitely | |
b. | 1 | |
c. | 0 | |
d. | 1234567891011121314….infinitely | |
Answer: 1234567891011121314….infinitely |
Que. | PHP will automatically convert strings to numbers when it needs to. |
|
a. | Option A | |
b. | TRUE | |
c. | FALSE | |
d. | NA | |
na
Que. | What will be the output of the following PHP code ? print_r "Hello world" ?> |
|
a. | Nothing | |
b. | Error | |
c. | Missing semicolon error | |
d. | Hello World | |
Answer: Error |
Que. | What will be the output of the following PHP code ? $a = 5; $b = -7; $c =0; $d = ++$a && ++$b || ++$c; print $d; print $a; ?> |
|
a. | 06 | |
b. | 05 | |
c. | 15 | |
d. | 16 | |
Answer: 16 |
Que. | What will be the output of the following PHP code ? $a = 5;$b = -7;$c =0; $d = ++$a && ++$b || ++$c; print $d;print $a; ?> |
|
a. | 05 | |
b. | 16 | |
c. | 15 | |
d. | 06 | |
Answer: 16 |
Que. | What will be the output of the following PHP code ? $x = 3.5; $y = 2; $z = 2; echo $x / $y / $z; ?> |
|
a. | 1.75 | |
b. | 0.875 | |
c. | Error | |
d. | 3.5 | |
Answer: 0.875 |
Que. | What will be the output of the following PHP code ? $i = 0;$j = 1;$k = 2; print !(( + + $i + $j) > ($j - $k)); ?> |
|
a. | error | |
b. | no output | |
c. | 1 | |
d. | 0 | |
no output
Que. | What will be the output of the following PHP code ? $var1 = 1; echo $var1 = ++$var1 % 2 + ++$var1; ?> |
|
a. | 2 | |
b. | 0 | |
c. | 1 | |
d. | 3 | |
Answer: 3 |
Que. | What will be the output of the following PHP code ? $x=0; function fun() { echo $GLOBALS['x']; $GLOBALS['x']++; } fun(); fun(); fun(); ?> |
|
a. | 000 | |
b. | Error | |
c. | 012 | |
d. | 123 | |
Answer: 012 |
Que. | What will be the output of the following PHP code ? $x = 5; { $x = 10; echo "$x"; } echo "$x"; ?> |
|
a. | error | |
b. | 1010 | |
c. | 105 | |
d. | 510 | |
Answer: 1010 |
Que. | What will be the output of the following PHP code ? $color = "red"; echo "$color"; echo "$COLOR"; echo "$Color"; ?> |
|
a. | redred | |
b. | Error | |
c. | red | |
d. | redredred | |
Answer: red |
Que. | What will be the output of the following PHP code ? $x = 3.3; $y = 2; echo $x % $y; ?> |
|
a. | 1 | |
b. | Error | |
c. | 0 | |
d. | 2 | |
1
Que. | What will be the output of the following PHP code ? $one = "one"; $two = "two"; print($one==$two); ?> |
|
a. | true | |
b. | false | |
c. | error | |
d. | nothing | |
Answer: nothing |
Que. | What will be the output of the following PHP code ? $x = 0; function fun() { echo $GLOBALS['x']; $x++; } fun(); fun(); fun(); ?> |
|
a. | 000 | |
b. | Error | |
c. | 012 | |
d. | Nothing | |
Answer: 000 |
Que. | What will be the output of the following PHP code ? $on$e = 1; $tw$o = 2; $thre$e = 3; $fou$r = 4; echo "$on$e / $tw$o + $thre$e / $fou$r"; ?> |
|
a. | 0.75 | |
b. | 0.05 | |
c. | Error | |
d. | 1.25 | |
Answer: Error |
Que. | What will be the output of the following PHP code ? $var1 = 1 + ++5; echo $var1; ?> |
|
a. | no output | |
b. | 7 | |
c. | error | |
d. | 6 | |
Answer: error |
Que. | What will be the output of the following PHP code ? function fun() { $x = 0; echo $x; $x++; } fun(); fun(); fun(); ?> |
|
a. | 111 | |
b. | 012 | |
c. | 123 | |
d. | 000 | |
000
Que. | What will be the output of the following PHP code ? $y = 2; $w = 4; $y *= $w /= $y; echo $y, $w; ?> |
|
a. | 44 | |
b. | 42 | |
c. | 80.5 | |
d. | 82 | |
Answer: 42 |
Que. | What will be the output of the following PHP code ? echo 5 * 9 / 3 + 9; ?> |
|
a. | 3.7 | |
b. | 0 | |
c. | 24 | |
d. | 3.85 | |
Answer: 24 |
Que. | What will be the output of the following PHP code ? $one = 1; print($one); print $one; ?> |
|
a. | Error | |
b. | 10 | |
c. | 11 | |
d. | 01 | |
Answer: 11 |
Que. | What will be the output of the following PHP code ? define("VAR_NAME","test"); ${VAR_NAME} = "value"; echo VAR_NAME; echo ${VAR_NAME}; ?> |
|
a. | testtest | |
b. | test | |
c. | error, constant value cannot be changed | |
d. | testvalue | |
Answer: testvalue |
Que. | What will be the output of the following PHP code ? int $one = 1; echo "$one"; ?> |
|
a. | Error | |
b. | $one | |
c. | 0 | |
d. | 1 | |
Error
Que. | What will be the output of the following PHP code ? echo "This is India"; ?> |
|
a. | This is India | |
b. | This is | |
c. | Error | |
d. | This is India | |
Answer: This is India |
Que. | What will be the output of the following PHP code ? $var1 = 0; $var1 = ($var1 + 5)++; echo $var1; ?> |
|
a. | 5 | |
b. | error | |
c. | 7 | |
d. | 6 | |
Answer: error |
Que. | What will be the output of the following PHP code ? $x = 4; $y = 3; $z = 1; echo "$x = $x + $y + $z"; ?> |
|
a. | 8 | |
b. | 4 = 4 + 3 + 1 | |
c. | Error | |
d. | 8 = 4 + 3 +1 | |
Answer: 4 = 4 + 3 + 1 |
Comments