Font size
WorksheetsRScott PHP
Total questions: 105
Worksheet time: 54mins
Which tag is used for php
<?php
?>
<style>
<php ?>
<php
/php>
What are the two types of array in php
Indexed, sequence
Associative, sequence
Indexed, associative
None
$a=array("Timmy","Jimmy");
Is an example of
Indexed array
Associative array
Sequence array
None
$a=array(10=>"Jimmy",20=>"mummy");
Is an example of
Sequence array
Indexed array
Associative array
None
In php the keyword to be used before function name is
Function
Static
function
FUNCTION
function add()
{
$a=10;
echo $a;}
This is an example for
Call by value
Call by reference
None
Both
function add(&a)
{
$a=10;
echo $a;}
$a=33;
This is an example for
Call by value
Call by reference
Both of the above
None
<?php
function add()
{
global $a=10;
echo $a;
}
add();
$a+=10;
?>
Output is
10
15
20
30
$a="deepan";
$b="Deepan";
if(strcmp($a,$b))
{
echo "equal";
}
else{
echo " not equal";}
Output is
Equal
Not equal
Error
None
$a="IT is favorite department";
$b=sub_string($a,"bes",7,14);
echo $b;
Output is
IT is best department
IT is bes department
Error
IT is favorite department
Choose the appropriate tag to get the content in browser as follows:
<html>
<body>
______
Johny Johny!
Yes Papa
______
</body>
</html>
Johny Johny!
Yes Papa
(a)
HTML stands for
Hyper Text Machine Language
Hyper Text Markup Language
Hyper Technical Machine Language
None of these
Choose the correct option About HTML elements
Elements in HTML describes the way of presenting the content in the browser.
All elements must have atleast one attribute associated with it.
Element names are case in-sensitive
None of the above
Which one of the following is a form element?
text box.
radio button.
submit button.
All of these.
Which one of the following is incorrect?
<label> tag in HTML is used for creating a tag for form elements.
id attribute is used with <label> to reduce the clickable area of form elements
<label> can be used to increase the clickable area of buttons
none of the above
Choose the correct option.
Default method in HTML is GET or POST
Use of method attribute determines by which method the datas in the form will be submitted.
Method can be POST or GET.
Default method in HTML is GET.
Which of the following tag is used for drop down list?
<dropdown>
<select>
<option>
<salect>
Fill in the blanks with a suitable option in order to number items of an ordered list with small roman numbers.
<!DOCTYPE html>
<html>
<body>
<ol (a) >
<li>
Physics
</li>
<li>
Chemistry
</li>
<li>
Mathematics
</li>
</ol>
</body>
</html>
What is the default item marker in ordered lists of HTML?
Circle
Marker
disc
None of the above
Which one of the following can be used to define the spacing between the cells of a table?
border-spacing
spacing
cellspacing
table-spacing
How to insert a background image in HTML?
<body background = "img.png">
<img background = "img.png">
<body style="background-image: url();">
None of the above.
Which HTML tag is used to display the power in expression, i.e., (x2 - y2)?
<sub>
<sup>
<p>
None of the above
What is the output of the PHP code.
<?php
$a=0;
$a = 5>2 ?$b=6 : $b=8;
print("$a $a");?>
6
66
68
88
What is the output of the PHP code.
<?php
if(4>5)
{print("Hurray..");}
print("yes");
?>
Yes
hurray..yes
Hurray..Yes
none of the above
What is the output of the PHP code.
<?php
if(-5) {
print("Germany\n");
}
if(' ')
{ print("Texas\n"); }
printf("ZING");
?>
ZING
Germany ZING
Germany Texas ZING
error
What will be the output of the following PHP code?
< ?php
$total = "25 students";
$more = "students 10";
$total = $total + $more;
echo "$total" ;?>
Error
35 students
35
25
PHP is a____________side scripting language
server
browser
client
PHP stands for
Hypertext processor
Homepage processor
Hypertext preprocessor
Who is known as father of PHP
Rasmus Lerdorf
Brendan Eich
Hakon Wium Lie
Which of the following is not true?
PHP can be used to develop web applications.
PHP makes a website dynamic
PHP can not be embedded into html.
PHP scripts are enclosed within ___
<php> . . . </php>
<?php . . . ?>
?php . . . ?php
Variables used in php
$a=5;
var a=5;
int a=5;
_______ is a concatenation operator in php
+ (plus)
+=
. (dot)
PHP is a case sensitive
TRUE
FALSE
Find the output
<?php
$x = 5;
{ $x = 10;
echo $x;
}
echo $x;
?>
105
510
1010
find the output
<?php
$x = 1;
$x += 1;
echo $x;
?>
2
1
0
What does PHP stands for?
PHP: Hypertext Preprocessor
Private Home Page
Personal Hypertext Processor
Which among the following is the correct delimiters that surround PHP server scripts?
<?php>...</?>
<script>...</script>
<?php...?>
<&>...</&>
How do you get information from a form that is submitted using the "get" method?
Request.QueryString;
$_GET[];
Request.Form;
When using the POST method, variables are displayed in the URL:
True
False
What is the correct way to add 1 to the $count variable?
$count =+1
$count++;
++count
count++;
How do you create an array in PHP?
$cars = "Volvo", "BMW", "Toyota";
$cars = array["Volvo", "BMW", "Toyota"];
$cars = array("Volvo", "BMW", "Toyota");
The if statement is used to execute some code only if a specified condition is true
True
False
How is PHP written into a webpage?
Just like other html tags: <php> </php>
Only in a separate file which is linked to the html page
Using curled brackets {php} {/php}
A PHP script starts with <?php and ends with ?>
PHP script is parsed....
On the client's web browser
On the server where the website is hosted
On the client's CPU
On the Internet
PHP is case sensitive in what way?
It's never case sensitive, don't worry about it.
Only when referring to variables
When referring to classes, functions or variables
All the time!
When concatenating strings, you use what symbol in PHP?
A comma ,
A plus sign +
a hyphen -
a full stop .
Which statement can be used to select the database?
$mysqli=select_db('databasename');
mysqli=select_db('databasename');
mysqli->select_db('databasename');
$mysqli->select_db('databasename');
The updated MySQL extension with PHP5 is typically referred to as
MySQL
mysql
mysqli
mysqly
Which method returns the error code generated from the execution of the last MySQL function?
errno()
errnumber()
errorno()
errornumber()
Which method is responsible for sending the query to the database?
query()
send_query()
sendquery()
query_send()
Which will input data into a table?
INSERT INTO table(name, height, weight) VALUES('strand', '6ft 2in', '165')
INPUT INTO table(name, height, weight) VALUES('strand', '6ft 2in', '165')
INSERT INTO table CATEGORIES(name, height, weight) VALUES('strand', '6ft 2in', '165')
INSERT INTO table CATEGORIES(name, height, weight) ('strand', '6ft 2in', '165')
If I want to show all data in a MySQL table, I would use
SHOW * FROM table;
SELECT * FROM table;
SHOW * IN table;
SELECT * IN table;
What does PHP stand for?
Preprocessor Hypertext Page
Personal Home Page
Hypertext Transfer Protocol
PHP Hypertext Preprocessor
PHP is considered a server-side scripting language.
True
False
Maybe
I don't know
Which of the following extension is correct for PHP files?
.html
.opp
.php
.pxp
How do you start the PHP scripting block?
<php.....?>
<script .... script>
<?php.... ?php>
<?......?php>
Whitespace is not ignored in PHP?
True
False
Maybe
I don't know
Variables in PHP always begins with...
?
&
$
#
Which of the following is the correct syntax to start a multiple line comment in PHP?
#-----------#
/______/
/*--------*/
/------/*
Which of the following is the correct syntax to declare a variable in PHP?
var = 10;
$var = "10";
$10 = var;
$var = 10
How do you display "Hello World" in PHP?
Hello World;
echo Hello World;
echo (Hello World);
echo "Hello World";
What does a semicolon indicate in PHP?
The end of a PHP statement or instruction.
The start of PHP statement or instruction.
The start of a PHP script block.
The end of the a PHP script block.
Can PHP read html and CSS file?
YES
NO
The MySQLi extension, the 'i' stands for __________.
impress
improved
initial
The 2 basic ways to get output in PHP are __________.
echo and cout
echo and scan
echo and print
PHP syntax start and end with __________.
<? php
//codes here
?>
<? html
//codes here
?>
<? head
//codes here
?>
The default file extension for PHP files is __________.
.html
.php
.css
.java
Where is your PHP project file located?
C:\xampp\htdocs\
C:\xampp\project\
D:\xampp\htdocs\
PHP scripts are executed on the __________.
compiler
browser
server
What is PHP?
PHP: Hyperlink Preprocessor
PHP: Hypertext Preprocessor
PHP: Hyperactive Preprocessor
PHP Scripts are executed using
XAMPP
JAVA
EDITOR
NONE
Arrays are created using
Arrays()
array()
aray()
array[]
What are the two types of array in php
Indexed, sequence
Associative, sequence
Indexed, associative
None
$a=array("Timmy","Jimmy");
Is an example of
Indexed array
Associative array
Sequence array
None
$a=array(10=>"Jimmy",20=>"mummy");
Is an example of
Sequence array
Indexed array
Associative array
None
In php the keyword to be used before function name is
Function
Static
function
FUNCTION
function add()
{
$a=10;
echo $a;}
This is an example for
Call by value
Call by reference
None
Both
function add(&a)
{
$a=10;
echo $a;}
$a=33;
This is an example for
Call by value
Call by reference
Both of the above
None
<?php
function add()
{
global $a=10;
echo $a;
}
add();
$a+=10;
?>
Output is
10
15
20
30
$a="deepan";
$b="Deepan";
if(strcmp($a,$b))
{
echo "equal";
}
else{
echo " not equal";}
Output is
Equal
Not equal
Error
None
$a="IT is favorite department";
$b=sub_string($a,"bes",7,14);
echo $b;
Output is
IT is best department
IT is bes department
Error
IT is favorite department
What is the Output
<?php
$color=red;
echo "$color";
?>
red
$color
No answer
Error
All variables in PHP start with which symbol?
?
$
!
=
PHP Stands for
Personal Home Page
Hypertext processor
Project Heading Page
processor Hypertext programming
PHP is
Server side scripting
Client side scripting
Trace the output
$a = 10;
$A= 25
ECHO "".$a;
(a)
Which method is more secure send the data to server
post
get
request
none
We create re-usable code blocks by placing them inside?
Variables
Parameters
Code Blocks
Functions
Sometimes we only want certain code to execute if a condition is true. How do we test for that?
Loop
If Statement
Integer
Variable
What if we want a block of code to execute several times?
Use a Variable
Use a Function
Use a Loop
Use a Leap
How do I print out the values of the variable "name" ?
$name;
include $name;
echo $name;
echo $name
In an IF statement we can have 2 conditions tested. Which keyword allows this?
Else
if Else
Else if
OR
Which of the following are comparison operators in PHP?
A. ==
B. !=
C. ===
D. <
A and B
C and D
A,B and C
A,B,C and D
What is the Output?
<?php
#echo "Hello World"
echo "#Hello World";
?>
Hello World #Hello World
Hello World
#Hello World
Error
