Explore topic-wise MCQs in Php.

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

1.

All these pow ( ), exp ( ), log ( ), log10 ( ) functions are example of

A. Trigonometry function
B. Exponential function
C. Base conversion function
D. None of them
Answer» C. Base conversion function
2.

Side effect of array_pop ( ) function is

A. It removes the first element of an array
B. It removes last element of an array
C. It modifies an array from middle
D. All of them
Answer» C. It modifies an array from middle
3.

Array_values ( ) function returns an array containing

A. New values of array
B. All the values of array
C. 0 and 1 values of array
D. None of them
Answer» C. 0 and 1 values of array
4.

Arsort ( ) function same as asort ( ) but

A. It sorts values in descending order
B. It sorts values in ascending order
C. It start sorting values from middle
D. None of them
Answer» B. It sorts values in ascending order
5.

Which mathematical constant notation is used for square root?

A. sqr ( )
B. sqrt (2)
C. 1/sqrt ( )
D. None of them
Answer» C. 1/sqrt ( )
6.

Popping is an act of

A. Adding values
B. Taking off values from stack
C. Transferring values from stack
D. None of them
Answer» C. Transferring values from stack
7.

Foreach ( ), current ( ), next ( ), reset ( ), each ( ) and array_walk ( ) all these functions are example of

A. Searching arrays
B. Creating arrays
C. Iteration of arrays
D. Deleting of arrays
Answer» D. Deleting of arrays
8.

Default numbering for an array indices starts from

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

Unlike vector arrays of C and C++ PHP arrays can store

A. Same type of data
B. Varied types of data
C. Small amount of data
D. All of them
Answer» C. Small amount of data
10.

For getting rid of an assigned variable in an array which function is used?

A. delete_array ( )
B. reset_array
C. reset ( )
D. unset ( )
Answer» E.
11.

Internal linked keys in an array can be retrievable by

A. pointer ( ) function
B. each ( ) function
C. key ( ) function
D. None of them
Answer» D. None of them
12.

In vector arrays, the elements must have

A. Same size
B. Same type
C. Different size
D. Different type
Answer» C. Different size
13.

Is_array ( ) function that takes a single argument of any type and returns a true value if

A. Argument is character type
B. Argument is number type
C. Argument is an array
D. none of them
Answer» D. none of them
14.

When we simply want iteration through looping an array values we can use

A. current ( )
B. foreach ( )
C. next ( )
D. None of them
Answer» C. next ( )
15.

Current ( ) function is a

A. 2 array argument
B. 3 array argument
C. 1 array argument
D. None of them
Answer» D. None of them
16.

Which of the following are valid function names?i) function()ii) €()iii) .function()iv) $function()

A. Only ii)
B. None of the mentioned.
C. All of the mentioned.
D. iii) and iv)
Answer» B. None of the mentioned.
17.

What will happen in this function call?

A. Call By Value
B. Call By Reference
C. Default Argument Value
D. Type Hinting
Answer» B. Call By Reference
18.

Count ( ) function is identical to

A. is_array ( ) function
B. in_array ( ) function
C. sizeof ( )
D. isset ( ) function
Answer» D. isset ( ) function
19.

Indices of arrays can be either strings or numbers and they are denoted as

A. $my_array {4}
B. $my_array [4]
C. $my_array| 4 |
D. None of them
Answer» C. $my_array| 4 |
20.

Other than index values an array can be retrieved by a function that is called as

A. Retrieve ( ) function
B. Array_retrive ( ) function
C. list ( ) function
D. Array_call ( ) function
Answer» D. Array_call ( ) function
21.

Which of the following are correct ways of creating an array?i) state[0] = “karnataka”;ii) $state[] = array(“karnataka”);iii) $state[0] = “karnataka”;iv) $state = array(“karnataka”);

A. iii) and iv)
B. ii) and iii)
C. Only i)
D. ii), iii) and iv)
Answer» B. ii) and iii)
22.

A function that returns keys of its input array in form of new array where keys are stored as values, is a

A. return_function ( )
B. keys ( ) function
C. implode ( ) function
D. array_keys ( ) function
Answer» E.
23.

As compared to associative arrays vector arrays are much

A. Faster
B. Slower
C. Stable
D. None of them
Answer» B. Slower
24.

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

A. Magic Function
B. Inbuilt Function
C. Default Function
D. User Defined Function
Answer» B. Inbuilt Function
25.

There are how many ways to create an array in PHP script

A. 1
B. 2
C. 3
D. 4
Answer» D. 4
26.

Array_slice ( ) function starts accepting arguments from

A. First argument
B. Second argument
C. Third argument
D. Both b and c
Answer» E.
27.

Arrays that can store their values in association with unique keys or indices are called

A. Associative arrays
B. Key based arrays
C. indices based arrays
D. All of them
Answer» B. Key based arrays
28.

Another name for arbitrary-precision arithmetic numbers are

A. Bignum arithmetic
B. Multiple precision arithmetic
C. Infinite-precision arithmetic
D. All of them
Answer» E.
29.

Next ( ) function returns value after the

A. pointer is moved
B. pointer is reversed
C. array is empty
D. None of them
Answer» B. pointer is reversed
30.

Pi is a\an

A. Trigonometry function
B. Exponential function
C. Base conversion function
D. None of them
Answer» B. Exponential function
31.

Base conversion functions takes

A. 1 argument
B. 2 arguments
C. 3 arguments
D. None of them
Answer» B. 2 arguments
32.

Pos ( ) function is an alias for

A. array_walk ( ) function
B. each ( ) function
C. next ( ) function
D. current ( ) function
Answer» E.
33.

PHP arrays are also called as

A. Vector arrays
B. Perl arrays
C. Hashes
D. All of them
Answer» D. All of them
34.

An array is a collection of

A. Strings
B. Characters
C. Indexed variables
D. Functions
Answer» D. Functions
35.

Which function take two arguments and returns true if element contained as a value of an array?

A. is_array ( ) function
B. in_array ( ) function
C. count ( ) function
D. isset ( ) function
Answer» C. count ( ) function
36.

Stacks work on principle of

A. LIFO
B. FIFO
C. FILO
D. None of them
Answer» B. FIFO
37.

For purpose of iteration Foreach is a

A. Function
B. language construct
C. loop
D. Both a and b
Answer» C. loop
38.

Which function takes two arguments, an array to be traversed and name of a function to apply to each key/value pair?

A. array_walk ( ) function
B. each ( ) function
C. next ( ) function
D. end ( ) function
Answer» B. each ( ) function
39.

Base conversion function DecHex ( ) coverts from

A. Base 10 to base 8
B. Base 10 to base 16
C. Base 16 to base 10
D. Base 8 to base 10
Answer» C. Base 16 to base 10
40.

Which one from following is an example of arbitrary precision function

A. bcadd ( )
B. atan ( )
C. Tan ( )
D. decoct ( )
Answer» B. atan ( )
41.

PHP function calls are

A. call-by-value
B. call-by-location
C. call-by-reference
D. All of them
Answer» B. call-by-location
42.

For converting base 8 to base 10, which function is used

A. DecOct ( )
B. OctBin ( )
C. OctDec ( )
D. HexOct ( )
Answer» D. HexOct ( )
43.

To retrieve a value from an array we can use its

A. Name
B. Location
C. Index
D. None of them
Answer» D. None of them
44.

Pointing before moving current pointer ahead is a behavior of

A. next ( ) function
B. prev ( ) function
C. end ( ) function
D. each ( ) function
Answer» E.
45.

In multidimensional arrays rather than a single key they values are stored in

A. Sequence of key values
B. 2 keys
C. linear style
D. None of them
Answer» B. 2 keys
46.

Three ways to create an array is Direct assignment, array ( ) construct and

A. Functions returning arrays
B. Functions creating arrays
C. Keys creating arrays
D. None of them
Answer» B. Functions creating arrays
47.

Act of adding values into a stack is called

A. Popping
B. Polling
C. Pushing
D. None
Answer» D. None
48.

Mathematical constant M_PI defines a

A. Pi
B. log
C. 1/pi
D. sqrt
Answer» B. log
49.

For reversing an array which function is used?

A. reverse ( ) function
B. array_rev ( ) function
C. array_reverse ( )
D. change_array_order ( )
Answer» D. change_array_order ( )
50.

Which function displays structured information about variables including its type and value?

A. asort ( )
B. ksort ( )
C. sort ( )
D. var_dump ( )
Answer» E.