wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

JavaScript and PHP Quiz

Total questions: 24

Worksheet time: 30mins

Name
Class
Date
1.

Which of the following explains correctly what happens when a JavaScript program is developed on a Unix Machine?

a)

will work perfectly well on a Windows Machine

b)

will be displayed as JavaScript text on the browser

c)

will throw errors and exceptions

d)

must be restricted to a Unix Machine only

2.

Which is a more efficient JavaScript code snippet?

a)

Code 1

b)

Code 2

c)

Both Code 1 and Code 2

d)

Cannot Compare

3.

What will be the output of the following JavaScript code?

4 lines
4.

Which of the following is the correct way to add a comment in PHP code?

a)

#

b)

//

c)

/* */

d)

All of the mentioned

5.

Which of the following is the default file extension of PHP files?

a)

.php

b)

.ph

c)

.xml

d)

.html

6.

How to define a function in PHP?

a)

functionName(parameters) {function body}

b)

function {function body}

c)

function functionName(parameters) {function body}

d)

data type functionName(parameters) {function body}

7.

What will be the output of the following PHP code?

4 lines
8.

Which is the right way of declaring a variable in PHP?

a)

$3hello

b)

$_hello

c)

$this

d)

$5_Hello

9.

What will be the output of the following PHP program?

4 lines
10.

What will be the output of the following PHP program?

4 lines
11.

Which of the following PHP functions can be used for generating unique ids?

a)

md5()

b)

uniqueid()

c)

mdid()

d)

id()

12.

In the following PHP program, what is/are the properties?

a)

function sample()

b)

echo “This is an example”;

c)

public $name;

d)

class Example

13.

What will be the output of the following PHP code?

4 lines
14.

A function in PHP which starts with __ (double underscore) is known as __________

a)

Default Function

b)

User Defined Function

c)

Inbuilt Function

d)

Magic Function

15.

How many functions does PHP offer for searching and modifying strings using Perl-compatible regular expressions.

a)

10

b)

7

c)

8

d)

9

16.

Which of the following web servers are required to run the PHP script?

a)

Apache and PHP

b)

IIS

c)

XAMPP

d)

Any of the mentioned

17.

What will be the output of the following PHP code snippet?

4 lines
18.

Which of the following PHP functions can be used to get the current memory usage?

a)

memory_get_usage()

b)

memory_get_peak_usage()

c)

get_peak_usage()

d)

get_usage()

19.

Which one of the following PHP function is used to determine a file’s last access time?

a)

filetime()

b)

fileatime()

c)

fileltime()

d)

filectime()

20.

What is PHP?

a)

PHP is an open-source programming language

b)

PHP is used to develop dynamic and interactive websites

c)

PHP is a server-side scripting language

d)

All of the mentioned

21.

Who is the father of PHP?

a)

Drek Kolkevi

b)

Rasmus Lerdorf

c)

Willam Makepiece

d)

List Barely

22.

What does PHP stand for?

a)

PHP stands for Preprocessor Home Page

b)

PHP stands for Pretext Hypertext Processor

c)

PHP stands for Hypertext Preprocessor

d)

PHP stands for Personal Hyper Processor

23.

Which of the following is the correct syntax to write a PHP code?

4 lines
24.

Which of the following is the correct way to add a comment in PHP code?

a)

#

b)

//

c)

/* */

d)

All of the mentioned