#### 12th Standard Computer Applications PHP Function and Array English Medium Free Online Test One Mark Questions with Answer Key 2020 - 2021

12th Standard

Reg.No. :
•
•
•
•
•
•

Computer Applications

Time : 00:10:00 Hrs
Total Marks : 10

Answer all the questions

10 x 1 = 10
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. PHP’s indexed array begin with position ___________________.

(a)

1

(b)

2

(c)

0

(d)

-1

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. PHP arrays are also called as

(a)

Vector arrays

(b)

Perl arrays

(c)

Hashes

(d)

All of them

6. What functions count elements in an array?

(a)

count

(b)

Sizeof

(c)

Array_Coun

(d)

Count_array

7. A Function is a type of___________.

(a)

sub routine

(b)

procedure

(c)

Either a or b

(d)

None of these

8. __________________ stores more than one value of same data type in single array variable.

(a)

Arrays

(b)

Function

(c)

Indexed array

(d)

Multidimensional array

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

(a)

Associative

(b)

Indexed

(c)

Multi-dimensional

(d)

All of these

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

(a)

Associative

(b)

Indexed

(c)

Multi-dimensional

(d)

All of these