Explore topic-wise MCQs in Php.

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

1.

Which of the following are valid function names?1. function()2. €()3. .function()4. $function()

A. nly 2
B. one of the mentioned
C. ll of the mentioned
D. and 4
Answer» B. one of the mentioned
2.

What will happen in this function call?

A. all By Value
B. all By Reference
C. efault Argument Value
D. ype Hinting
Answer» B. all By Reference
3.

What will be the output of the following PHP code ?

A. am here to spoil this code
B. rror
C. y favourite TV show isI am here to spoil this code
D. one of the mentioned
Answer» C. y favourite TV show isI am here to spoil this code
4.

What will be the output of the following PHP code ?

A. IME TO LIVE KING SIZE
B. ime to live king size
C. ppercase
D. ime To Live King Size
Answer» E.
5.

What will be the output of the following PHP code ?

A. ase 1 was executed
B. ase 2 was executed
C. efault was executed
D. ase 4 was executed
Answer» E.
6.

What will be the output of the following PHP code?

A. illa Warld
B. ello World
C. a
D. o
Answer» C. a
7.

What will be the output of the following PHP code ?

A. eturned value from the function : $return_value
B. rror
C. eturned value from the function : 30
D. eturned value from the function :
Answer» D. eturned value from the function :
8.

What will be the output of the following PHP code ?

A. his Works
B. his Too Seems To Work
C. his WorksThis Too Seems To Work
D. RROR
Answer» D. RROR
9.

What will be the output of the following PHP code ?

A. am here to spoil this code
B. rror
C. y favourite TV show is SherlockI am here ro spoil this code
D. one of the mentioned
Answer» D. one of the mentioned
10.

What will be the output of the following PHP code ?

A. am here to spoil this code
B. rror
C. y favourite TV show isI am here to spoil this code
D. one of the mentioned
Answer» C. y favourite TV show isI am here to spoil this code
11.

What will be the output of the following PHP code ?

A. am here to spoil this code
B. rror
C. y favourite TV show isI am here to spoil this code
D. one of the mentioned
Answer» B. rror
12.

What will be the output of the following PHP code ?

A. ello World
B. o Output
C. RROR
D. one of the mentioned
Answer» B. o Output
13.

What will be the output of the following PHP code ?

A. ello World
B. o Output
C. RROR
D. one of the mentioned
Answer» D. one of the mentioned
14.

What will be the output of the following PHP code ?

A. 00
B. rror
C. 5
D. 5
Answer» B. rror
15.

What will be the output of the following PHP code ?= 0)echo "Not True";}mine(0);?>

A. ess Than 0
B. ot True
C. o Output
D. one of the Mentioned
Answer» C. o Output
16.

What will be the output of the following PHP code ?

A. rror
B. 0
C. o Output
D. one of the Mentioned
Answer» D. one of the Mentioned
17.

What will be the output of the following PHP code ?

A. ontact
B. email protected]
C. examveda.com
D. xamveda.com
Answer» D. xamveda.com
18.

What will be the output of the following PHP code ?

A. ave a good day!
B. ave a good night!
C. RROR
D. one of the mentioned
Answer» C. RROR
19.

What will be the output of the following PHP code ?

A. elcome to Narnia
B. reeting
C. REETING
D. RROR
Answer» B. reeting
20.

What will be the output of the following PHP code ?

A. elcome to Narnia
B. reeting
C. REETING
D. RROR
Answer» E.
21.

What will be the output of the following PHP code ?

A. ime Pa55
B. owe Pa55
C. owe Pass
D. ime Pass
Answer» E.
22.

A function in PHP which starts with ______ (double underscore) is know as.

A. agic Function
B. nbuilt Function
C. efault Function
D. ser Defined Function
Answer» B. nbuilt Function
23.

What will be the output of the following PHP code?

A. ello World
B. elloWorld
C. ell 0 Wo rld
D. orld
Answer» C. ell 0 Wo rld
24.

What will be the output of the following PHP code?

A. elloblabla
B. rror
C. ello
D. elloblablablabla
Answer» D. elloblablablabla
25.

What will be the output of the following PHP code?

A. am b
B. am bI am a
C. rror
D. am a Error
Answer» D. am a Error
26.

What will be the output of the following PHP code?

A. am b
B. am bI am a
C. rror
D. am a Error
Answer» E.
27.

Which of the following PHP functions can be used for generating unique id’s?

A. niqueid()
B. d()
C. d5()
D. did()
Answer» B. d()
28.

What will be the output of the following PHP code?

A. ello you! How are you today?
B. REETING
C. REETING, Hello you! How are you today?
D. GREETING”,”Hello you! How are you today?”
Answer» B. REETING
29.

What will be the output of the following PHP code?

A. 0.11845976421345
B. 0.23568451142521
C. 0.46364760900081
Answer» D.
30.

What will be the output of the following PHP code?

A. 06
B. 03
C. 04
D. 09
Answer» D. 09
31.

What will be the output of the following PHP code?";}$function_holder = "sayHello";$function_holder();?>

A. o Output
B. rror
C. ayHello
D. elloWorld
Answer» E.
32.

What will be the output of the following PHP code?

A. eturned value from the function : $return_value
B. rror
C. eturned value from the function : 30
D. eturned value from the function :
Answer» D. eturned value from the function :
33.

What will be the output of the following PHP code?

A. is executedb is executedb is executed
B. is executeda is executed
C. is executed
D. is executeda is executedb is executed
Answer» E.
34.

What will be the output of the following PHP code?

A. rror
B. 9
C.
Answer» D.
35.

What will be the output of the following PHP code?

A. ’Malley Wins The Heavyweight Championship!
B. ’malley Wins The Heavyweight Championship!
C. ’Malley wins the heavyweight championship!
D. ’malley wins the heavyweight championship!
Answer» E.
36.

What will be the output of the following PHP code?(){define("const","I am awesome!");echo constant("const");}one();?>

A. am awesome!!
B. onst
C. onst, I am awesome!!
D. const”,”I am awesome!”
Answer» B. onst
37.

What will be the output of the following PHP code?span>function one(){echo " this works";function two(){echo "this too works";}}one();two();?>

A. rror
B. his works
C. his worksthis too works
D. his works this too works
Answer» D. his works this too works
38.

What will be the output of the following PHP code?

A. rray ( [0] => Hello [0] => world. [0] => It’s [0] => a [0] => beautiful [0] => day. )
B. rray ( [0] => Hello [1] => world. [2] => It’s [3] => a [4] => beautiful [5] => day. )
C. ello world. It’s a beautiful day
D. rray ( [1] => Hello [2] => world. [3] => It’s [4] => a [5] => beautiful [6] => day. )
Answer» C. ello world. It’s a beautiful day
39.

What will be the output of the following PHP code?

A. hat does /”yolo/” mean?
B. hat does ”yolo” mean?
C. hat does ”yolo” mean?
D. hat does ”yolo” mean?
Answer» D. hat does ”yolo” mean?
40.

What will be the output of the following PHP code?

A. ello World!
B. elcome to india
C. his is PHP!
D. CQ questons
Answer» B. elcome to india
41.

What will be the output of the following PHP code?

A. elcome to India
B. elcome to india
C. elcome to India
D. elcome to india
Answer» B. elcome to india
42.

What will be the output of the following PHP code?

A. love my country
B. love my Country
C. love my Country
D. Love My Country
Answer» E.
43.

Output will be:$array = array(0, 1, 2);$array = array_pad($array, -6, ‘NEW’);

A. rray ( [1] => NEW [2] => NEW [3] => NEW [4] => 0 [5] => 1 [6] => 2 )
B. rray ( [-1] => NEW [-2] => NEW [-3] => NEW [-4] => 0 [-5] => 1 [-6] => 2 )
C. rray ( [0] => NEW [-1] => NEW [-2] => NEW [-3] => 0 [-4] => 1 [-5] => 2 )
D. rray ( [0] => NEW [1] => NEW [2] => NEW [3] => 0 [4] => 1 [5] => 2 )
Answer» E.
44.

. . . . . converts the keys of an array into values and the values into keys.

A. rray_flips()
B. rray_transpose()
C. rray_trans()
D. rray_flip()
Answer» E.
45.

What will be the output of the following PHP code ?

A. world!
B. ello world!
C. 11
D. o Output
Answer» B. ello world!
46.

The arguments in a function are evaluated from .....

A. eft to right
B. ight to left
C. ometimes left to right and sometimes right to left
D. lways right to left
Answer» B. ight to left
47.

Returning values from functions may include .....

A. rrays
B. bjects
C. oth A & B
D. one of above
Answer» D. one of above
48.

The below statement will return.$Var = substr("abcdef", -4, 1);

A. eturns "f"
B. eturns "d"
C. eturns "c"
D. eturns "cd"
Answer» D. eturns "cd"
49.

It is always necessary to use parentheses with the print function.

A. rue
B. alse
Answer» C.
50.

. . . . returns a new DateTime object.

A. etdate()
B. ate_create()
C. ate_sunrise()
D. ate()
Answer» C. ate_sunrise()