Sei sulla pagina 1di 6

INTERNATIONAL SCHOOL OF ASIA AND THE PACIFIC

Alimannao Hills, Peñablanca, Cagayan 3502


COLLEGE OF INFORMATION TECHNOLOGY AND ENGINEERING
1. What does PHP stand for?
i) Personal Home Page
ii) Hypertext Preprocessor
iii) Pretext Hypertext Processor
iv) Preprocessor Home Page
A. Both (i) and (ii)
B. Both (ii) and (iv)
C. Only (ii)
D. Both (i) and (iii)
2. Who is the father of PHP?
A. Rasmus Lerdorf
B. Willam Makepiece
C. Drek Kolkevi
D. List Barely
3. PHP files have a default file extension of.
A. .html
B. .xml
C. .php
D. .ph
4. A PHP script should start with ___ and end with ___:
A.
< php >
B.
< ? php ?>
C.
<??>
D.
<?php ? >
5. Which of the looping statements is/are supported by PHP?
i) for loop
ii) while loop
iii) do-while loop
iv) foreach loop
A. (i) and (ii)
B. (i), (ii) and (iii)
C. All of the mentioned
D. None of the mentioned
6. Which of the following is/are a PHP code editor?
i) Notepad
ii) Notepad++
iii) Adobe Dreamweaver
iv) Sublim
A. Only (iv)
B. All of the mentioned.
C. (i), (ii) and (iii)
D. Only (iii)
7. We can use ___ to comment a single line?
i) /?
ii) //
iii) #
iv) /* */
A. Only (ii)
B. (i), (iii) and (iv)
C. (ii), (iii) and (iv)
D. Both (ii) and (iv)
8. Which of the below symbols is a newline character?
A. \r
B. \n
C. /n
D. /r
9. Which of the following php statement/statements will store 111 in variable num?
i) int $num = 111;
ii) int mum = 111;
iii) $num = 111;
iv) 111 = $num;
A. Both (i) and (ii)
B. All of the mentioned.
C. Only (iii)
D. Only (i)
10. What will be the output of the following php code
< ?php
$num = 1;
$num1 = 2;
print $num . "+". $num1 ;
?>
A. 3
B. 1+2
C. 1.+.2
D. Error
11. What will be the output of the following php code?
< ?php
$num = "1";
$num1 = "2";
print $num+$num1 ;
?>
A. 3
B. 1+2
C. Error
D. 12
12. Which of following variables can be assigned a value to it?
(i) $3hello
(ii) $_hello
(iii) $this
(iv) $This
A. All of the mentioned
B. Only (ii)
C. (ii), (iii) and (iv)
D. (ii) and (iv)
13. What will be the output of the following code?
< ?php
$foo = 'Bob';
$bar = &$foo;
$bar = "My name is $bar";
echo $bar;
echo $foo;
?>
A. Error
B. My name is BobBob
C. My name is BobMy name is Bob
D. My name is Bob Bob
13. What will be the output of the following code?
$var = 10;
function fn ()
{
$var = 20;
return $var;
}
fn ();
echo $var;
a. 10
b. 20
c. Undefined Variable
d. Syntax Error
14. Which of the following functions output text?
a. echo()
b. print()
c. println()
d. display()
15. Which of the following statement is not correct for PHP?
a. It is a server side scripting language
b. A PHP file may contain text, html tags or scripts
c. It can run on windows and Linux systems only
d. It is compatible with most of the common servers used today
16. Which of the following printing construct/function accepts multiple parameters?
a. e
b. print
c. printf
d. All of the above
17. What will be the output of the following code?
$a = 10;
if ($a > 5 OR < 15)
echo 'true';
else
echo 'false';
a. true
b. false
c. No output
d. Parse Error
18. What will be the output of the following code?
function fn (&$var)
{
$var = $var – ($var/10*5);
return $var;
}
echo fn(100);
a. 100
b. 50
c. 98
d. Error message
19. What will be the output of following code?
$a = 10;
echo ‘Value of a = $a’;
a. Value of a = 10
b. Value of a = $a
c. Undefined
d. Syntax Error
20. What will be the output of the following code?
echo 30*5 . 7;
a. 150.7
b. 1507
c. 150.7
d. you can’t concatenate integers
21. How would you start a session?
a. session(start);
b. session();
c. session_start();
d. begin_session();
22. What will be the output of the following PHP code ?
<?php
print "echo hello world";
?>
a) echo hello world
b) hello world
c) nothing
d) error
23. What will be the output of the following PHP code ?
<?php
$one = "one";
$two = "two";
print($one$two);
?>
a) onetwo
b) one
c) nothing
d) error
24. Which one of the following databases has PHP supported almost since the beginning?
A. Oracle Database
B. SQL
C. SQL+
D. MySQL
25. The updated MySQL extension released with PHP 5 is typically referred to as..
A. MySQL
B. mysql
C. mysqli
D. mysqly
26. Which one of the following statements can be used to select the database?
A. $mysqli=select_db(‘databasename’);
B. mysqli=select_db(‘databasename’);
C. mysqli->select_db(‘databasename’);
D. $mysqli->select_db(‘databasename’);
27. If there is no error, then what will the error() method return?
A. TRUE
B. FALSE
C. Empty String
D. 0
28. Which one of the following methods is responsible for sending the query to the database?
A. query()
B. send_query()
C. sendquery()
D. query_send()
29. Which of the methods are used to manage result sets using both associative and indexed arrays?
A. get_array() and get_row()
B. get_array() and get_column()
C. fetch_array() and fetch_row()
D. fetch_array() and fetch_column()
30. When you use the $_GET variable to collect data, the data is visible to..
A. none
B. only you
C. everyone
D. selected few
31. When you use the $_POST variable to collect data, the data is visible to..
A. none
B. only you
C. everyone
D. selected few
32. Which one of the following should not be used while sending passwords or other sensitive
information?
A. GET
B. POST
C. REQUEST
D. NEXT
33. Which function is used to remove all HTML tags from a string passed to a form?
A. remove_tags()
B. strip_tags()
C. tags_strip()
D. tags_remove()
34. To validate an e-mail address, which flag is to be passed to the function filter_var()?
A. FILTER_VALIDATE_EMAIL
B. FILTER_VALIDATE_MAIL
C. VALIDATE_EMAIL
D. VALIDATE_MAIL
35. $GLOBALS, $_SERVER, $_REQUEST, $_POST, $_GET, $_FILES, $_COOKIE, $_SESSION all are
example of
A. Super array C. Local variables
B. Global variables D. None of them

36. Which of the following error stops the execution of the script?
A. Parse Error C. Warning Error
B. Fatal Error D. Notice Error

37. The following are not example of a warning error, EXCEPT:


A. Warning: include welcome.php: failed to open stream: No such file or directory in
warning.php on line 3
B. Warning Error: Call to undefined function in warning.php on line 6
C. Warning Error: Syntax Error, unexpected ‘{‘ in warning.php on line 41
D. All of the above

38. A ________ is a collection of PHP code that does something. It can be as simple as a variable
assignment or as complicated as a loop with multiple exit points.
A. Case Sensitivity C. Semicolons
B. Whitespace Insensitive D. Statement

39. What does this statement identifies, “You can spread a statement across any number of lines, or
lump a bunch of statements together on a single line.”
A. Case Sensitivity C. Comments
B. Whitespace Insensitive D. Statement

40. __________ give information to people who read your code, but they are ignored by
PHP at execution time.
A. Case Sensitivity C. Comments
B. Whitespace Insensitive D. Statement

II. MODIFY TRUE OR FALSE. 2 pts. each.


1. PHP pages are generally HTML pages with PHP commands embedded in them. TRUE
2. Solving one syntax problem can uncover the next. TRUE
3. PHP programs access form values primarily through the $_SESSION and $_GET array variables.
FALSE
4. PHP supports all the popular database systems, including MySQL, PostgreSQL, Oracle, and
Sybase, SQLite, and ODBC-compliant databases. TRUE
5. The names of user-defined classes and functions, as well as built-in constructs and keywords
such as echo, while, class, etc., are case-sensitive. FALSE
6. PHP uses semicolons to join simple statements. FALSE
7. Variable names always begin with a dollar sign ($); function names are case-sensitive. FALSE
8. There’s only one value of the NULL data type. That value is available through the case-insensitive
keyword NULL. The NULL value represents a variable that has 0 return value. FALSE
9. A variable may hold a value of any type. There is no compile-time or runtime type checking on
variables. You can replace a variable’s value with another of a different type. TRUE
10. In programming, one of the most common operations is to increase or decrease the value of a
variable by one. TRUE

III. Enumerate the following:


1-4. 4 known errors in PHP
5-6. 2 Types of error in PHP
7-10. 4 Known Queries in MYSQL Database
11-13. 3 Types of Tags
14-15. 2 Types of comment tags/syntax
16-18. Give at least 3 ways to solve a syntax error
19-20. 2 main reasons of warning errors