Font size
S
M
L
XL
WorksheetsWP part 2
Total questions: 87
Worksheet time: 44mins
Name
Class
Date
1.
PHP stands for ______________
a)
PHP:Hypermedia Preprocessor
b)
PHP:Hypertext Postprocessor
c)
PHP:Hypertext Preprocessor
d)
PHP:Hypermedia Postprocessor
2.
PHP was created by _________
a)
Rasmus Lerdorf
b)
James Gosling
c)
Dennis Richie
d)
Ken Thomsan
3.
Variable names in PHP begins with ________ sign.
a)
$
b)
%
c)
#
d)
&
4.
The ________ symbol in PHP is used for single - line comment
a)
#
b)
*
c)
&
d)
%
5.
Constants in PHP can be created with ______ function
a)
string
b)
define
c)
array
d)
special
6.
In PHP ______ data contains only a single value.
a)
Compound data
b)
scalar data
c)
special data
d)
unique data
7.
In PHP string belongs to _________ datatype.
a)
Compound data
b)
scalar data
c)
special data
d)
unique data
8.
In PHP ______ data contains more than one value.
a)
Compound data
b)
scalar data
c)
special data
d)
unique data
9.
Array belongs to ________ data type in PHP.
a)
Compound data
b)
scalar data
c)
special data
d)
unique data
10.
Object belongs to ________ data type in PHP.
a)
Compound data
b)
scalar data
c)
special data
d)
unique data
11.
Resource is ________ data type in PHP.
a)
Compound data
b)
scalar data
c)
special data
d)
unique data
12.
Null is ________ data type in PHP.
a)
Compound data
b)
scalar data
c)
special data
d)
unique data
13.
What will be the output of the following PHP code?
<?php
$x = 23;
echo ( $x < 24 );
?>
a)
Displays 1 (true)
b)
Displays 24
c)
Displays 23
d)
Displays “” (false)
14.
What will be the output of the following PHP code?
<?php
$x = 23;
echo ( $x <“24” );
?>
a)
Displays “” (false)
b)
Displays 1 (true)
c)
Displays 24
d)
Displays 23
15.
What will be the output of the following PHP code?
<?php
$x = 23;
echo ( $x ===23 );
?>
a)
Displays “” (false)
b)
Displays 1 (true)
c)
Displays 24
d)
Displays 23
16.
What will be the output of the following PHP code?
<?php
$x = 2;
$y = 3;
echo ( ($x == 2) xor ($y == 3) );
?>
a)
Displays “” (false)
b)
Displays 1 (true)
c)
Displays 2
d)
Displays 3
17.
Let $x and $y be the two arrays in PHP. Which array operator is used for the union of $x and $y?
a)
+
b)
U
c)
,
d)
&
18.
A switch statement in PHP is used to ________
a)
switch between functions
b)
switch between variables
c)
switch between lines
d)
choose from multiple possibilities
19.
The_______ loops through a block of code for each element in an array in PHP.
a)
for
b)
while
c)
do...while
d)
foreach
20.
In PHP the _____ loop will always execute the block of code once, it will then check the condition, and repeat the loop while the specified condition is true.
a)
for
b)
while
c)
do...while
d)
foreach
21.
In PHP the _______ function returns the total number of characters in a string.
a)
len()
b)
str_length()
c)
length()
d)
strlen()
22.
In PHP the __________ functionis used to find out whether some text occurs within a string.
a)
strstr()
b)
find()
c)
count()
d)
str_find()
23.
In PHP the __________ functionfinds the last match in the string, rather than the first
a)
strpos()
b)
str_last()
c)
strrpos()
d)
strpos_last()
24.
The __________ is used to format text strings in PHP.
a)
getc()
b)
sprintf()
c)
gets()
d)
get()
25.
Arrays with named keys in PHP are called ________
a)
Associative arrays
b)
Indexed arrays
c)
Multidimensional arrays
d)
named arrays
26.
The _____ function is used for deleting array elements in PHP.
a)
delete()
b)
erase()
c)
unset()
d)
clear()
27.
In PHP the_______ loops through a block of code for each element in an array.
a)
foreach
b)
while
c)
do-while
d)
for
28.
The _____ function is used to sort associative arrays in descending order, according to the key in PHP.
a)
arsort()
b)
krsort()
c)
ksort()
d)
sort()
29.
The _____ function is used to sort associative arrays in descending order, according to the value in PHP.
a)
arsort()
b)
krsort()
c)
ksort()
d)
sort()
30.
The _____ function removes the first element from the start of an array in PHP.
a)
array_shift()
b)
array_pop()
c)
array_push()
d)
array_unshift()
31.
The _____ function adds one or more new elements to the start of an array in PHP.
a)
array_shift()
b)
array_pop()
c)
array_push()
d)
array_unshift()
32.
In PHP the _____ function adds one or more new elements to the end of an array.
a)
array_unshift()
b)
array_push()
c)
array_shift()
d)
array_pop()
33.
The _____ function removes the last element from the end of an arrayin PHP.
a)
array_shift()
b)
array_pop()
c)
array_push()
d)
array_unshift()
34.
In PHP the _____ function counts the elements in an array.
a)
count()
b)
len()
c)
array_len()
d)
array_count()
35.
In PHP the_________ function takes a string, splits it into separate chunks based on a specified delimiter string, and returns an array containing the chunks.
a)
implode()
b)
explode()
c)
array_push()
d)
array_unshift()
36.
In PHP arrays containing one or more arrays are called ________
a)
Associative arrays
b)
Indexed arrays
c)
Multidimensional arrays
d)
named arrays
37.
All PHP code, must be contained within ________ tags
a)
<?php ... php?>
b)
<?php ... ?>
c)
<php ... >
d)
<%php ... %>
38.
In PHP _________ is a statement that returns a value to the statement that called the function.
a)
get statement
b)
return statement
c)
value statement
d)
request statement
39.
What will be the output of the following PHP code?
<?php
function a()
{
function b()
{
echo “I am b”;
}
echo “I am a”;
}
b();
a();
?>
a)
I am b
b)
I am bI am a
c)
Error
d)
I am a
40.
Global data can be accessed from inside a function using _______ keyword in PHP.
a)
local
b)
public
c)
global
d)
protected
41.
The _________ functions also known as closures in PHP.
a)
Anonymous
b)
global
c)
self
d)
defined
42.
When a function returns FALSE in PHP, _______function is used to print error message.
a)
die()
b)
error()
c)
unset()
d)
clear()
43.
Which of the following function opens a file in PHP?
a)
fopen()
b)
open()
c)
fop()
d)
file_open()
44.
The _________ mode in PHP is used to open for writing only. Remove all previous content, if file doesn’t exist, it creates .
a)
a+
b)
a
c)
r+
d)
w
45.
The _________ mode in PHP is used to open for reading and writing, start at END (append) and creates file if it doesn’t exist.
a)
a+
b)
a
c)
r+
d)
r
46.
Which of the following function is used to close a file in PHP?
a)
fclose()
b)
close()
c)
fcs()
d)
file_close()
47.
The________ function in PHP is used to read only one character at a time
a)
fgets()
b)
fread()
c)
fgetc()
d)
get()
48.
The________ function in PHP is used to read a line of text from an open file.
a)
fgets()
b)
fread()
c)
fgetc()
d)
get()
49.
In PHP the________ function is used to write a string of characters to a file.
a)
fwrite()
b)
fputc()
c)
put()
d)
fgets()
50.
In PHP the________ function is used to return the size of a file as integer.
a)
filesize()
b)
size()
c)
max_size()
d)
file_max_size()
51.
The________ function is used to check if a file exists or not in PHP.
a)
exists()
b)
file_notexists()
c)
file_exists()
d)
notexists()
52.
Which of the following function is used to copy a file in PHP?
a)
copy(destinationfile, sourcefile)
b)
sourcefile=copy(destinationfile)
c)
destinationfile =copy(sourcefile)
d)
copy(sourcefile, destinationfile)
53.
The________ function is used for deleting files in PHP.
a)
remove()
b)
unlink()
c)
delete()
d)
exists()
54.
In PHP the _____ request encodes the form parameters in the URL.
a)
GET
b)
POST
c)
FORM
d)
REQUEST
55.
In PHP the _____ request passes the form parameters in the body of the HTTP request, leaving the URL untouched.
a)
GET
b)
POST
c)
FORM
d)
REQUEST
56.
In PHP the ______ Superglobal Array contains the values of both the $_GET and $_POST.
a)
$_GET
b)
$_POST
c)
$_FORM
d)
$_REQUEST
57.
The ___________html control allows the user to enter multiple lines of text in PHP.
a)
Text Field
b)
Text area field
c)
Label
d)
Radio button
58.
The ________ type of html button sends the filled-in form to the server-side script for processing in PHP.
a)
push button
b)
submit button
c)
form button
d)
reset button
59.
The ________ type of html button can be made to trigger various events in the browser using JavaScript in PHP.
a)
push button
b)
submit button
c)
form button
d)
reset button
60.
The ________ type of html button resets all form fields back to their initial values in PHP.
a)
push button
b)
submit button
c)
form button
d)
reset button
61.
In PHP to turn a normal html list box into a multi-select box, the _______ attribute is added to the select element.
a)
multiple
b)
select
c)
multi-select
d)
multi-list
62.
The _____ html controlworks like a text input field, except that the entered text is not displayed in PHP.
a)
File upload
b)
hidden field
c)
password field
d)
Image maps
63.
The________html control is used to simply store the text value specified in the value attribute but is not displayed on the page in PHP.
a)
password field
b)
File upload
c)
Image maps
d)
hidden field
64.
In PHP the ______html control are clickable images seen in browsers.
a)
password field
b)
Image maps
c)
File upload
d)
hidden field
65.
The ________ html control is used to upload a file in PHP.
a)
File upload
b)
hidden field
c)
Image maps
d)
password field
66.
Which of the following provides access to the uploaded file in the temporary directory on the web server in PHP?
a)
$_FILES[‘file’][‘name’]
b)
$_FILES[‘file’][‘type’]
c)
$_FILES[‘file’][‘tmp_name’]
d)
$_FILES[‘file’][‘size’]
67.
Which of the following provides the actual name of the uploaded file in PHP?
a)
$_FILES[‘file’][‘name’]
b)
$_FILES[‘file’][‘type’]
c)
$_FILES[‘file’][‘tmp_name’]
d)
$_FILES[‘file’][‘actual_name’]
68.
In PHP _________ is a packet of information sent from the server to client, and then sent back to the server each time it is accessed by the client.
a)
session
b)
profile
c)
database
d)
cookie
69.
In PHP cookies are sent from the server to the client via ________ headers.
a)
Get-Cookie
b)
Set-Cookie
c)
Sent-Cookie
d)
Request-Cookie
70.
To access a cookie received from a client _________ superglobal array is used in PHP.
a)
$_COOKIE
b)
$_REQUESTCOOKIE
c)
$_GETCOOKIE
d)
$_SETCOOKIE
71.
In PHP setcookie() the _____ data string defines the life time.
a)
time
b)
End time
c)
Expire
d)
Last time
72.
In PHP setcookie()the _____ definesdata stored in the file
a)
value
b)
time
c)
Expire
d)
data
73.
In PHP ________ works by creating a unique id (UID) for each visitor and storing variables based on this UID.
a)
session
b)
profile
c)
database
d)
cookie
74.
In PHP to store user data in session _______ array is used.
a)
$_SESSION
b)
SYS_SESSION
c)
$SESSION
d)
$_SESSIONS
75.
To start a PHP session _______ in PHP is used.
a)
session_start()
b)
PHP_session_start()
c)
PHP_start()
d)
start()
76.
Which of the following is used to access session variables in PHP?
a)
session_start()
b)
$_SESSION[]
c)
isset()
d)
start()
77.
In PHP MySqlDatabase can be created by using the ____________ command
a)
create database
b)
use databases
c)
show databases
d)
view databases
78.
To list all databases on the sql server _______ is used.
a)
list databases
b)
use databases
c)
show databases
d)
view databases
79.
In PHP to see all the tables in theMySql database _______ is used.
a)
list tables
b)
use tables
c)
show tables
d)
view tables
80.
In PHP to create a connection object for MYSQL ___________ is used.
a)
mysql_connection
b)
db_connection
c)
db_connect
d)
mysql_connect
81.
To select the MySqldatabase in PHP ________ is used.
a)
mysql_db
b)
select_db
c)
mysql_select_db
d)
mysql_select
82.
To read theMySql table in PHP________ is used.
a)
mysql_array
b)
mysql_fetch_array
c)
mysql_query
d)
mysql_fetch_query
83.
To extract the records from the MySqldatabase table _______ function is used in PHP.
a)
mysql_array
b)
mysql_fetch_array
c)
mysql_query
d)
mysql_fetch_query
84.
MySqlDatabase connection can be closed by using _______ in PHP.
a)
mysql_close
b)
sql_close
c)
db_close
d)
mysql_db_close
85.
In PHP which of the following is used to insert the MySql table?
a)
INSERT TABLE INTO table_name(column1,column2, …) VALUES (value1,value2…)
b)
INSERT INTO TABLE table_name(column1,column2, …) VALUES (value1,value2…)
c)
INSERT INTO table_name(column1,column2, …) VALUES (value1,value2…)
d)
INSERT TABLE table_name(column1,column2, …) VALUES (value1,value2…)
86.
In PHP which of the following is used to update the MySql table?
a)
UPDATE table_name SET column1=value 1,column2=value2, … WHERE condition
b)
UPDATE INTO table_name SET column1=value 1,column2=value2, … WHERE condition
c)
UPDATE INTO table_name column1=value 1,column2=value2, … WHERE condition
d)
UPDATE table_name SET column1=value 1,column2=value2, …
87.
In PHP which of the following is used to delete the MySqlrecords?
a)
DELETE FROM table_name WHERE column_name=value
b)
DELETE FROM TABLE table_name WHERE column_name=
c)
DELETE table_name WHERE column_name=value
d)
DELETE column_name=value FROM table_name
Reset
