Explore topic-wise MCQs in Php.

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

51.

The result of both the below expressions in PHP will be same:1) 3+4*22) (3+4)*2

A. RUE
B. ALSE
Answer» C.
52.

In order to find if a variable holds an actual number or a string containing characters that can be translated into a number you can use:

A. s_num()
B. s_number()
C. f_numeric
D. s_numeric()
Answer» E.
53.

What will be the output of the following PHP code ?

A. o output
B. rue 23
C. rue 22
D. rue 33
Answer» C. rue 22
54.

What will be the output of the following PHP code ?

A. estthisthisalso
B. estthis
C. estthisalsothisalso
D. rror at line 4
Answer» D. rror at line 4
55.

What will be the output of the following PHP code ?

A. 1
B. 2
C. 0
D. rror
Answer» B. 2
56.

What will be the output of the following PHP code ?

A. 00
B. 12
C. othing
D. rror
Answer» B. 12
57.

What will be the output of the following PHP code ?

A. 00
B. 12
C. 23
D. rror
Answer» C. 23
58.

What will be the output of the following PHP code ?

A. 12
B. 23
C. othing
D. rror
Answer» D. rror
59.

What will be the output of the following PHP code ?

A. 12
B. 23
C. 11
D. rror
Answer» B. 23
60.

What will be the output of the following PHP code ?

A. 12
B. 23
C. 00
D. 11
Answer» D. 11
61.

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

A. 0000000000000000000….infinitely
B. 1-1-1-1-1-1-1-1-1-1…infinitely
C. o output
D. rror
Answer» B. 1-1-1-1-1-1-1-1-1-1…infinitely
62.

What will be the output of the following PHP code ?

A. 234567891011121314….infinitely
B. 1234567891011121314…infinitely
C. o output
D. rror
Answer» D. rror
63.

What will be the output of the following PHP code ?

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

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

A. 4321111111….infinitely
B. 55555555…infinitely
C. 4321
Answer» B. 55555555…infinitely
65.

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

What will be the output of the following PHP code ?

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

What will be the output of the following PHP code ?

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

What will be the output of the following PHP code ?

A. esult is true
B. esult is 1
C. rror
D. o output
Answer» C. rror
69.

What will be the output of the following PHP code ?

A. 0
B. rue0
C.
Answer» C.
70.

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

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

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

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

What will be the output of the following PHP code ?

A. 2
B. 2
C. 1
D. 1
Answer» B. 2
73.

What will be the output of the following PHP code ?

A. 8
B. 9
C. 09
D. 08
Answer» C. 09
74.

What will be the output of the following PHP code ?

A. 69
B. 42
C. 68
D. rror
Answer» B. 42
75.

What will be the output of the following PHP code ?

A. o 2
B. es 1
C. es 2
D. o 1
Answer» B. es 1
76.

What will be the output of the following PHP code ?

A. o output
B. rror
Answer» C.
77.

What will be the output of the following PHP code ?

A. 4
B. 0.7
C. 0.85
Answer» B. 0.7
78.

What will be the output of the following PHP code ?

A. 6
B. 6
C. 5
D. 5
Answer» B. 6
79.

PHP will automatically convert strings to numbers when it needs to.

A. RUE
B. ALSE
Answer» B. ALSE
80.

The result of below two statements will be:Round(2.5)Round(-2.5)

A. .5, -2
B. , -2
C. , -3
D. .5, -3.5
Answer» D. .5, -3.5
81.

If you do something to an integer that makes it larger than the maximum allowable integer or smaller than the minimum possible integer, the PHP interpreter converts the result into a . . . . .

A. tring
B. loating point number
C. ntegers
D. one of above
Answer» C. ntegers
82.

Module operator % in PHP only accepts

A. Doubles
B. Integers arguments
C. Floating arguments
D. None of them
Answer» C. Floating arguments
83.

What will be the output of the following PHP code ?

A. 24
B. 3.7
C. 3.85
D. 0
Answer» B. 3.7
84.

Which function is used for converting arguments to doubles?

A. double ( )
B. doubleleval ( )
C. leval ( )
D. covt_double ( )
Answer» C. leval ( )
85.

Operator that takes simple values as arguments and evaluate it either TRUE or FALSE

A. Comparison operator
B. Assignment operator
C. Increment operator
D. Decrement operator
Answer» B. Assignment operator
86.

Increment operator is denoted by

A. ++
B. −−
C. %%
D. ⁄⁄
Answer» B. −−
87.

+=, −=, *=, /=, %= all are example of

A. Comparison operator
B. Assignment operator
C. Increment operator
D. Decrement operator
Answer» C. Increment operator
88.

Abs ( ) stands for

A. Arithmetic Values
B. Absolute Values
C. Assignment Values
D. None of them
Answer» C. Assignment Values
89.

Floor ( ), ceil ( ), round ( ), abs ( ), min ( ), max ( ) all functions are example of

A. Basic math functions
B. Randomness functions
C. Seeding and generating functions
D. None of them
Answer» B. Randomness functions
90.

Integer remainder from division of left hand argument by absolute value of right hand argument, is behavior of which arithmetic operator

A. +
B.
C. *
D.
Answer» D. ⁄
91.

Intval ( ) function is used for

A. Converting argument to integers
B. Converting arguments to characters
C. Converting arguments to strings
D. None of them
Answer» B. Converting arguments to characters
92.

Comparison operators have higher precedence than

A. Arithmetic operators
B. Assignment operators
C. Boolean operators
D. All of them
Answer» C. Boolean operators
93.

Increment operator have two flavors one is postincrement and

A. preincrement
B. postdecrement
C. lastincrement
D. None of them
Answer» B. postdecrement
94.

Rand ( ) and mt_ rand ( ) functions are examples of

A. Arithmetic functions
B. Boolean functions
C. Comparison functions
D. Randomness functions
Answer» E.
95.

*, /, % operators have higher precedence than

A. Comparison operators
B. Boolean operators
C. +−
D. None of them
Answer» D. None of them
96.

Ceiling function is denoted by

A. cel ( )
B. ceiling ( )
C. ceil ( )
D. cell ( )
Answer» D. cell ( )
97.

Random number functions offered by PHP is implemented by

A. Strings
B. Doubles
C. Floats
D. Pseudo random numbers
Answer» E.
98.

For constructing a random string of letters which function is used

A. random_char
B. mt_rand
C. random_string
D. Both a and c
Answer» E.
99.

If rand ( ) function is called by no argument it returns a number between 0 and

A. RAND_MIN
B. RAND_MAX
C. STRAND_MAX
D. None of them
Answer» C. STRAND_MAX
100.

By truncation module operator % in PHP changes double in

A. Strings
B. Characters
C. Integers
D. None of them
Answer» D. None of them