Вы находитесь на странице: 1из 5

Score Score

Name (last name first): __________________________________________________ _________________ Student No.: ______________________ __________________________ Section: ___________ Professor:

ITWA133/ITWP103 FIRST LONGEXAMINATION 3rd TERM, SY2012-2013

Date:

General Instruction: Follow all instructions carefully. Failure to do so will warrant a substantial deduction from your final score. Write everything in non-red ink. No borrowing of pens, calculators, etc. Talking to or looking at your seatmate (and his/her paper) is automatically considered as cheating which is subject to very serious sanctions as stipulated in the student handbook. Erasures are not allowed. Any form of erasure will be considered wrong. I. MODIFIED TRUE OR FALSE: Write T on the first line before each number if the statement is correct. Write F if not, and replace the underlined word or phrase on the second line to make the statement correct. (30pt) 1. PHP scripting language usually called PHP:

Hyperpage Preprocessor.
2. PHP is among the most stable and efficient tools

available for creating dynamic, interactive Web page.


3. A website is a collection of web pages, typically

common to a particular domain name or subdomain on the World Wide Web on the Internet.
4. A static website is one that has content that is

expected to change frequently and is manually maintained by some person or persons using some type of editor software.
5. A dynamic website is one that has frequently

changing information or interacts with the user driven by such cookies and database.
6. PHP was created by Rasmus Leeford as a simple

macro language for building small, personal home pages.


7. PHP, like Linux and MySQL, is known as a free-

source product.
8. Some of the PHPs disadvantages are its speed,

ease of use, versatility, security and customizability.


9. F.O.S.S. means Freedom On System Services 10. 11. 12.

Dollar character is used to initiate variable. IF statement returns true value of the condition.

WHILE allows one execution prior to validation of condition.

13. 14. 15. 16. 17.

ECHO is a keyword to display text in PHP and not PRINT. Array is special variable that can handle more than one value. Parameters are values or variable inside Functions parenthesis. enter() is one example of built-in functions. Date() is a function that can also access time.

18.

Some of the PHPs features are that it can interact with HTML forms, communicate with database and generate secure web pages. The access to a PHP file that is being served from your local machine, always precede with http://xampp/htdocs/ PHP runs through the utility of Apache in webbased applications.

19.

20.

II. MULTIPLE CHOICE: Write capital letter before each number. Write E if there is no possible answer. (15pt) 1. What does PHP stands for? A. PHP : Hypertext Preprocessor B. Personal Hypertext Page 2. When was PHP developed? A. 1994 B. 1995 C. Private Home Page D. Private Hypertext Page C. 1996 D. 1997

3. Which is valid PHP server scripts delimiter? A. <?PHP ... ?> C. <SCRIPT> ... </SCRIPT> B. <?PHP> ... </PHP> D. <&> ... </&> 4. How do you display HELLO QUIZ in PHP? A. echo HELLO QUIZ; C. echo HELLO QUIZ; B. document.write(HELLO QUIZ); D. response.write(HELLO QUIZ); 5. What symbol does variables in PHP starts with? A. Semi-Colon C. Ampersand B. Exclamation D. Number Sign 6. Which one of these variables has an accepted or allowed name? A. $myVar C. &1029 B. $1029 D. &myVar 7. Are PHP variables able to have different data type at different times? A. all the time C. maybe B. not at any time D. none of these 8. Which one of these statements is an invalid PHP comment? A. /-- Comment line here --/ C. // This is comment line 1 B. /* Comment line here */ D. # This is comment line 2 9. Which one of these statements result valid display? A. print TRY THIS ONE; C. $_echo(TRY THIS); B. print(TRY THIS ONE); D. $_echo : TRY THIS; 10. How to print double quote in PHP? A. \ C. \\ B. $quote; D. $dqt;

11.

Which one of these statements compares two variables? A. $var1 => $var2 C. $var1 += $var2 B. $var1 == $var2 D. $var1 && $var2 Which one of these statements compares two variables? A. $var1 => $var2 C. $var1 += $var2 B. $var1 == $var2 D. $var1 && $var2 Which one of these statements is invalid? A. echo $_POST[fieldname]; C. echo $myVariable; B. echo &_POST[fieldname]; D. echo HELLO QUIZ; Which one of these statements is invalid? A. print(Date(M)); C. print(Date(D)); B. print(Date(Dt)); D. print(Date(m));

12.

13.

14.

15.

Which one of these statements is valid? A. $user = $_POST(username); C. $user = $_POST(user); B. $user = $_POST[username]; D. $username = $_POST(username);

III. CODE EVALUATION: Write the complete answer before each number. (20pt)
1 2 3 4 5

<? $x=0; $answer = The. $subject. is. $how. easy.; $question = What do you think about our .$test.?; $test = exam; $subject = $test; $x=1; 6 if($x=0){ 7 $how = not; 8 } else { 9 $how = very; 10 } 11 echo $question; echo $answer; 12 ?>
1. What is the value of question variable? 2. What is the value of answer variable? 3. What is the value of subject variable? 4. What is the value of test variable? 5. What is the output to [ echo $how. .$text ]? 6. What is the output to [ echo $test. .$x ]? 7. What is the value of question if subject is PHP? 8. What is the value of answer if subject is game? 9. What is the value of how variable if x in line 2 is multiplied to 0? 10. What is the value of how variable if x in line 2 is increased by 1?

<html><head><title>Background Colors</title></head> <? $today = date("w"); $bgcolor = Array("#FEF0C5", "#FFFFFF", "#FBFFC4", #FFE0DD, "#E6EDFF", "#E9FFE6", "#F0F4F1"); ?> <body bgcolor="<?print("$bgcolor[$today]");?>">

</body> </html>

11. What is the variable name for the instance of date? 12. What is the variable name for the array? 13. What does small letter w returns? 14. What will be the color if today is Monday? 15. What will be the color if today is Saturday? 16. What is the value of $today if today is Tuesday? 17. What is the value of $today if today is Friday? 18. What attribute of the BODY is set to be change? 19. What is the fourth array value? 20. What is invalid among the array value?

IV. OUTPUT TRACING: Determine the exact output of the code. (5pts each) # 1 $num = 7; $word = Array(three, 5, $num, four); echo echo echo echo echo # 2 $word $word $word $word $word [3].<br/>; [2].<br/>; [4].<br/>; [1].<br/>; [0].<br/>;

$x = date("w"); $days = Array("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"); $x = "Wednesday"; for($i=0; $i<=$x; $i++) { echo "Day $i : $days[$i] <br/>"; } $d=30; echo date("Y/m/$d") . "<br />"; echo number_format(($d/4),2) . "<br />"; echo number_format((date("Y")/4),3) . "<br />"; FILE NAME : name.php session_start(); $_SESSION["user"] = "San Andres Bukid"; $name1 = "Juan Dela Cruz"; $name2 = "Maria Clara Cruz"; $name3 = "Dela"; echo strstr($name1, $name3); echo ", "; $y = strlen($name3); for($x=0;$x<$y;$x++){ echo strpos($name2, "a"); } echo "<br/>";

# 3

# 4

# 5

include("name.php"); for($x=1;$x<$y;$x++){ echo $name3."<br/>"; }

# 6

include("name.php"); $name4 = ucwords($name1); $z = strlen($name3); for($x=0;$x<$z;$x++){ echo $name4."<br/>"; }

# 7

include("name.php"); if(isset($_SESSION["user"])){ echo strrev($_SESSION["user"]); session_destroy(); } else { echo $_SESSION["user"]; }

Вам также может понравиться