Professional Documents
Culture Documents
I.
M . I.
CS
L as t Na m e
IT
IS
S ec ti o n
D. <&> </&>
B. <script> </script>
C. <?php> </?>
3. How do you write Hello World in PHP?
A. echo Hello World
D. A & C
B. print(Hello World)
B. @
C. #
5. How to show errors in PERL
A. use warnings;
D. import warnings;
B. import errors
C. error_reporting(1);
150
R e m ark s
6. True if x is not equal to y, or they are not of the same type. What operator is this?
A. ===
D. ==
B. !=
E. !!
C. !==
7. It is a string of characters (letters, numbers, etc.) with a length up to some limit?
A. string
B. characters
C. varchar
8. It is field that uniquely identifies each record?
A. Key
D. Null
B. Primary Key
C. Unique
9. It is a database that has a collection of tables of data items, all of which is formally described and organized
according to the relational model?
A. Relational Database
D. A & B
B. Rational Database
C. Null Database
10. It a group of scalar values representing a single instance of an object or event?
A. Row
D. Table
B. Cell
C. Column
II. Modified True or False :: Answer OPEN if the statement is true and encircle the word/words to that makes
statement false and replace them with the correct answer. Not following instructions will automatically be 0. (20
pts two points each)
1.
2.
3.
2
4.
5.
6.
7.
8.
9.
10.
III. Fill in the blanks :: Complete the codes to display a valid PHP and MySQL code. (10 pts)
<?php
$con=______________(localhost","peter","abc123","my_db");
// Check connection
if (________________())
{
echo "Failed to connect to MySQL: " . ___________________();
}
___________($con,"_____________ Persons (FirstName, LastName, Age)
VALUES ('Peter', 'Griffin',35)");
___________($con,"_____________ Persons (FirstName, LastName, Age)
VALUES ('Glenn', 'Quagmire',33)");
$result = _____________($con,"SELECT * FROM Persons");
while($row = ___________________($result))
{
echo $row['FirstName'] . " " . $row['LastName'];
echo "<br />";
}
_____________($con);
?>
IV. Coding: Upload your PERL Script on the CMS. (75 pts)
1. Write a PERL script that lets you add, minus, multiply, and divide. (25 pts)
Sample Run:
Enter the first number: 2
Enter the second number: 5
Operator: +
Answer: 7
3
2. Construct a PERL script that prints out the multiplication table.(25 pts)
Sample Run:
1 2 3 4 5 6 7 8 9 10
2 4 6 8 10 12 14 16 18 20
... so on and so forth
3. Make a PERL script that shuffles the contents in the array. (25 pts)
Sample Run:
My Cards: 1S, 2S, 3S, 4S, 5S, 6S, 7S, 8S, 9S, 10S, JS, QS, KS, AS
Shuffled Cards: 3S, 4S, 5S, KS, 7S, 6S, AS, 2S, QS, 10S, JS, 1S, 8S, 9S
Rubrics:
Program Construction: 10pts
Coding Convention: 10pts
Accuracy: 5pts
V. Essay :: Answer the questions completely. Limit your answers to 5 sentences. (35 pts)
1. Discuss the history of PERL and PHP. What is their relationship? (10 pts)
2. In spite of the similarities, what are the difference between PERL and PHP (10 pts)
3. All programming languages have flaws of their own, what are the weaknesses of PERL? (5 pts)
4. How will MySQL go in par against proprietary Databases like MsSQL, Oracle, etc.? (10 pts)
5. Why is it that there are a lot of open source languages available today and why is it that some other prefer
to use a certain language rather than choosing its counterparts like PHP, Ruby, PERL, Python? (10 pts)