#### PHP Function and Array Publishing Model Question Paper 1

12th Standard

Reg.No. :
•
•
•
•
•
•

Computer Applications

Time : 01:00:00 Hrs
Total Marks : 50
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. 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

3. A Function is a type of___________.

(a)

sub routine

(b)

procedure

(c)

Either a or b

(d)

None of these

4. __________ arrays are a key-value pair data structure.

(a)

Associative

(b)

Indexed

(c)

Multi-dimensional

(d)

All of these

5. A _________ array is an array containing one or more arrays.

(a)

Associative

(b)

Indexed

(c)

Multi-dimensional

(d)

All of these

6. 5 x 2 = 10
7. Define User defined Function.

8. Usage of Array in PHP.

9. Write array Syntax in PHP

10. How index will be assigned in indexed array?

11. Define function calling?

12. 5 x 3 = 15
13. Write the features of built-in Functions.

14. Differentiate user defined and system defined Functions.

15. Differentiate Associate array and Multidimensional array.

16. Write the rules for parameters.

17. Write the advantages of functions.

18. 4 x 5 = 20
19. Explain Function concepts in PHP.

20. Discuss in detail about User define Functions with a suitable example.

21. Explain the Multidimensional Array.

22. Explain Indexed array and Associate array in PHP.