#### PHP Function and Array Book Back Questions

12th Standard EM

Reg.No. :
•
•
•
•
•
•

Computer Applications

Time : 00:45:00 Hrs
Total Marks : 30
5 x 1 = 5
1. Which one of the following is the right way of defining a function in PHP?

(a)

function { function body }

(b)

data type functionName(parameters) { function body }

(c)

functionName(parameters) { function body }

(d)

function fumctionName(parameters) { function body }

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

3. What will be the output of the following PHP code?
< ?php
a=array(“A”,”Cat”,”Dog”,”A”,”Dog”);
b=array(“A”,”A”,”Cat”,”A”,”Tiger”);
c=array_combine(a,b);
print_r(array_count_values(c));
? >

(a)

Array ( [A] = > 5 [Cat] = > 2 [Dog] = > 2 [Tiger] = > 1 )

(b)

Array ( [A] = > 2 [Cat] = > 2 [Dog] = > 1 [Tiger] = > 1 )

(c)

Array ( [A] = > 6 [Cat] = > 1 [Dog] = > 2 [Tiger] = > 1 )

(d)

None of these

4. For finding nonempty elements in array we use

(a)

is_array ( ) function

(b)

sizeof ( ) function

(c)

array_count ( ) function

(d)

array_count ( ) function

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

6. 3 x 2 = 6
7. Define Function in PHP.

8. Write Syntax of the Function in PHP.

9. Write array Syntax in PHP

10. 3 x 3 = 9
11. Write the features System define Functions.

12. Differentiate user define and system define Functions.

13. Differentiate Associate array and Multidimensional array.

14. 2 x 5 = 10
15. Explain Function concepts in PHP.

16. Explain Array concepts and their types.