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.

1.

What will be the output of the following PHP code ?

A. rue
B. alse
C. rror
D. o output
Answer» B. alse
2.

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

A. rue
B. alse
C. rror
D. o output
Answer» E.
3.

What will be the output of the following PHP code ?

A. ow are uhello
B. ihello
C. i
D. o output
Answer» C. i
4.

What will be the output of the following PHP code ?

A. i
B. o output
C. rror
D. ow are u
Answer» E.
5.

What will be the output of the following PHP code?

A. ow are u
B. i
C. rror
D. o output
Answer» B. i
6.

What will be the output of the following PHP code ?

A. ello
B. nfinite loop
C. ihello
D. rror
Answer» C. ihello
7.

What will be the output of the following PHP code ?

A. i is printed 8 times, hello 7 times and then hi 2 times
B. i is printed 10 times, hello 7 times
C. i is printed once, hello 7 times
D. i is printed once, hello 7 times and then hi 2 times
Answer» E.
8.

What will be the output of the following PHP code ?

A. ello
B. nfinite loop
C. ihello
D. rror
Answer» B. nfinite loop
9.

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

A. 234567891011121314….infinitely
B. 1234567891011121314…infinitely
Answer» B. 1234567891011121314…infinitely
10.

What will be the output of the following PHP code ? 0){$i++; print $i; print "hello";}?>

A. hello4hello4hello4hello4hello…..infinite
B. hello5hello5hello5hello5hello…..infinite
C. o output
D. rror
Answer» B. hello5hello5hello5hello5hello…..infinite
11.

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

A. 10
B. 0
C. o output
D. nfinite loop
Answer» B. 0
12.

What will be the output of the following PHP code ?

A. n for loop
B. fter for loop
C. n for loopAfter for loop
D. nfinite loop
Answer» D. nfinite loop
13.

What will be the output of the following PHP code ?

A. 3-4-5
B. 3-4
C. nfinite loop
D. o output
Answer» E.
14.

What will be the output of the following PHP code ?

A. 23456789101112
B. 2345678910
C. 234567891011
D. nfinite loop
Answer» E.
15.

What will be the output of the following PHP code ?

A. *********
B. ********
C. **********
D. nfinite loop
Answer» C. **********
16.

What will be the output of the following PHP code ?

A. 23456789101112
B. 2345678910
C. 234567891011
D. nfinite loop
Answer» B. 2345678910
17.

What will be the output of the following PHP code ?

A. 0
B. 9
C. 2345678910….19
D. 2345678910….1920
Answer» B. 9
18.

What will be the output of the following PHP code ?

A. nfinite
B. 23…….20
C. 357…19
D. 3579…21
Answer» B. 23…….20
19.

What will be the output of the following PHP code ?

A. ello….36 times
B. ello….45 times
C. ello….50 times
D. ello….40 times
Answer» B. ello….45 times
20.

What will be the output of the following PHP code ?<

A. n for loopIn for loopIn for loopIn for loop……infinitely
B. fter for loopAfter for loopAfter for loop……..infinitely
C. n for loopAfter for loopIn for loopAfter for loopIn for loopAfter for loop…..infinitely
D. fter for loop
Answer» B. fter for loopAfter for loopAfter for loop……..infinitely
21.

What will be the output of the following PHP code ?

A. n for loop
B. fter for loop
C. n for loopAfter for loop
D. nfinite loop
Answer» C. n for loopAfter for loop
22.

What will be the output of the following PHP code ?

A. ll
B. ome
C. rror
D. o output
Answer» C. rror
23.

What will be the output of the following PHP code ?

A. ll
B. ome
C. rror
D. o output
Answer» D. o output
24.

What will be the output of the following PHP code ?

A. ll
B. ome
C. rror
D. one
Answer» D. one
25.

What will be the output of the following PHP code ?

A. rue
B. alse
C. rror
D. o output
Answer» B. alse
26.

What will be the output of the following PHP code ?

A. rue
B. alse
C. rror
D. o output
Answer» D. o output
27.

What will be the output of the following PHP code ?

A. ow are u
B. i
C. rror
D. o output
Answer» C. rror
28.

What will be the output of the following PHP code ? $y && 1||1)print "hi" ;elseprint "how are u";?>

A. ow are u
B. i
C. rror
D. o output
Answer» C. rror
29.

What will be the output of the following PHP code ? $y + $y != 3)print "hi" ;elseprint "how are u";?>

A. ow are u
B. i
C. rror
D. o output
Answer» C. rror
30.

What will be the output of the following PHP code ?

A. ll
B. ome
C. rror
D. o output
Answer» B. ome
31.

What will be the output of the following PHP code ?

A. i
B. ihello
C. rror
D. o output
Answer» D. o output
32.

What will be the output of the following PHP code ?

A. i
B. ihellohi
C. ihi
D. o output
Answer» B. ihellohi
33.

What will be the output of the following PHP code ?

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

What will be the output of the following PHP code ?

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

What will be the output of the following PHP code ?

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

What will be the output of the following PHP code ?

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

What will be the output of the following PHP code ?

A. how are u
B. hi
C. i
D. ow are u
Answer» C. i
38.

What will be the output of the following PHP code ?

A. ow are u
B. i
C. rror
D. o output
Answer» B. i
39.

What will be the output of the following PHP code ?

A. ow are u
B. i
C. rror
D. o output
Answer» C. rror
40.

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. ihellohi1
B. o output
C. ihi1
D. i1
Answer» C. ihi1
41.

What will be the output of the following PHP code ?

A. ihellohi1
B. ello
C. ihi1
D. i1
Answer» C. ihi1
42.

What will be the output of the following PHP code ?

A. ihellohi1
B. i
C. ihi1
D. i1
Answer» B. i
43.

What will be the output of the following PHP code ?

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

What will be the output of the following PHP code ?

A. hello
B. hi
C. hi1
D. rror
Answer» C. hi1
45.

What will be the output of the following PHP code ?

A. rror
B. i
C. ihello
D. ello
Answer» B. i
46.

What will be the output of the following PHP code ?

A. ihellohi1
B. i
C. ihello
D. ello
Answer» B. i
47.

What will be the output of the following PHP code ?

A. ihellohi1
B. i
C. ihello
D. ello
Answer» E.
48.

What will be the output of the following PHP code ?

A. ihellohi1
B. i
C. ihello
D. i1
Answer» C. ihello
49.

What will be the output of the following PHP code ?

A. nfinite loop
B. ihello
C. ello
D. rror
Answer» C. ello
50.

What will be the output of the following PHP code ?

A. nfinite loop
B. i
C. o output
D. rror
Answer» E.