Tribhuwan University

Institute of Science and Technology

2079

Bachelor Level / Third Year / Fifth Semester / Science

Bachelors in Information Technology (BIT301)

(Web Technology II)

Full Marks: 60

Pass Marks: 24

Time: 3 Hours

Candidates are required to give their answers in their own words as for as practicable.

The figures in the margin indicate full marks.

Section A

Long Answers Questions

Attempt any TWO questions.
[2*10=20]
1.
What are variables? How can you define static variables? Write a PHP program to illustrate the use of Switch statement.[10]
2.
How can you store string type data in an array? Write a PHP program to illustrate use of extract and compact functions for conversion between arrays and variables.[10]
3.
Consider you have a login form having username, password fields, login and cancel buttons. Now, write a PHP program for implementing login event. The login should be redirected to home.php upon successful login button event. The cancel button should clear the form field values upon its submission.[10]
Section B

Short Answers Questions

Attempt any Eight questions.
[8*5=40]
4.
How are comments written in PHP? Write a PHP program that will read your name and roll number and print the values. Label your program with appropriate comments. [5]
5.
Write a PHP program that will contain a concat string function. The function should have two arguments st1 and st2 of type string and should return st3 which is concatenation of st1 and st2. [5]
6.
Write a PHP program to extract subset of a string array using array_slice() function. [5]
7.
Describe an anonymous class using suitable example. [5]
8.
Write a PHP program for illustrating the starting and ending of session. [5]
9.
How can you query a database in PHP? [5]
10.
How can you retrieve the form data? Illustrate with example. [5]
11.
What is error handler? Write a PHP program to show use of error handler to format and print errors. [5]
12.
For the following JSON file named BIT.JSON, write a PHP program to read information from this JSON file: {Name: "Gunadi", Email: "Gunadi@gmail.com", Dob: "January 1", Age: 30} [5]