You are on page 1of 5

University of Negros Occidental-Recoletos

COLLEGE OF INFORMATION TECHNOLOGY ITE - CODE


C IT 3 5 89 3Z O P E N SO U R C E DA T A B A S E S & C M S
Midterm Examination
August 22, 2013
Fi r s t N a m e

I.

M . I.

CS

L as t Na m e

IT

IS

S ec ti o n

Multiple Choice :: Encircle the right answer (10 pts)

1. What does PHP currently stands for?


A. PHP: Hypertext Preprocessor

D. Personal Home Page

B. Personal Hypertext Processor

E. None of the above

C. Private Home Page


2. PHP server scripts are surrounded by delimiters, which is it?
A. <?php ?>

D. <&> </&>

B. <script> </script>

E. None of the above

C. <?php> </?>
3. How do you write Hello World in PHP?
A. echo Hello World

D. A & C

B. print(Hello World)

E. None of the above

C. print Hello World;


4. How to declare a variable in PERL?
A. $

D. All of the above

B. @

E. None of the above

C. #
5. How to show errors in PERL
A. use warnings;

D. import warnings;

B. import errors

E. None of the above

C. error_reporting(1);

Instructor| Ryan Gonzales

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

D. All of the above

B. characters

E. None of the above

C. varchar
8. It is field that uniquely identifies each record?
A. Key

D. Null

B. Primary Key

E. None of the above

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

E. None of the above

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

E. None of the above

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

: Eclipse is one of the text editor for debugging PHP.


: ucfirst(); will convert the first string to uppercase.
: PERL was written by John Wall.
Instructor| Ryan Gonzales

4.
5.
6.
7.
8.
9.
10.

: PERL is ideal for prototyping.


: <?php $var = World; ?> Hello <?=$var?>
: The web server interprets that request, and sends a reply to the user agent.
: MySQL can be used as an offline database.
: FI in the PHP/FI means Forms Interpreter.
: Examples of a web server is LAMP, WAMP, MAMP, and XAMP.
: SELECT * WHERE id

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

Instructor| Ryan Gonzales

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)

Instructor| Ryan Gonzales

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)

BONUS (10 points) :: What is RAILS like Ruby on Rails?

Instructor| Ryan Gonzales

You might also like