NEW
Font size
S
M
L
XL
WorksheetsWP 11-15
Total questions: 55
Worksheet time: 2hrs 55mins
Name
Class
Date
1.
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)
2.
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
3.
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
4.
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
5.
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)
&
6.
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
7.
The_______ loops through a block of code for each element in an array in PHP.
a)
for
b)
while
c)
do...while
d)
foreach
8.
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
9.
In PHP the _______ function returns the total number of characters in a string.
a)
len()
b)
str_length()
c)
length()
d)
strlen()
10.
In PHP the __________ functionis used to find out whether some text occurs within a string.
a)
strstr()
b)
find()
c)
count()
d)
str_find()
11.
In PHP the __________ functionfinds the last match in the string, rather than the first
a)
strpos()
b)
str_last()
c)
strrpos()
d)
strpos_last()
12.
The __________ is used to format text strings in PHP.
a)
getc()
b)
sprintf()
c)
gets()
d)
get()
13.
Arrays with named keys in PHP are called ________
a)
Associative arrays
b)
Indexed arrays
c)
Multidimensional arrays
d)
named arrays
14.
The _____ function is used for deleting array elements in PHP.
a)
delete()
b)
erase()
c)
unset()
d)
clear()
15.
In PHP the_______ loops through a block of code for each element in an array.
a)
foreach
b)
while
c)
do-while
d)
for
16.
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()
17.
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()
18.
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()
19.
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()
20.
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()
21.
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()
22.
In PHP the _____ function counts the elements in an array.
a)
count()
b)
len()
c)
array_len()
d)
array_count()
23.
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()
24.
In PHP arrays containing one or more arrays are called ________
a)
Associative arrays
b)
Indexed arrays
c)
Multidimensional arrays
d)
named arrays
25.
All PHP code, must be contained within ________ tags
a)
<?php ... php?>
b)
<?php ... ?>
c)
<php ... >
d)
<%php ... %>
26.
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
27.
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
28.
Global data can be accessed from inside a function using _______ keyword in PHP.
a)
local
b)
public
c)
global
d)
protected
29.
The _________ functions also known as closures in PHP.
a)
Anonymous
b)
global
c)
self
d)
defined
30.
When a function returns FALSE in PHP, _______function is used to print error message.
a)
die()
b)
error()
c)
unset()
d)
clear()
31.
Which of the following function opens a file in PHP?
a)
fopen()
b)
open()
c)
fop()
d)
file_open()
32.
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
33.
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
34.
Which of the following function is used to close a file in PHP?
a)
fclose()
b)
close()
c)
fcs()
d)
file_close()
35.
The________ function in PHP is used to read only one character at a time
a)
fgets()
b)
fread()
c)
fgetc()
d)
get()
36.
The________ function in PHP is used to read a line of text from an open file.
a)
fgets()
b)
fread()
c)
fgetc()
d)
get()
37.
In PHP the________ function is used to write a string of characters to a file.
a)
fwrite()
b)
fputc()
c)
put()
d)
fgets()
38.
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()
39.
The________ function is used to check if a file exists or not in PHP.
a)
exists()
b)
file_notexists()
c)
file_exists()
d)
notexists()
40.
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)
41.
The________ function is used for deleting files in PHP.
a)
remove()
b)
unlink()
c)
delete()
d)
exists()
42.
In PHP the _____ request encodes the form parameters in the URL.
a)
GET
b)
POST
c)
FORM
d)
REQUEST
43.
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
44.
In PHP the ______ Superglobal Array contains the values of both the $_GET and $_POST.
a)
$_GET
b)
$_POST
c)
$_FORM
d)
$_REQUEST
45.
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
46.
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
47.
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
48.
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
49.
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
50.
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
51.
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
52.
In PHP the ______html control are clickable images seen in browsers.
a)
password field
b)
Image maps
c)
File upload
d)
hidden field
53.
The ________ html control is used to upload a file in PHP.
a)
File upload
b)
hidden field
c)
Image maps
d)
password field
54.
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’]
55.
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’]
Reset
