Explore topic-wise MCQs in Php.

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

51.

What will be the output of the following PHP code ?

A. ello
B. i
C. o output
D. rror
Answer» D. rror
52.

What will be the output of the following PHP code ?

A. ello
B. i
C. o output
D. rror
Answer» D. rror
53.

What will be the output of the following PHP code ?

A. 0
B. nfinite loop
C. o output
D. rror
Answer» C. o output
54.

What will be the output of the following PHP code ?

A. 4
B. 34
C. 234
Answer» B. 34
55.

What will be the output of the following PHP code ?

A. ihihi
B. ihellohihellohihello
C. ellohellohello
D. i
Answer» E.
56.

What will be the output of the following PHP code ?

A. ihihi
B. ihellohihellohihello
C. ellohellohello
D. i
Answer» B. ihellohihellohihello
57.

What will be the output of the following PHP code ?

A. shleyBaleBlank
B. shleyBale
C. shleyBaleShrek
D. o output
Answer» B. shleyBale
58.

What will be the output of the following PHP code ? $i; $i--)print $i;}?>

A. nfinite loop
B. 1 2 3 4 5
C. 1 0 1 2 0 1 2 3 0 1 2 3 4 0 1 2 3 4 5 0 1 2 3 4 5
D. o output
Answer» E.
59.

What will be the output of the following PHP code ? 0; $i--)print $i;}?>

A. nfinite loop
B. 1 2 3 4 5
C. 1 0 1 2 0 1 2 3 0 1 2 3 4 0 1 2 3 4 5 0 1 2 3 4 5
D. o output
Answer» B. 1 2 3 4 5
60.

What will be the output of the following PHP code ?

A. 1 2 3 4
B. 1 2 3
C. 1 2 3 4 5
D. rror
Answer» C. 1 2 3 4 5
61.

What will be the output of the following PHP code ?

A. ihellobye
B. nfinite loop
C. ihello
D. o output
Answer» E.
62.

What will be the output of the following PHP code ?

A. iiii
B. nfinite loop
C. iiiiiiiiiiiiiiiiiiiiiiii
D. o output
Answer» B. nfinite loop
63.

What will be the output of the following PHP code ?

A. rror
B. nfinite loop
C. o output
Answer» C. o output
64.

What will be the output of the following PHP code ?

A. shleyBaleBlank
B. aleShrek
C. shleyBlank
D. ale
Answer» C. shleyBlank
65.

What will be the output of the following PHP code ?

A. shleyBaleBlank
B. ale
C. shleyShrek
D. aleBlank
Answer» B. ale
66.

What will be the output of the following PHP code ?

A. rrayArrayArrayArrayArrayArray….infinitely
B. “hi”,”hello”,”bye”)(“hi”,”hello”,”bye”)(“hi”,”hello”,”bye”)(“hi”,”hello”,”bye”)…infinitely
C. ihellobyehihellobyehihellobyehihellobyehihellobyehihellobye…..infinitely
D. o output
Answer» B. “hi”,”hello”,”bye”)(“hi”,”hello”,”bye”)(“hi”,”hello”,”bye”)(“hi”,”hello”,”bye”)…infinitely
67.

What will be the output of the following PHP code ?~!

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

What will be the output of the following PHP code ?%!

A. true
B. false
C. error
D. no output
Answer» B. false
69.

What will be the output of the following PHP code ?%!

A. all
B. some
C. error
D. no output
Answer» C. error
70.

What will be the output of the following PHP code ?%!

A. hello
B. infinite loop
C. hihello
D. error
Answer» C. hihello
71.

What will be the output of the following PHP code ?$i = 0;while(?++$i || --$i){ print $i;}?>%!

A. 1234567891011121314….infinitely
B. 01234567891011121314…infinitely
C. 1
D. 0
Answer» B. 01234567891011121314‚Äö√Ѭ∂infinitely
72.

What will be the output of the following PHP code ?%!

A. 0
B. infinite loop
C. no output
D. error
Answer» E.
73.

What will be the output of the following PHP code ?%!

A. In for loop
B. After for loop
C. In for loopAfter for loop
D. Infinite loop
Answer» D. Infinite loop
74.

What will be the output of the following PHP code ?%!

A. 20
B. 19
C. 12345678910….19
D. 12345678910….1920
Answer» B. 19
75.

What will be the output of the following PHP code ?%!

A. hihellohi1
B. no output
C. hihi1
D. hi1
Answer» C. hihi1
76.

What will be the output of the following PHP code ?%!

A. hi
B. hihello
C. error
D. no output
Answer» D. no output
77.

What will be the output of the following PHP code ?%!

A. hellolength
B. 5
C. hi
D. error
Answer» B. 5
78.

What will be the output of the following PHP code ?%!

A. 2
B. 3
C. 0
D. 1
Answer» C. 0
79.

What will be the output of the following PHP code ?%!

A. 1hello
B. 1hi
C. 1hi1
D. error
Answer» C. 1hi1
80.

What will be the output of the following PHP code ?%!

A. hihellobye
B. infinite loop
C. hihello
D. no output
Answer» E.
81.

*$_What will be the output of the following PHP code ??

A. 10
B. infinite loop
C. no output
D. error
Answer» C. no output
82.

*$_What will be the output of the following PHP code ??

A. hihellobye
B. infinite loop
C. hihello
D. no output
Answer» E.
83.

*/*_What will be the output of the following PHP code ??

A. 1hello
B. 1hi
C. 1hi1
D. error
Answer» C. 1hi1
84.

*/*_What will be the output of the following PHP code ??

A. 2
B. 3
C. 0
D. 1
Answer» C. 0
85.

*/*_What will be the output of the following PHP code ??

A. hellolength
B. 5
C. hi
D. error
Answer» B. 5
86.

*/*_What will be the output of the following PHP code ??

A. hihellohi1
B. no output
C. hihi1
D. hi1
Answer» C. hihi1
87.

*/*_What will be the output of the following PHP code ??

A. hi
B. hihello
C. error
D. no output
Answer» D. no output
88.

*/*_What will be the output of the following PHP code ??

A. all
B. some
C. error
D. no output
Answer» C. error
89.

*/*_What will be the output of the following PHP code ??

A. how are u
B. hi
C. error
D. no output
Answer» C. error
90.

*/*_What will be the output of the following PHP code ??

A. true
B. false
C. error
D. no output
Answer» B. false
91.

*/*_What will be the output of the following PHP code ??

A. 20
B. 19
C. 12345678910….19
D. 12345678910….1920
Answer» B. 19
92.

*/*_What will be the output of the following PHP code ??

A. In for loop
B. After for loop
C. In for loopAfter for loop
D. Infinite loop
Answer» D. Infinite loop
93.

*/*_What will be the output of the following PHP code ??

A. 0
B. infinite loop
C. no output
D. error
Answer» E.
94.

*/*_What will be the output of the following PHP code ?$i = 0;while(?++$i || --$i){ print $i;}?>?

A. 1234567891011121314….infinitely
B. 01234567891011121314…infinitely
C. 1
D. 0
Answer» B. 01234567891011121314‚Äö√Ѭ∂infinitely
95.

*/*_What will be the output of the following PHP code ??

A. hello
B. infinite loop
C. hihello
D. error
Answer» C. hihello
96.

*/*_What will be the output of the following PHP code ?= 0) print "true"; else print "false"; ?>?

A. true
B. false
C. error
D. no output
Answer» E.
97.

*/*_What will be the output of the following PHP code ??

A. 0
B. infinite loop
C. -1
D. 1
Answer» D. 1
98.

*/*_What will be the output of the following PHP code ??

A. all
B. some
C. error
D. no output
Answer» D. no output
99.

*/*_What will be the output of the following PHP code ??

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

*/*_What will be the output of the following PHP code ? 0 || ++$i){ print $i;}?>?

A. 54321111111….infinitely
B. 555555555…infinitely
C. 54321
D. 5
Answer» B. 555555555‚Äö√Ѭ∂infinitely