wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

WebApp (Webdev2)

Total questions: 108

Worksheet time: 2hrs 4mins

Name
Class
Date
1.

it is a popular open-source scripting language.

(a)  

2.

PHP was created in 1994 by ________, and around the 2000s it became very famous because of its simplicity.

a)

Rasmus Lerdorf

b)

Randolf Espejo

c)

Anders Hejlsberg

d)

James Gosling

3.

When was PHP created?

a)

1994

b)

1984

c)

1974

d)

2004

4.

What's the name of popular social media, that uses PHP as it’s one of the back-end languages. And it was originally coded on PHP

a)

twitter

b)

instagram

c)

facebook

d)

viber

5.

A PHP file can contain HTML + PHP code combined. It can practically be just an HTML document.

a)

True

b)

False

6.

To output something in PHP, we can use either (a)   or print.

7.

___________are faster to be translated but it doesn’t really matter nowadays. It does not do string interpolation.

a)

Single quotes

b)

Double quotes

8.

Code use to have Line Breaks.

a)

<br/>

b)

<nl2br/>

c)

<p>

d)

<snr/>

9.

Variables should start with ____ - This is the legacy of Perl.

a)

?

b)

&

c)

$

d)

#

10.

Variables have no types.

a)

True

b)

False

11.

Arrays cannot be mixed in PHP.

a)

True

b)

False

12.

What function can we use in inspecting an Array?

a)

var_dump

b)

fopen()

c)

fread()

d)

abs()

13.

What kind of Arrays is this?

$cars = array(‘honda’ => 50500, ‘toyota’=>40700, ‘mazda’ =>60300)

a)

Associative Arrays

b)

Multidimensional Arrays

14.

What kind of Arrays is this?

$cars = array(“expensive” => array(), “inexpensive” =>array())

echo $cars[“inexpensive”][2]

a)

Associative Arrays

b)

Multidimensional Arrays

15.

Which of the following is an Arithmetic Operator?

a)

%

b)

+=

c)

===

d)

<==>

16.

Which of the following is an Assignment Operator?

a)

-

b)

-=

c)

>

d)

<==>

17.

Which of the following is a Comparison Operator?

a)

+=

b)

<==>

c)

===

d)

%

18.

Which of the following is a Spaceship Operator?

a)

/

b)

*=

c)

<=

d)

<==>

19.

Which of the following is a Logical Operator?

a)

<==>

b)

||

c)

==

d)

%=

20.

It allows us to re-order the applications of XOR so that the duplicated elements are next to each other. Since x ^ x = 0 and a ^ 0 = a, each pair of duplicated values has no effect on the outcome.

a)

Formatting

b)

Associative

c)

Commutativity

d)

Temp

21.

Which of the following is a Pre-Increment Operator?

a)

$x--

b)

--$x

c)

$x++

d)

++$x

22.

Which of the following is a Post-Increment Operator?

a)

$x--

b)

$x++

c)

++$x

d)

--$x

23.

Which of the following is a Pre-Decrement Operator?

a)

++$x

b)

$x++

c)

$x--

d)

--$x

24.

Which of the following is a Post-Decrement Operator?

a)

++$x

b)

$x++

c)

--$x

d)

$x--

25.

Incrementing null results in __?

a)

1

b)

- 1

c)

0

d)

2

26.

Incrementing an empty string results in __ ?

a)

- 1

b)

1

c)

0

d)

+ 1

27.

Incrementing a string will result in the last character shifted to __ ?

a)

1

b)

0

c)

- 1

d)

+1

28.

Classic alternative to the if-elseif condition:

a)

Switch statement

b)

While Loop

c)

Do-while Loop

d)

For Loop

29.

What do you call this format?

a)

if-else if condition

b)

if-else condition

c)

if condition

d)

Switch Statement

30.

What do you call this format?

a)

if condition

b)

if-else condition

c)

if-else if condition

d)

Switch Statement

31.

What do you call this kind of Looping?

a)

While Loop

b)

Do-while Loop

c)

For Loop

d)

foreach loop

32.

What do you call this kind of Looping?

a)

While Loop

b)

Do-while Loop

c)

For Loop

d)

Foreach Loop

33.

What do you call this kind of Looping?

a)

While Loop

b)

Do-While Loop

c)

For Loop

d)

Foreach Loop

34.

What do you call this kind of Looping?

a)

While Loop

b)

Do-While Loop

c)

For Loop

d)

Foreach Loop

35.

is a block of code written in a program to perform some specific task.

a)

Scope

b)

Function

c)

Argument

d)

Parameter

36.

Two major types of function:

a)

Built-in function

b)

User-defined function

c)

Temp

d)

Chore Function

37.

Why use functions?

a)

Reusability

b)

Easy for error detection

c)

Maintenance

d)

Fancy Code

38.

What are the three major coding standards when creating functions? (and variables for that matter)

a)

Camel Case

b)

Lowercase and underscores

c)

Pascal case

d)

Uppercase and underscores

39.

It is the variable used to hold the value.

a)

Parameters

b)

Arguments

c)

Function

d)

Constant

40.

It is the value passed to the function.

a)

Parameters

b)

Arguments

c)

Function

d)

Constant

41.

The original value passed to the function gets copied. Any changes to the value do not affect the original value. (This is the default behavior.)

a)

Pass by Value

b)

Pass By Reference

42.

The argument becomes an alias to the original argument. Any changes to the value get reflected on the original variable.

a)

Pass by Value

b)

Pass by Reference

43.

This is an example of Passing by _____?

a)

Value

b)

Reference

44.

Variable as subject to scope.

a)

True

b)

False

45.

A scope is indicated by the ___ block.

a)

{ }

b)

[ ]

c)

( )

d)

< >

46.

Variables are declared inside a {} is what we called?

a)

Local

b)

Global

c)

International

d)

Inter-global

47.

It is a name or an identifier for a fixed value.

a)

Constants

b)

Arguments

c)

Parameters

d)

Function

48.

What are the two ways to create - define or const?

a)

define(“IDENTIFIER_NAME”, value);

b)

const MY_COURSE = “BSIS2”;

c)

define(“IDENTIFIER_NAME”, echo);

d)

const MY_COURSE = printF;

49.

What do you call this kind of syntax?

include ‘/path/file.php’

a)

Including Documents

b)

Excluding Documents

c)

Requiring Documents

d)

Referring Documents

50.

What do you call this kind of syntax?

require ‘/path/file.php’

a)

Include

b)

Required

c)

Exclude

d)

Referred

51.

(Include vs Require)

It will just print a warning if the file is not found

a)

Required

b)

Include

52.

(Include vs Require)

It will throw an error if the file is not found.

a)

Require

b)

Include

53.

Built-in function for Length:

a)

ucwords($str)

b)

strpos($email, “@”);

c)

strlen($str)

d)

str_word_count($str)

54.

Built-in function for Word Count:

a)

ucwords($str)

b)

trlen($str)

c)

str_word_count($str)

d)

strpos($email, “@”);

55.

Built-in function for Finding Text within a string:

a)

strlen($str)

b)

str_word_count($str)

c)

strpos($email, “@”);

d)

ucwords($str)

56.

Built-in function for Capitalize first letter:

a)

strlen($str)

b)

str_word_count($str)

c)

strpos($email, “@”);

d)

ucwords($str)

57.

Built-in function for Uppercase everything:

a)

ucwords($str)

b)

str_word_count($str)

c)

strtoupper($str)

d)

strtolower($str)

58.

Built-in function for Lowercase everything:

a)

strlen($str)

b)

str_word_count($str)

c)

strtoupper($str)

d)

strtolower($str)

59.

Built-in function for Removing leading and trailing space:

a)

ucwords($str)

b)

trim($str)

c)

strlen($str)

d)

strtolower($str)

60.

What is this built-in function for?

ceil (0.5)

a)

Rounds up to the nearest integer

b)

Rounds down to the nearest integer

c)

Round according to math logic

d)

Exponentiation

61.

What is this built-in function for?

floor(0.50)

a)

Rounds up to the nearest integer

b)

Rounds down to the nearest integer

c)

Round according to math logic

d)

Exponentiation

62.

What is this built-in function for?

round(0.54335, 2)

a)

Rounds up to the nearest integer

b)

Rounds down to the nearest integer

c)

Round according to math logic

d)

Exponentiation

63.

What is this built-in function for?

exp($num)

a)

Rounds up to the nearest integer

b)

Rounds down to the nearest integer

c)

Round according to math logic

d)

Exponentiation

64.

What is this syntax for?

A. $arr1 = array(“firstname”=>”jasper”)

B. $arr2 = array(“lastname”=>”rebong)

C. $all = array_merge($arr1, $arr2)

a)

Merging arrays

b)

Get only the keys of an associative array

c)

Get only the values

d)

Insert element to the last index

65.

What is this built-in function for?

array_keys($arr)

a)

Get only the keys of an associative array

b)

Get only the values

c)

Insert element to the last index

d)

Searching inside an array

66.

What is this built-in function for?

array_values($arr)

a)

Get only the keys of an associative array

b)

Get only the values

c)

Insert element to the last index

d)

Searching inside an array

67.

What is this built-in function for?

array_push($arr, $value)

a)

Count the number of items in an array

b)

Search for a value inside an array

c)

Insert element to the last index

d)

Searching inside an array

68.

What is this built-in function for?

array_search(“key”, $array)

(it returns the index)

a)

We can get the minimum and maximum

b)

Count the number of items in an array

c)

Search for a value inside an array

d)

Searching inside an array

69.

What is this built-in function for?

in_array(key, array)

(it returns a boolean value)

a)

Get the last value of the array

b)

Searching inside an array

c)

Search for a value inside an array

d)

Count the number of items in an array

70.

What is this built-in function for?

count($array)

a)

Get only the values

b)

Get only the keys of an associative array

c)

We can get the minimum and maximum

d)

Count the number of items in an array

71.

Built-in function that can get the minimum and maximum value of an Array.

a)

min() and max()

b)

sml() and big()

c)

sml() and lrg()

d)

mine() and yrs()

72.

Built-in function that can Get the last value of the array.

a)

lastValue()

b)

last()

c)

end()

d)

endVal()

73.

How to create this format?

March 31, 2022, 7:03 pm

a)

$today = date("F j, Y, g:i a");

b)

$today = date("m.d.y");

c)

$today = date("j, n, Y");

d)

$today = date("Ymd");

74.

How to create this format?

03.31.22

a)

$today = date("F j, Y, g:i a");

b)

$today = date("m.d.y");

c)

$today = date("j, n, Y");

d)

$today = date("Ymd");

75.

How to create this format?

31, 3, 2022

a)

$today = date("F j, Y, g:i a");

b)

$today = date("m.d.y");

c)

$today = date("j, n, Y");

d)

$today = date("Ymd");

76.

How to create this format?

20220331

a)

$today = date("F j, Y, g:i a");

b)

$today = date("Ymd");

c)

$today = date("j, n, Y");

d)

$today = date("m.d.y");

77.

How to create this format?

12-27-18, 31-03-22, 1631 1618 6 Satpm01

a)

$today = date('H:m:s \m \i\s\ \m\o\n\t\h');

b)

$today = date("D M j G:i:s T Y");

c)

$today = date('\i\t \i\s \t\h\e jS \d\a\y.');

d)

$today = date('h-i-s, j-m-y, it is w Day');

78.

How to create this format?

it is the 31th day.

a)

$today = date("H:i:s");

b)

$today = date('H:m:s \m \i\s\ \m\o\n\t\h');

c)

$today = date("D M j G:i:s T Y");

d)

$today = date('\i\t \i\s \t\h\e jS \d\a\y.');

79.

How to create this format?

Sat Mar 10 17:16:18 MST 2001

a)

$today = date('\i\t \i\s \t\h\e jS \d\a\y.');

b)

$today = date("Y-m-d H:i:s");

c)

$today = date("D M j G:i:s T Y");

d)

$today = date("F j, Y, g:i a"); 

80.

How to create this format?

17:03:18 m is month

a)

$today = date("Y-m-d H:i:s");

b)

$today = date('H:m:s \m \i\s\ \m\o\n\t\h');

c)

$today = date("j, n, Y");

d)

$today = date("H:i:s");

81.

How to create this format?

12:32:18

a)

$today = date("D M j G:i:s T Y");

b)

$today = date("Y-m-d H:i:s");

c)

$today = date("F j, Y, g:i a");

d)

$today = date("H:i:s");

82.

How to create this format?

2001-03-10 17:16:18 (the MySQL DATETIME format)

a)

$today = date("D M j G:i:s T Y");

b)

$today = date('H:m:s \m \i\s\ \m\o\n\t\h');

c)

$today = date("Y-m-d H:i:s");

d)

$today = date("H:i:s");

83.

Since a webpage is can be accessed anywhere in the world, the date-time values can be different for each user.

We can set the default timezone and force the system to be consistent.

just type this:

date_default_timezone_set(‘Europe/Amsterdam’)

to be familiarized.

4 lines
84.

The standard random number generator is ____ - it generates between 0 and MAXINT

a)

rand()

b)

math()

c)

brand()

d)

int()

85.

The maximum number can be retrieved using ______?

a)

getrandmax()

b)

rand(1,10)

c)

rand(max)

d)

rand(randmax)

86.

The syntax for passing arguments will enable us to generate a random number between 2 values.

a)

rand(1,10)

b)

math(randNum)

c)

rand($int)

d)

rand(max)

87.

What is this for?

header(“location: location2.php”)

a)

To forward a page to a new location

b)

To test if a variable is declared but is not null

c)

Get only the keys of an associative array

d)

Insert element to the last index

88.

What is this for?

isset()

a)

To test if a variable is declared but is not null

b)

To forward a page to a new location

c)

To backward a page to a new location

d)

To test if a argument is declared but is not null

89.

__________are global variable that is provided by the system

They are available from any part of our code

Mainly used to store and get data from one page to another

a)

Superglobals

b)

Inter-global

c)

global

d)

Local

90.

What method is used in these lines of code? (it means that the data will not be visible to others.)

a)

Post

b)

Get

c)

Session

d)

Cookie

91.

What method is used in these lines of code? (It means that the data will not be visible to others or the data will be visible in the URL string. DO NOT USE THIS METHOD WHEN SUBMITTING A PASSWORD)

a)

Post

b)

Get

c)

Session

d)

Cooki

92.

- Used to store data in the server.

- It is good to use for sensitive data

- It exists as long as the same browser is open. It ends when the browser is closed.

a)

Session

b)

Cookie

c)

Get

d)

Post

93.

How to start a session?

a)

session_start()

b)

start(session)

c)

_startsession()

d)

start_session()

94.

What is this code for?

a)

 to start a session

b)

to store information - using the $_SESSION superglobal.

c)

To stop a session

95.

What is this code for?

session_destroy()

a)

to start a session

b)

to store information

c)

To stop a session

96.

Small file that the webserver stores in the client computer.

a)

Cookie

b)

Session

c)

Post

d)

Get

97.

How to set the cookie data we use one function.

a)

setcookie()

b)

cookie()

c)

cookieset()

d)

set(cookie)

98.

session_detroy use to stop Cookie.

a)

False

b)

True

99.

What is this code use for?

a)

To expire a cookie, that needs to pass a time value that is in the past.

b)

To stop a cookie, that needs to pass a time value that is in the past

c)

To create a cookie, that needs to pass a time value that is in the past

d)

To deploy a cookie, that needs to pass a time value that is in the past

100.

What is this code use for?

a)

to upload files via PHP

b)

to download files from PHP

c)

to delete files via PHP

d)

to update files via PHP

101.

What is this code for?

echo $_FILES[‘file’][‘name’];

a)

Show us the filename

b)

Show us the file type (jpg, etc)

c)

Show us the file path where it is saved

d)

0 if there is error, 1 if there is error

102.

What is this code for?

echo $_FILES[‘file’][‘type];

a)

Show us the filename

b)

Show us the file type (jpg, etc)

c)

Show us the file path where it is saved

d)

 0 if there is error, 1 if there is error

103.

What is this code for?

echo $_FILES[‘file’][‘tmp_name];

a)

Show us the filename

b)

Show us the file type (jpg, etc)

c)

Show us the file path where it is saved

d)

0 if there is error, 1 if there is error

104.

What is this code for?

echo $_FILES[‘file’][‘error];

a)

Show us the filename

b)

Show us the file type (jpg, etc)

c)

Show us the file path where it is saved

d)

0 if there is error, 1 if there is error

105.

What is this code use for?

a)

Create and Write to a File

b)

Update and Write to a File

c)

Read and Write to a File

d)

Delete and Write to a File

106.

What is this code used for?

$fn = file_get_contents(“path/filename”);

echo $fn;

a)

Read from File

b)

Create and Write to a File

c)

Delete from File

d)

Update from File

107.

What is this code used for?

a)

to create a a form to append to a file

b)

Read from File

c)

Read from File line by line

d)

File Details

108.

The Form Processor

(wala lang pinakita ko lang, titigan mo ng 3 mins. tas magsulat ka ng kahit ano jan)

4 lines