wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

ITEAPV - Midterm Exam

Total questions: 70

Worksheet time: 35mins

Name
Class
Date
1.

What does PHP stand for?

a)

Preprocessor Hypertext Page

b)

Personal Home Page

c)

Hypertext Transfer Protocol

d)

PHP Hypertext Preprocessor

2.

PHP is considered a server-side scripting language.

a)

True

b)

False

c)

Maybe

d)

I don't know

3.

Which of the following extension is correct for PHP files?

a)

.html

b)

.opp

c)

.php

d)

.pxp

4.

How do you start the PHP scripting block?

a)

<php.....?>

b)

<script .... script>

c)

<?php.... ?php>

d)

<?......?php>

5.

Whitespace is not ignored in PHP?

a)

True

b)

False

c)

Maybe

d)

I don't know

6.

Variables in PHP always begins with...

a)

?

b)

&

c)

$

d)

#

7.

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

a)

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

b)

/______/

c)

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

d)

/------/*

8.

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

9.

How do you display "Hello World" in PHP?

a)

Hello World;

b)

echo Hello World;

c)

echo (Hello World);

d)

echo "Hello World";

10.

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.

11.
How do you write "Hello World" in PHP
a)
echo "Hello World";
b)
Document.Write("Hello World");
c)
"Hello World";
12.
What is the correct way to end a PHP statement?
a)
;
b)
New line
c)
13.
In PHP you can use both single quotes ( ' ' ) and double quotes ( " " ) for strings:
a)
False
b)
True
14.

In PHP, statements may be written in either upper or lowercase. Echo, echo, and ECHO are all the same.

a)

True

b)

False

15.

What is the value of $num if the following code is to consider?

$varName = "num";

$num = 25;

$$varName = 75;

a)

value

b)

25

c)

75

d)

None of the Above

16.

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

a)

Request.QueryString;

b)

$_GET[];

c)

Request.Form;

17.

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

a)

$count =+1

b)

$count++;

c)

++count

d)

count++;

18.

Which one of these variables has an illegal name?

a)

$my-Var

b)

$myVar

c)

$my_Var

19.

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");

20.

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

a)

True

b)

False

21.

When concatenating strings, you use what symbol in PHP?

a)

A comma ,

b)

A plus sign +

c)

a hyphen -

d)

a full stop .

22.
MySQL is
a)
A Programming language
b)
A technique for writing reliable programs
c)
 A Relational Database Management System
d)
None of the Above
23.

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')

24.

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;

25.

What type of language is PHP

a)

Client Side

b)

Server Side

c)

Browser Side

d)

Web Side

26.

PHP is executed on

a)

The Server

b)

The Browser

c)

The Website

d)

The Machine

27.

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

a)

Variables

b)

Parameters

c)

Code Blocks

d)

Functions

28.

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

29.

What is a integer?

a)

It's a Whole Number

b)

It's a Decimal Number

c)

It's a True or False Declaration

d)

It's a String of Text

30.

What is a String?

a)

Text

b)

Number

c)

True

d)

Loop

31.

What is a Boolean

a)

It's Just Text

b)

It's a Number

c)

It's Just True

d)

It's True or False

32.

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

33.

$colours = array("black, blue, Red, Green") - How do I access "Red" ?

a)

$colours[0];

b)

$colours[2];

c)

$colours[1]

d)

$colours[3];

34.

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

a)

$name;

b)

include $name;

c)

echo $name;

d)

echo $name

35.

function sayMyName(name) {} ; - How do I call tat function

a)

sayMyname();

b)

$sayMyName;

c)

$sayMyName();

d)

sayMyName("John")';

36.

What does i++ do ?

a)

Adds the text on to the end of i

b)

Adds i on to the end of something

c)

Adds i on to the existing value of i

d)

Adds 1 to the current value of iThis is a correct answer

37.

What type of variable is this: $isMale = false;

a)

Integer

b)

Boolean

c)

String

d)

char

38.

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

a)

Else

b)

if Else

c)

Else if

d)

OR

39.

$a = 4 ; $b = 6; $c = $a + $b; What is the value of variable "c" ?

a)

6

b)

8

c)

10

d)

None

40.

Find the output

<?php

$x = 5;

{ $x = 10;

echo $x;

}

echo $x;

?>

a)

105

b)

510

c)

1010

41.

find the output

<?php

$x = 1;

$x += 1;


echo $x;

?>

a)

2

b)

1

c)

0

42.

Find the output

<?php

$x = 5;

$y= 10;

echo $x;

echo $y;

?>

a)

105

b)

510

c)

5

10

d)

10

5

43.

$a = 4 ; $b = 6; $c = $a + $b; What is the value of variable "c" ?

a)

6

b)

8

c)

10

d)

None

44.

The * operator belongs to which category of operators?

a)

Arithmetic operator

b)

Logical operator

c)

Comparison operator

d)

Conditional operator

45.

What is the Output


<?php

$color=red;

echo "$color";

?>

a)

red

b)

$color

c)

No answer

d)

Error

46.

PHP is a ............

a)

Open Source Language

b)

Widely Used Language

c)

Server side scripting language

d)

All of the above

47.

Which one of the following statements is used to create a table?

a)

CREATE TABLE table_name (column_type column_name);

b)

CREATE table_name (column_type column_name);

c)

CREATE TABLE table_name (column_name column_type);

d)

CREATE table_name (column_name column_type);

48.

What will be the output of the following program?

<?php

$a = 15;

function show() {

$a = 20; echo "$a";

}

show();

echo "$a";

?>

a)

2020

b)

2015

c)

1515

d)

0

49.

What will be the output of the following program?

<?php  

$var1 = "Hello";  

$var2 = "World";  

echo "$var1$var2";  

?>

a)

HelloWorld

b)

Hello World

c)

"$var1$var2"

d)

None of the above

50.

<?php

$sum= 15+30;

echo "$sum";

?>

The Correct output is ...

a)

Error

b)

15+30

c)

45

d)

No Answer

51.

<?php

for ($x=1; $x<=10; $x++){

echo "$x ";

}

?>

the output is ...

a)

1 2 3 4 5 6 7 8 9 10

b)

10 9 8 7 6 5 4 3 2 1

c)

5 6 7 8 9 10

d)

No answer

52.

PHP Scripts are executed using

a)

XAMPP

b)

JAVA

c)

EDITOR

d)

NONE

53.

What is the correct output of the given code <?php

$NUM1 = 3;

$NUM2 = 4;

$NUM3 = $NUM1 ** $NUM2;

echo $NUM3;

?>

a)

12

b)

81

c)

Garbage Value

d)

None of the above

54.

Why is validation important in web development?

a)

To improve the visual design of web pages.

b)

To ensure that the user input meets the specified criteria and is safe to process.

c)

To increase the loading speed of the website.

d)

To store data in the database.

55.

What is the primary role of a database in web applications?

a)

To generate HTML and CSS code.

b)

To authenticate users logging into the system.

c)

To store, retrieve, and manage data efficiently.

d)

To process and execute client-side scripts.

56.

Why do you need a database connection in PHP?

a)

To link CSS files to HTML.

b)

To enable communication between PHP scripts and the database.

c)

To write JavaScript code.

d)

To validate user input.

57.

What is the purpose of the INSERT statement in SQL?

a)

To create new tables in the database.

b)

To modify the structure of the database.

c)

To add new records to a table.

d)

To change the credentials of the database user.

58.

What would you typically use to view and retrieve data from a database in a PHP application?

a)

INSERT SQL command.

b)

CSS selectors.

c)

SELECT SQL query.

d)

PHP echo statement alone.

59.

In the context of web applications, what is the difference between editing and updating?

a)

Editing refers to changing the content on the website, and updating refers to reloading the page.

b)

Editing involves modifying data in the database, while updating refers to the process of saving those changes.

c)

Editing is done on the client side, while updating is a server-side operation.

d)

There is no difference; both terms mean the same thing.

60.

What does the DELETE statement do in SQL?

a)

Deletes the entire database.

b)

Removes specific records from a table based on a condition.

c)

Deletes the structure of the table.

d)

Clears the data from a form.

61.

In PHP, when would you use a foreach loop?

a)

To execute a block of code a set number of times.

b)

To loop through each key/value pair in an array.

c)

To check the validity of user input.

d)

To connect to a database.

62.

What is a common method to implement a search feature in a PHP application?

a)

Using a WHILE loop to iterate through all elements of a page.

b)

Using a SELECT query with a WHERE clause to filter results from a database.

c)

Using the INSERT command to add search terms to the database.

d)

Using CSS to hide non-matching elements on a page.

63.

What is the primary purpose of implementing a login feature in a web application?

a)

To collect user emails.

b)

To provide users with the ability to customize the website's theme.

c)

To restrict access to certain parts of the application to authenticated users.

d)

To store user preferences for the layout of the web pages.

64.

In PHP, what is the purpose of using sessions?

a)

To improve the website's SEO.

b)

To permanently store user information on the server.

c)

To maintain information across different pages during a user's visit to a website.

d)

To create new users in the database.

65.

What does the isset() function check for when dealing with form buttons in PHP?

a)

If a variable has a value that is not NULL.

b)

If the button has been clicked or not.

c)

If a session has been started.

d)

If a button exists in the HTML form.

66.

What is the purpose of .htaccess files on web servers?

a)

To store HTML templates for the website.

b)

To configure server settings, like URL redirection and access control for directories.

c)

To create backup copies of website files.

d)

To store JavaScript variables.

67.

What does the term "navigation technique" refer to in web design?

a)

The method used to move data from server to client.

b)

The algorithm used to sort database entries.

c)

The strategy for moving between different webpages or sections on a website.

d)

The process of uploading files to the server.

68.

An "upgraded session" mechanism in PHP could include what?

a)

Shorter session times for better performance.

b)

Use of session variables to maintain stateful information across multiple pages with enhanced security measures.

c)

The elimination of sessions in favor of cookies only.

d)

Storing all user data in session variables to avoid database use.

69.

What is the primary consideration when implementing a file upload feature in a web application?

a)

Allowing all file types to be uploaded without restrictions.

b)

Ensuring that uploaded files do not exceed the maximum server capacity.

c)

Security measures to prevent the upload of malicious files.

d)

Ensuring the uploaded files are publicly accessible for all users.

70.

In a web form, how is a checkbox typically used?

a)

To allow users to select only one option from a set of mutually exclusive options.

b)

To submit the form automatically without clicking a submit button.

c)

To allow users to select multiple options from a set of choices.

d)

To display a dropdown list of options for users to choose from.