wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

RScott PHP

Total questions: 105

Worksheet time: 54mins

Name
Class
Date
1.

Which tag is used for php

a)

<?php

?>

b)

<style>

c)

<php ?>

d)

<php

/php>

2.

What are the two types of array in php

a)

Indexed, sequence

b)

Associative, sequence

c)

Indexed, associative

d)

None

3.

$a=array("Timmy","Jimmy");

Is an example of

a)

Indexed array

b)

Associative array

c)

Sequence array

d)

None

4.

$a=array(10=>"Jimmy",20=>"mummy");

Is an example of

a)

Sequence array

b)

Indexed array

c)

Associative array

d)

None

5.

In php the keyword to be used before function name is

a)

Function

b)

Static

c)

function

d)

FUNCTION

6.

function add()

{

$a=10;

echo $a;}

This is an example for

a)

Call by value

b)

Call by reference

c)

None

d)

Both

7.

function add(&a)

{

$a=10;

echo $a;}

$a=33;

This is an example for

a)

Call by value

b)

Call by reference

c)

Both of the above

d)

None

8.

<?php

function add()

{

global $a=10;

echo $a;

}

add();

$a+=10;

?>

Output is

a)

10

b)

15

c)

20

d)

30

9.

$a="deepan";

$b="Deepan";

if(strcmp($a,$b))

{

echo "equal";

}

else{

echo " not equal";}

Output is

a)

Equal

b)

Not equal

c)

Error

d)

None

10.

$a="IT is favorite department";

$b=sub_string($a,"bes",7,14);

echo $b;

Output is

a)

IT is best department

b)

IT is bes department

c)

Error

d)

IT is favorite department

11.

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)  

12.

HTML stands for

a)

Hyper Text Machine Language

b)

Hyper Text Markup Language

c)

Hyper Technical Machine Language

d)

None of these

13.

Choose the correct option About HTML elements

a)

Elements in HTML describes the way of presenting the content in the browser.

b)

All elements must have atleast one attribute associated with it.

c)

Element names are case in-sensitive

d)

None of the above

14.

Which one of the following is a form element?

a)

text box.

b)

radio button.

c)

submit button.

d)

All of these.

15.

Which one of the following is incorrect?

a)

<label> tag in HTML is used for creating a tag for form elements.

b)

id attribute is used with <label> to reduce the clickable area of form elements

c)

<label> can be used to increase the clickable area of buttons

d)

none of the above

16.

Choose the correct option.

a)

Default method in HTML is GET or POST

b)

Use of method attribute determines by which method the datas in the form will be submitted.

c)

Method can be POST or GET.

d)

Default method in HTML is GET.

17.

Which of the following tag is used for drop down list?

a)

<dropdown>

b)

<select>

c)

<option>

d)

<salect>

18.

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>

19.

What is the default item marker in ordered lists of HTML?

a)

Circle

b)

Marker

c)

disc

d)

None of the above

20.

Which one of the following can be used to define the spacing between the cells of a table?

a)

border-spacing

b)

spacing

c)

cellspacing

d)

table-spacing

21.

How to insert a background image in HTML?

a)

<body background = "img.png">

b)

<img background = "img.png">

c)

<body style="background-image: url();">

d)

None of the above.

22.

Which HTML tag is used to display the power in expression, i.e., (x2 - y2)?

a)

<sub>

b)

<sup>

c)

<p>

d)

None of the above

23.
Choose PHP Conditional Operator from the list.
a)
?;
b)
:?
c)
??
d)
?/
24.
What is the output of the PHP code.?<br /><br /><?php<br /><br /> $a=0;<br /> $a = 5>2 ? print("4"): 3; <br /> print($a);<br />?>
a)
error
b)
14
c)
40
d)
41
25.

What is the output of the PHP code.

<?php

$a=0;

$a = 5>2 ?$b=6 : $b=8;

print("$a $a");?>

a)

6

b)

66

c)

68

d)

88

26.

What is the output of the PHP code.

<?php

if(4>5)

{print("Hurray..");}

print("yes");

?>

a)

Yes

b)

hurray..yes

c)

Hurray..Yes

d)

none of the above

27.

What is the output of the PHP code.

<?php

if(-5) {

print("Germany\n");

}


if(' ')


{ print("Texas\n"); }


printf("ZING");

?>

a)

ZING

b)

Germany ZING

c)

Germany Texas ZING

d)

error

28.

What will be the output of the following PHP code?

< ?php

$total = "25 students";

$more = "students 10";

$total = $total + $more;

echo "$total" ;?>

a)

Error

b)

35 students

c)

35

d)

25

29.
PHP Scripts starts with ________
a)
<php> … </php>
b)
<?php …. ?/>
c)
<?=........?>
d)
?php … ?php
30.

PHP is a____________side scripting language

a)

server

b)

browser

c)

client

31.

PHP stands for

a)

Hypertext processor

b)

Homepage processor

c)

Hypertext preprocessor

32.

Who is known as father of PHP

a)

Rasmus Lerdorf

b)

Brendan Eich

c)

Hakon Wium Lie

33.

Which of the following is not true?

a)

PHP can be used to develop web applications.

b)

PHP makes a website dynamic

c)

PHP can not be embedded into html.

34.

PHP scripts are enclosed within ___

a)

<php> . . . </php>

b)

<?php . . . ?>

c)

?php . . . ?php

35.

Variables used in php

a)

$a=5;

b)

var a=5;

c)

int a=5;

36.

_______ is a concatenation operator in php

a)

+ (plus)

b)

+=

c)

. (dot)

37.

PHP is a case sensitive

a)

TRUE

b)

FALSE

38.

Find the output

<?php

$x = 5;

{ $x = 10;

echo $x;

}

echo $x;

?>

a)

105

b)

510

c)

1010

39.

find the output

<?php

$x = 1;

$x += 1;


echo $x;

?>

a)

2

b)

1

c)

0

40.

What does PHP stands for?

a)

PHP: Hypertext Preprocessor

b)

Private Home Page

c)

Personal Hypertext Processor

41.

Which among the following is the correct delimiters that surround PHP server scripts?

a)

<?php>...</?>

b)

<script>...</script>

c)

<?php...?>

d)

<&>...</&>

42.

How do you get information from a form that is submitted using the "get" method?

a)

Request.QueryString;

b)

$_GET[];

c)

Request.Form;

43.

When using the POST method, variables are displayed in the URL:

a)

True

b)

False

44.

What is the correct way to add 1 to the $count variable?

a)

$count =+1

b)

$count++;

c)

++count

d)

count++;

45.

How do you create an array in PHP?

a)

$cars = "Volvo", "BMW", "Toyota";

b)

$cars = array["Volvo", "BMW", "Toyota"];

c)

$cars = array("Volvo", "BMW", "Toyota");

46.

The if statement is used to execute some code only if a specified condition is true

a)

True

b)

False

47.

How is PHP written into a webpage?

a)

Just like other html tags: <php> </php>

b)

Only in a separate file which is linked to the html page

c)

Using curled brackets {php} {/php}

d)

A PHP script starts with <?php and ends with ?>

48.

PHP script is parsed....

a)

On the client's web browser

b)

On the server where the website is hosted

c)

On the client's CPU

d)

On the Internet

49.

PHP is case sensitive in what way?

a)

It's never case sensitive, don't worry about it.

b)

Only when referring to variables

c)

When referring to classes, functions or variables

d)

All the time!

50.

When concatenating strings, you use what symbol in PHP?

a)

A comma ,

b)

A plus sign +

c)

a hyphen -

d)

a full stop .

51.

Which statement 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');

52.

The updated MySQL extension with PHP5 is typically referred to as

a)

MySQL

b)

mysql

c)

mysqli

d)

mysqly

53.

Which method returns the error code generated from the execution of the last MySQL function?

a)

errno()

b)

errnumber()

c)

errorno()

d)

errornumber()

54.

Which method is responsible for sending the query to the database?

a)

query()

b)

send_query()

c)

sendquery()

d)

query_send()

55.
How can we get the number of records or rows in a table?
a)
 Using COUNT
b)
Using NUM
c)
 Using NUMBER
d)
Both a and c above
56.
USE keyword is used to select a ____________________
a)
Table
b)
Column
c)
Database
d)
None of the above
57.
Which is the default order of sort in ORDER BY clause?
a)
Ascending
b)
Descending
58.
A relational database  ___________ is a data structure used to store and organize information.
a)
View
b)
Table
c)
Report
d)
Stored Procedure
59.
What is the maximum size of the VARCHAR Column type?
a)
255 char
b)
255 Byte
c)
512 Char
d)
512 Byte
60.
MySQL is
a)
A Programming language
b)
A technique for writing reliable programs
c)
 A Relational Database Management System
d)
None of the Above
61.
What SQL clause is used to restrict the rows returned by a query?
a)
AND
b)
WHERE
c)
HAVING
d)
FROM
62.

Which will input data into a table?

a)

INSERT INTO table(name, height, weight) VALUES('strand', '6ft 2in', '165')

b)

INPUT INTO table(name, height, weight) VALUES('strand', '6ft 2in', '165')

c)

INSERT INTO table CATEGORIES(name, height, weight) VALUES('strand', '6ft 2in', '165')

d)

INSERT INTO table CATEGORIES(name, height, weight) ('strand', '6ft 2in', '165')

63.

If I want to show all data in a MySQL table, I would use

a)

SHOW * FROM table;

b)

SELECT * FROM table;

c)

SHOW * IN table;

d)

SELECT * IN table;

64.

What does PHP stand for?

a)

Preprocessor Hypertext Page

b)

Personal Home Page

c)

Hypertext Transfer Protocol

d)

PHP Hypertext Preprocessor

65.

PHP is considered a server-side scripting language.

a)

True

b)

False

c)

Maybe

d)

I don't know

66.

Which of the following extension is correct for PHP files?

a)

.html

b)

.opp

c)

.php

d)

.pxp

67.

How do you start the PHP scripting block?

a)

<php.....?>

b)

<script .... script>

c)

<?php.... ?php>

d)

<?......?php>

68.

Whitespace is not ignored in PHP?

a)

True

b)

False

c)

Maybe

d)

I don't know

69.

Variables in PHP always begins with...

a)

?

b)

&

c)

$

d)

#

70.

Which of the following is the correct syntax to start a multiple line comment in PHP?

a)

#-----------#

b)

/______/

c)

/*--------*/

d)

/------/*

71.

Which of the following is the correct syntax to declare a variable in PHP?

a)

var = 10;

b)

$var = "10";

c)

$10 = var;

d)

$var = 10

72.

How do you display "Hello World" in PHP?

a)

Hello World;

b)

echo Hello World;

c)

echo (Hello World);

d)

echo "Hello World";

73.

What does a semicolon indicate in PHP?

a)

The end of a PHP statement or instruction.

b)

The start of PHP statement or instruction.

c)

The start of a PHP script block.

d)

The end of the a PHP script block.

74.

Can PHP read html and CSS file?

a)

YES

b)

NO

75.

The MySQLi extension, the 'i' stands for __________.

a)

impress

b)

improved

c)

initial

76.

The 2 basic ways to get output in PHP are __________.

a)

echo and cout

b)

echo and scan

c)

echo and print

77.

PHP syntax start and end with __________.

a)

<? php

//codes here

?>

b)

<? html

//codes here

?>

c)

<? head

//codes here

?>

78.

The default file extension for PHP files is __________.

a)

.html

b)

.php

c)

.css

d)

.java

79.

Where is your PHP project file located?

a)

C:\xampp\htdocs\

b)

C:\xampp\project\

c)

D:\xampp\htdocs\

80.

PHP scripts are executed on the __________.

a)

compiler

b)

browser

c)

server

81.

What is PHP?

a)

PHP: Hyperlink Preprocessor

b)

PHP: Hypertext Preprocessor

c)

PHP: Hyperactive Preprocessor

82.

PHP Scripts are executed using

a)

XAMPP

b)

JAVA

c)

EDITOR

d)

NONE

83.

Arrays are created using

a)

Arrays()

b)

array()

c)

aray()

d)

array[]

84.

What are the two types of array in php

a)

Indexed, sequence

b)

Associative, sequence

c)

Indexed, associative

d)

None

85.

$a=array("Timmy","Jimmy");

Is an example of

a)

Indexed array

b)

Associative array

c)

Sequence array

d)

None

86.

$a=array(10=>"Jimmy",20=>"mummy");

Is an example of

a)

Sequence array

b)

Indexed array

c)

Associative array

d)

None

87.

In php the keyword to be used before function name is

a)

Function

b)

Static

c)

function

d)

FUNCTION

88.

function add()

{

$a=10;

echo $a;}

This is an example for

a)

Call by value

b)

Call by reference

c)

None

d)

Both

89.

function add(&a)

{

$a=10;

echo $a;}

$a=33;

This is an example for

a)

Call by value

b)

Call by reference

c)

Both of the above

d)

None

90.

<?php

function add()

{

global $a=10;

echo $a;

}

add();

$a+=10;

?>

Output is

a)

10

b)

15

c)

20

d)

30

91.

$a="deepan";

$b="Deepan";

if(strcmp($a,$b))

{

echo "equal";

}

else{

echo " not equal";}

Output is

a)

Equal

b)

Not equal

c)

Error

d)

None

92.

$a="IT is favorite department";

$b=sub_string($a,"bes",7,14);

echo $b;

Output is

a)

IT is best department

b)

IT is bes department

c)

Error

d)

IT is favorite department

93.

What is the Output


<?php

$color=red;

echo "$color";

?>

a)

red

b)

$color

c)

No answer

d)

Error

94.

All variables in PHP start with which symbol?

a)

?

b)

$

c)

!

d)

=

95.

PHP Stands for

a)

Personal Home Page

b)

Hypertext processor

c)

Project Heading Page

d)

processor Hypertext programming

96.

PHP is

a)

Server side scripting

b)

Client side scripting

97.

Trace the output

$a = 10;

$A= 25

ECHO "".$a;

(a)  

98.

Which method is more secure send the data to server

a)

post

b)

get

c)

request

d)

none

99.

We create re-usable code blocks by placing them inside?

a)

Variables

b)

Parameters

c)

Code Blocks

d)

Functions

100.

Sometimes we only want certain code to execute if a condition is true. How do we test for that?

a)

Loop

b)

If Statement

c)

Integer

d)

Variable

101.

What if we want a block of code to execute several times?

a)

Use a Variable

b)

Use a Function

c)

Use a Loop

d)

Use a Leap

102.

How do I print out the values of the variable "name" ?

a)

$name;

b)

include $name;

c)

echo $name;

d)

echo $name

103.

In an IF statement we can have 2 conditions tested. Which keyword allows this?

a)

Else

b)

if Else

c)

Else if

d)

OR

104.

Which of the following are comparison operators in PHP?

A. ==

B. !=

C. ===

D. <

a)

A and B

b)

C and D

c)

A,B and C

d)

A,B,C and D

105.

What is the Output?

<?php

#echo "Hello World"

echo "#Hello World";

?>

a)

Hello World #Hello World

b)

Hello World

c)

#Hello World

d)

Error