Explore topic-wise MCQs in General Awareness.

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.

1001.

What will be the output of the following PHP code ? <?php $x = 4; $y = 3 $z = 1; $z = $z + $x + $y; echo "$z"; ?>

A. $z
B. 15
C. 8
D. 1
Answer» D. 1
1002.

What will be the output of the following PHP code ? <?php $x = 4; $y = 3; $z = 1; echo "$x = $x + $y + $z"; ?>

A. 4 = 4 + 3 + 1
B. 8
C. 8 = 4 + 3 +1
D. Error
Answer» B. 8
1003.

What will be the output of the following PHP code ? <?php $color1 = "red"; $color2 = "1"; $color3 = "grey" echo "$color1" + "$color2" . "$color3"; ?>

A. 1grey
B. Grey
C. 0
D. Red1grey
Answer» B. Grey
1004.

What will be the output of the following PHP code? <?php $value = 'car'; $result = filter_var($value, FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE); ?>

A. FALSE
B. TRUE
C. NULL
D. ERROR
Answer» D. ERROR
1005.

What will be the output of the following PHP code ? <?php $x = 5; $y = 10; $z = "$x + $y"; echo "$z"; ?>

A. 15
B. 10 + 5
C. $z
D. $x + $y
Answer» C. $z
1006.

What will be the output of the following PHP code ? <?php $x = 3.3; $y = 2; echo $x % $y; ?>

A. 0
B. 1
C. 2
D. Error
Answer» C. 2
1007.

What will be the output of the following PHP code ? <?php $x = 10; $y = 4; $z = 3; echo $x % $y % $z; ?>

A. 0
B. 1
C. 2
D. Error
Answer» D. Error
1008.

What will be the output of the following PHP code ? <?php $x = 10; $y = 4; $z = 3; echo ($x % ($y) + $z); ?>

A. 5
B. 3
C. 0
D. 1
Answer» B. 3
1009.

What will be the output of the following PHP code ? <?php $x = 30; $y = 20; $z = 10; echo $x + $y - $z / ($z - $y); ?>

A. 41
B. -4
C. -5
D. 51
Answer» E.
1010.

What will be the output of the following PHP code ? <?php $x = 4; $y = -3; $z = 11; echo 4 + $y * $z / $x; ?>

A. 4.25
B. 3.25
C. -3.25
D. -4.25
Answer» E.
1011.

What will be the output of the following PHP code ? <?php $x = 3.5; $y = 2; $z = 2; echo $x / $y / $z; ?>

A. 1.75
B. 0.875
C. 3.5
D. Error
Answer» C. 3.5
1012.

What will be the output of the following PHP code ? <?php one = 1; two = 2; three = 3; four = 4; echo "one / two + three / four"; ?>

A. 0.75
B. 0.05
C. 1.25
D. Error
Answer» E.
1013.

What will be the output of the following PHP code ? <?php $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. 1.25
D. Error
Answer» E.
1014.

What will be the output of the following PHP code ? <?php $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. 1.25
D. Error
Answer» B. 0.05
1015.

What will be the output of the following PHP code ? <?php echo $red; ?>

A. 0
B. Nothing
C. True
D. Error
Answer» C. True
1016.

What will be the output of the following PHP code ? <?php $four4 = 4; $three3 = 3; $two2 = 2; echo $four4 + $three3 / $two2 - 1; ?>

A. 4.5
B. 7
C. 3.5
D. Error
Answer» B. 7
1017.

What will be the output of the following PHP code ? <?php $4four = 4; $3three = 3; $2two = 2; echo $4four + $3three / $2two - 1; ?>

A. 4.5
B. 7
C. 3.5
D. Error
Answer» E.
1018.

What will be the output of the following PHP code ? <?php int $one = 1; echo "$one"; ?>

A. 0
B. 1
C. $one
D. Error
Answer» E.
1019.

What will be the output of the following PHP code ? <?php var $one = 1; var $two = 2; echo $one / $two * $one / $two * $two; ?>

A. 1
B. 0
C. 0.5
D. Error
Answer» E.
1020.

What will be the output of the following PHP code ? <?php $hello = "Hello World"; $bye = "Bye"; echo $hello;"$bye"; ?>

A. Hello World
B. Bye
C. Hello worldBye
D. Error
Answer» B. Bye
1021.

What will be the output of the following PHP code ? <?php $x; echo "$x"; ?>

A. 0
B. 1
C. Nothing
D. Error
Answer» D. Error
1022.

What will be the output of the following PHP code ? <?php $x = 5; { $x = 10; echo "$x"; } echo "$x"; ?>

A. 1010
B. 105
C. 510
D. Error
Answer» B. 105
1023.

What will be the output of the following PHP code ? <?php $x = 5; { echo "$x"; } ?>

A. 0
B. 5
C. Nothing
D. Error
Answer» C. Nothing
1024.

What will be the output of the following PHP code ? <?php $x = 5; function fun() { echo "$x"; } fun(); ?>

A. 0
B. 5
C. Nothing
D. Error
Answer» D. Error
1025.

What will be the output of the following PHP code ? <?php $x = 5; function fun() { $x = 10; echo "$x"; } fun(); echo "$x"; ?>

A. 0
B. 105
C. 510
D. Error
Answer» C. 510
1026.

What will be the output of the following PHP code ? <?php $x = 4; $y = 3; function fun($x = 3, $y = 4) { $z = $x+$y/$y+$x; echo "$z"; } echo $x; echo $y; echo $z; fun($x, $y); ?>

A. 43
B. 943
C. 349
D. 439
Answer» E.
1027.

What will be the output of the following PHP code ? <?php $x = 4; $y = 3; function fun($x, $y) { $z = $x + $y / $y + $x; echo "$z"; } echo $x; echo $y; echo $z; fun(3, 4); ?>

A. 437
B. 439
C. 349
D. 347
Answer» B. 439
1028.

What does PHP stand for?i) Personal Home Pageii) Hypertext Preprocessoriii) Pretext Hypertext Processoriv) Preprocessor Home Page

A. Both i) and iii)
B. Both ii) and iv)
C. Only ii)
D. Both i) and ii)
Answer» E.
1029.

Which of the following is/are a PHP code editor?i) Notepadii) Notepad++iii) Adobe Dreamweaveriv) PDT

A. Only iv)
B. All of the mentioned.
C. I), ii) and iii)
D. Only iii)
Answer» C. I), ii) and iii)
1030.

Which of the following must be installed on your computer so as to run PHP script?i) Adobe Dreamweaverii) PHPiii) Apacheiv) IIS

A. All of the mentioned.
B. Only ii)
C. Ii) and iii)
D. Ii), iii) and iv)
Answer» E.
1031.

We can use ___ to comment a single line?i) /?ii) //iii) #iv) /* */

A. Only ii)
B. I), iii) and iv)
C. Ii), iii) and iv)
D. Both ii) and iv)
Answer» D. Both ii) and iv)
1032.

Which of the following php statement/statements will store 111 in variable num?i) int $num = 111;ii) int mum = 111;iii) $num = 111;iv) 111 = $num;

A. Both i) and ii)
B. All of the mentioned
C. Only iii)
D. Only i)
Answer» D. Only i)
1033.

What will be the output of the following PHP code ? <?php "Hello World" ?>

A. Error
B. Hello World
C. Nothing
D. Missing semicolon error
Answer» D. Missing semicolon error
1034.

What will be the output of the following PHP code ? <?php print_r "Hello world" ?>

A. Error
B. Hello World
C. Nothing
D. Missing semicolon error
Answer» B. Hello World
1035.

What will be the output of the following PHP code ? <?php $color = "red"; echo "$color"; echo "$COLOR"; echo "$Color"; ?>

A. Redredred
B. Redred
C. Red
D. Error
Answer» D. Error
1036.

What will be the output of the following PHP code ? <?php # echo "Hello world"; echo "# Hello world"; ?>

A. # Hello world
B. Hello world# Hello world
C. Hello world
D. Error
Answer» B. Hello world# Hello world
1037.

What will be the output of the following PHP code ? <?php echo "Hello World" ?>

A. Hello world
B. Nothing
C. Echo Hello world
D. Error
Answer» E.
1038.

What will be the output of the following PHP code ? <?php echo "Hello world"; ?>

A. HELLO WORLD
B. Hello world
C. Nothing
D. Error
Answer» E.
1039.

What will be the output of the following PHP code ? <?php $color = red; echo " $color"; ?>

A. Red
B. $color
C. ed
D. Error
Answer» C. ed
1040.

What will be the output of the following PHP code ? <?php $color = red; echo "$color" . red ; ?>

A. Red red
B. Red
C. Error
D. Nothing
Answer» D. Nothing
1041.

What will be the output of the following PHP code ? <?php $color1 = red; $color2 = green; echo "$color1"."$color2"; ?>

A. Red green
B. Red
C. Green
D. Error
Answer» E.
1042.

What will be the output of the following PHP code ? <?php $color = "red"; $color = "green"; echo "$color"; ?>

A. Red
B. Green
C. Red green
D. Error
Answer» C. Red green
1043.

What will be the output of the following PHP code ? <?php $color1 = "red"; $color2 = "green"; echo "$color1" . "$color2"; ?>

A. Red
B. Green
C. Red green
D. Redgreen
Answer» E.
1044.

What will be the output of the following PHP code ? <?php $color1 = "red"; $color2 = "green"; echo "$color1" + "$color2"; ?>

A. Redgreen
B. Red green
C. 0
D. Error
Answer» D. Error
1045.

Which of the following can you place inside a namespace? i) classes ii) functions iii) variables

A. I)
B. Ii)
C. Iii)
D. All of the mentioned
Answer» E.
1046.

What will be the output of the following PHP code ? <?php $color1 = "red"; $color2 = "red"; echo "$color1" + "$color2"; ?>

A. Redgreen
B. Red green
C. 0
D. 1
Answer» D. 1
1047.

What will be the output of the following PHP code ? <?php $color1 = "red"; $color2 = "1"; echo "$color1" + "$color2"; ?>

A. Red1
B. Red 1
C. 0
D. 1
Answer» E.
1048.

What will be the output of the following PHP code ? <?php $color1 = "1"; $color2 = "1"; echo "$color1" + "$color2"; ?>

A. 11
B. 2
C. 0
D. 1
Answer» C. 0
1049.

Which of following variables can be assigned a value to it?i) $3helloii) $_helloiii) $thisiv) $This

A. All of the mentioned
B. Only ii)
C. Ii), iii) and iv)
D. Ii) and iv)
Answer» E.
1050.

What will be the output of the following PHP code ? <?php function fun($x,$y) { $x = 4; $y = 3; $z = $x + $y / $y + $x; echo "$z"; } fun(3, 4); ?>

A. 7
B. 9
C. 0
D. Error
Answer» C. 0