0% found this document useful (0 votes)
6 views

PHP_Assignment-3

The document is an assignment for a PHP and MySQL course at Ganpat University, containing multiple-choice questions (MCQs) and long-answer questions related to PHP programming concepts. It covers topics such as arrays, functions, and built-in functions in PHP, along with practical coding examples. Additionally, it includes questions on user-defined functions, string functions, and variable types.

Uploaded by

jayeshpatel8144
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views

PHP_Assignment-3

The document is an assignment for a PHP and MySQL course at Ganpat University, containing multiple-choice questions (MCQs) and long-answer questions related to PHP programming concepts. It covers topics such as arrays, functions, and built-in functions in PHP, along with practical coding examples. Additionally, it includes questions on user-defined functions, string functions, and variable types.

Uploaded by

jayeshpatel8144
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

GANPAT UNIVERSITY, KHERVA

BSPP/IOT, COMPUTER ENGINEERING DEPARTMENT


ASSIGNMENT-3
PHP & MySQL (1IT2402)
MCQ
1. How many types of array are available in php?
A) 1 B) 2 C) 3 D) 4
2. By default, the index of array in php starts from ______?
A) 0 B)1 C) -1 D) 2
3. A ________ is an array with more than two dimensions.
A) single dimensional array B) multi dimensional array C) Both A and B D) None of the
above
4. Which of the following are correct ways of creating an array?
i) arr[0] = "letsfindcourse";
ii) $arr[] = array("letsfindcourse");
iii) $arr[0] = "letsfindcourse";
iv) $arr = array("letsfindcourse");

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

1. Define Array. Explain different types of Array with suitable example. OR


Explain Associative array with suitable example. OR Explain multidimensional
array.
2. What is User Defined function? Explain UDF with return value. OR Explain
function with default value with suitable example.
3. Write a PHP script to demonstrate call by reference or call by reference.
4. Explain string function with example. (chr(),strcmp(),strlen(),strtoupper(),trim()).
5. Explain math function with example. (ceil(),fmod(),is_finite(),max(),rand(),is_nan()).
6. Explain array function with example.
(array(),array_chunk(),array_key_exists(),count(),asort(),list()).
7. Explain global, static and constant variable.

You might also like