Brief Answer Questions:
[10 × 1 = 10]What is difference between cookie and session?
How can we place a double quote character in a double-quoted string?
How does file opening mode "w" differ with "w+"?
Write a syntax to declare a function.
How do we find the length of an array?
How do you set default values for function parameter?
What is the task of gettimeofday() function?
What is SQL injection attack?
Why do we need default values feature in a form?
How do you declare multi dimensional array?
Exercise Problems (Any Five):
[5 × 4 = 20]How do you define the scope of variable? Justify with an example.
How do you create, store and retrieve session? Explain.
Explain about different parameters passed to the setcookie() function.
The keys of an associative array contains the names of the books where as the value contains the name of author. Write a PHP program to display a table with two columns where the first column contains the name of the book and the second column contains the names of corresponding author.
Write a program to get Id, Name and address from a database of the employees of Tribhuvan University and store those information in a CSV file. Assumptions to be made for the database are : database name is "TU", table name is "employees", database username is "Tribhuvan" and password is "BIM76" and the database server URL is "fomeed.edu.np".
Write a PHP program to find the difference between any two dates.
Comprehensive Answer Questions (Any Two):
[2 × 5 = 10]Assume a file name "sport.txt" containing the news about cricket. Print the portion of file between the first two consecutive words "cricket".
Validate a form having the following fields and validation conditions :
Age – Text field (integer with range 1-100)
Gender – Radio Button (Value : Either Male, Female or Other)
Hobbies – Check boxes (Values : swimming, dancing and singing)
The form must be submitted and validated on the same page where the form exists and the validation error messages are to be shown in an unordered list.
Write short notes on :
a. Here document.
b. Inspecting file permission.


