PHP_Assignment-3
PHP_Assignment-3
A) ii), iii) and iv) B) ii) and iii) C) Only i) D) iii) and iv)
5. Which in-built function will add a value to the end of an array?
A) array_unshift() B) into_array() C) inend_array() D) array_push()
6. Which function returns an array consisting of associative key/value pairs?
A) count() B) array_count() C) array_count_values() D) count_values()
7. What is the output of the following php code?
<?php
$alphabet = array ("A", "B", "C");
echo (next($alphabet));
?>
A) A B) B C) C D) Error
8. Keys in array can be non-sequential.
A) True
B) False
C) Depend on program
D) Keys does not exist in array
9. Key/value pair can be initialized using = operator?
A) True
B) False
C) Depend on program
D) Keys does not exist in array
10. What is the use of is_array() function?
A) Function is used to print the array in readable format.
B) Adds elements to the beginning of the array and returns the size of array.
C) Function can be used to verify if a variable is an array. Returns TRUE or FALSE
D) Adds elements to the end of the array and returns the size of array.
11. How many types of functions are available in php?
A) 5
B) 4
C) 3
D) 2
12. Which of the following is not a built-in function in php ?
A) print_r()
B) fopen()
C) fclosed()
D) gettype()
13. Why should we use functions?
A) Reusability
B) Easier error detection
C) Easily maintained
D) All of the above
14. A function name always begins with the keyword _________.
A) Fun
B) Def
C) Function
D) None of the above
15. A function name cannot start with a ____
A) Alphabet
B) Underscore
C) Number
D) Both C and B
16. A function in PHP which starts with double underscore is known as __________.
A) Magic Function
B) Inbuilt Function
C) Default Function
D) User Defined Function
17. What will be the output of the following code?
<?php
function WRITEMSG() {
echo "Hello world!";
}
writemsg();
?>
A) Hello world!
B) Null
C) No Output
D) None of the above
18. Function names are case-sensitive.
A) True
B) False
C) Only Built-In function
D) Only User-defined function
19. PHP has over ____________ built-in functions that can be called directly.
A) 10
B) 100
C) 1000
D) 10000
20. Type Hinting was introduced in which version of PHP?
A) PHP 5.1
B) PHP 5
C) PHP 5.3
D) PHP 5.4
Long Questions