Explore topic-wise MCQs in Testing Subject.

This section includes 657 Mcqs, each offering curated multiple-choice questions to sharpen your Testing Subject knowledge and support exam preparation. Choose a topic below to get started.

1.

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
2.

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
3.

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
4.

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
5.

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
6.

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
7.

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
8.

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
9.

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.
10.

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.
11.

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
12.

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.
13.

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.
14.

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
15.

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

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

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
17.

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.
18.

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.
19.

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.
20.

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
21.

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
22.

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
23.

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
24.

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
25.

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
26.

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.
27.

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
28.

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.
29.

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)
30.

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.
31.

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)
32.

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)
33.

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
34.

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
35.

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
36.

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
37.

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.
38.

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.
39.

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
40.

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
41.

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.
42.

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
43.

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.
44.

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
45.

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.
46.

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
47.

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.
48.

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
49.

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.
50.

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