wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Day 1 PHP

Total questions: 15

Worksheet time: 8mins

Name
Class
Date
1.

Which of the following statements regarding PHP is untrue?

a)

PHP is an open-source scripting language.

b)

PHP code can run only on Windows servers.

c)

PHP is a loosely typed language.

d)

PHP scripts can access databases.

2.

What is the full form of PHP?

a)

Personal Home Page

b)

PHP Hypertext Preprocessor

c)

Preprocessed Hypertext Processor

d)

Programming Hypertext Processor

3.

Which of the subsequent PHP versions entered the OOP stage?

a)

PHP 3

b)

PHP 4

c)

PHP 5

d)

PHP 7

4.

Which of the following statements is NOT correct regarding PHP?

a)

Execution independent of the platform

b)

Supports procedural and object-oriented paradigms

c)

It needs to be compiled before it gets executed

d)

Can be embedded within HTML

5.

What happens when a client requests a PHP page for the first time?

a)

The PHP code is executed on the client end.

b)

The browser directly receives the PHP code.

c)

The web server processes the PHP code and returns it as an HTML response.

d)

The PHP script is loaded and then transformed into machine code before its execution.

6.

Which of the following is the correct way to start a PHP script?

a)
b)

c)

{php} … {/php}

d)
7.

Correct method to end a PHP statement:

a)

. (dot)

b)

, (comma)

c)

; (semicolon)

d)

: (colon)

8.

How do you do it correctly with respect to embedding PHP code into an HTML file?

a)

Using tags

b)

Using {php} … {/php} syntax

c)

Using inside the HTML file

d)

Using comments

9.

Which of the following PHP statements is true?

a)

All PHP statements must be enclosed within curly braces {}

b)

Statements of PHP must be in uppercase letters to signify a statement

c)

PHP statements are case sensitive

d)

Statement in PHP does not need a semicolon at the end

10.

What is the correct syntax for a multi-line comment in PHP?

a)

// This is a multi-line comment

b)

/* This is a multi-line comment */

c)

# This is a multi-line comment

d)
11.

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

a)

$myVar = 10;

b)

int $myVar = 10;

c)

var $myVar = 10;

d)

$10myVar = "hello";

12.

Which of the following variable names is valid in PHP?

a)

$123var

b)

$var_123

c)

$_my-var

d)

varName$

13.

How constant value is defined in PHP?

a)

define("MY_CONST", "value");

b)

const MY_CONST = "value";

c)

Both a and b

d)

None of the above

14.

What is the purpose of the 'echo' statement in PHP?

a)

To output data to the screen

b)

To declare a variable

c)

To create a function

d)

To include a file

15.

What will be the output of this PHP statement?

echo 2 ** 3 ** 2;


a)

64

b)

512

c)

9

d)

81