wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

PHP-Midterm Exam

Total questions: 60

Worksheet time: 3600secs

Name
Class
Date
1.

Which PHP function is used to execute SQL queries?

a)

mysqli_query()

b)

mysql_query()

c)

pdo_query()

d)

sql_query()

2.

It is a collection of 1024 Terabytes

a)

Exabyte

b)

Petabyte

c)

Zettabyte

d)

Yottabyte

3.

Which of the following is used to retrieve data from a MySQL database?

a)

mysqli_fetch_array()

b)

mysql_fetch_all()

c)

pdo_fetch_all()

d)

mysqli_query()

4.

Which of the following is used to establish a connection to a MySQL database?

a)

mysqli_connect()

b)

mysql_connect()

c)

pdo_connect()

d)

sql_connect()

5.

Which of the following is used to initialize your session?

a)

session_close()

b)

session_start()

c)

session_unset()

d)

session_destroy()

6.

Which of the following is used to retrieve the number of rows in a result set?

a)

mysqli_num_rows()

b)

mysql_num_rows()

c)

pdo_num_rows()

d)

sql_num_rows()

7.

Which SQL statement is used to extract data from a database?

a)

SELECT

b)

INSERT

c)

UPDATE

d)

DELETE

8.

Which SQL statement is used to insert new data in a database?

a)

INSERT INTO

b)

INSERT NEW

c)

INSERT VALUE

d)

ADD NEW

9.

It is a collection of bytes in Database

a)

Field

b)

Bit

c)

Record

d)

File

10.

What is the total number of rows in MS Excel 2016 or 2019

a)

1,048,576

b)

16,384

c)

255

d)

31

11.

With SQL, how do you select all the records from a table named "Persons" where the value of the column "FirstName" is "Peter"?

a)

SELECT [all] FROM Persons WHERE FirstName LIKE 'Peter'

b)

SELECT * FROM Persons WHERE FirstName='Peter'

c)

SELECT [all] FROM Persons WHERE FirstName='Peter'

d)

SELECT * FROM Persons WHERE FirstName<>'Peter'

12.

With SQL, how do you select all the records from a table named "Persons" where the value of the column "FirstName" starts with an "a"?

a)

SELECT * FROM Persons WHERE FirstName='a'

b)

SELECT * FROM Persons WHERE FirstName LIKE 'a%'

c)

SELECT * FROM Persons WHERE FirstName='%a%'

d)

SELECT * FROM Persons WHERE FirstName LIKE '%a'

13.

What is the number of columns in MS Excel 2016 or 2019?

a)

16,384

b)

1,048,576

c)

8192

d)

31

14.

What is the official mySQL logo?

a)

Sakila

b)

Sakira

c)

BonJov

d)

MariaDB

15.

Which SQL keyword is used to sort the result-set?

a)

ORDER

b)

SORT BY

c)

ORDER BY

d)

SORT

16.

With SQL, how can you return all the records from a table named "Persons" sorted descending by "FirstName"?

a)

SELECT * FROM Persons ORDER BY FirstName DESC

b)

SELECT * FROM Persons SORT BY 'FirstName' DESC

c)

SELECT * FROM Persons SORT 'FirstName' DESC

d)

SELECT * FROM Persons ORDER FirstName DESC

17.

With SQL, how can you insert "Olsen" as the "LastName" in the "Persons" table?

a)

INSERT INTO Persons (LastName) VALUES ('Olsen')

b)

INSERT ('Olsen') INTO Persons (LastName)

c)

INSERT INTO Persons ('Olsen') INTO LastName

18.

The NOT NULL constraint enforces a column to not accept NULL values.

a)

True

b)

False

19.

Which operator is used to search for a specified pattern in a column?

a)

FROM

b)

LIKE

c)

GET

20.

What does PHP stands for?

a)

PHP: Hypertext Preprocessor

b)

Private Home Page

c)

Personal Hypertext Processor

21.

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

a)

<?php>...</?>

b)

<script>...</script>

c)

<?php...?>

d)

<&>...</&>

22.

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

a)

Request.QueryString;

b)

$_GET[];

c)

Request.Form;

d)

$_POST[];

23.

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

a)

True

b)

False

24.

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

a)

True

b)

False

25.

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 ?>

26.

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

27.

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!

28.

When concatenating strings, you use what symbol in PHP?

a)

A comma ,

b)

A plus sign +

c)

a hyphen -

d)

a period .

29.

The updated MySQL extension with PHP5 is typically referred to as

a)

MySQL

b)

mysql

c)

mysqli

d)

mysqly

30.

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

a)

query()

b)

send_query()

c)

sendquery()

d)

query_send()

31.
A relational database  ___________ is a data structure used to store and organize information.
a)
View
b)
Table
c)
Report
d)
Stored Procedure
32.
What is the maximum size of the VARCHAR Column type?
a)
255 char
b)
255 Byte
c)
512 Char
d)
512 Byte
33.
MySQL is
a)
A Programming language
b)
A technique for writing reliable programs
c)
 A Relational Database Management System
d)
None of the Above
34.
What SQL clause is used to restrict the rows returned by a query?
a)
AND
b)
WHERE
c)
HAVING
d)
FROM
35.

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

36.

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;

37.

A collection of interrelated files is

a)

Database

b)

File

c)

Record

d)

Byte

38.

Which of the following can add a row to a table?

a)

Add

b)

Insert

c)

Update

d)

Alter

39.

What does SQL stand for?

a)

Structured Query Language

b)

Structured Question Language

c)

Strong Question Language

d)

None of the above

40.

SQL is not case sensitive. SELECT is the same as select.

a)

TRUE

b)

FALSE

41.

Which SQL Select special character used to refer to all columns?

a)

*

b)

/

c)

**

d)

()

42.

With SQL, how do you select all the columns from a table named "Persons"?

a)

SELECT * FROM Persons

b)

SELECT Persons

c)

SELECT [all] FROM Persons

d)

SELECT *.Persons

43.

SQL can be used to:

a)

Create database structures only.

b)

Query database data only.

c)

Modify database data only.

d)

All of the above can be done by SQL.

44.

Which clause is used to “Filters out unwanted data”?

a)

FROM

b)

SELECT

c)

ORDER BY

d)

WHERE

45.

Which is the default order of sort in ORDER BY clause?

a)

Ascending

b)

Descending

46.

Write a query to display first_name and last_name of all employees who have their first_name starting with 'A'.

a)

Select first_name from employess where first_name, last_name LIKE '%A';

b)

Select first_name from employess where first_name, last_name LIKE "'A'%";

c)

Select first_name, last_name from employess where first_name LIKE 'A%';

d)

Select first_name from employess where first_name, last_name LIKE '%A%';

47.

It is said that the web operates on a ______ model, where the client is the web browser and the server is the computer providing, or serving, the information.

a)

client-server

b)

peer-to-peer

c)

business

d)

website

48.

A ______ is special software that knows how to open and interpret web pages. Web browsers also know how to contact web servers to get information.

a)

web server

b)

webinar

c)

web browser

d)

static web

49.

A _______ is special software that knows how to respond to requests for web pages.

a)

web browser

b)

web server

c)

web client

d)

web database

50.

What is HTML stands for?

a)

Hyperlink Transfer Protocol

b)

Hypertext Transfer Protocol

c)

How To Make Lumpia

d)

Hypertext Transfer Potocol

51.

_______ is a popular and powerful language used for programming server-side programs

a)

CSS

b)

HTML

c)

Mysql

d)

PHP

52.

______ is a popular and free database system that can store information and then integrate with PHP to create a fully functional web application.

a)

mySQL

b)

MS ACCESS

c)

Logbook

d)

MSQL

53.

To hold data, you use a variable, which keeps track of the data that you tell it to store for the lifetime of your program.

a)

TRUE

b)

FALSE

54.

______are expressions that PHP tests or evaluates to see whether they are true or false.

a)

Looping

b)

Switch

c)

Conditions

d)

Break

55.

A data stored in the end-user computer

a)

session

b)

cookies

c)

tmp

d)

database

56.

PHP Cookies is more secure than PHP Session

a)

TRUE

b)

FALSE

57.

A ______ is a way to store information (in variables) to be used across multiple pages.

a)

Post

b)

Session

c)

Server

d)

Meta

58.

This function used to include the code contained in a PHP file within another PHP file event program has script errors

a)

require()

b)

join()

c)

include()

d)

associate()

59.

Which function used to output a message and terminate the current script?

a)

stop()

b)

exit()

c)

end()

d)

session_close()

60.

One of the founders of mySQL

a)

Michael Widenius

b)

Dennis Ritchie

c)

Rasmus Lerdorf

d)

Allan Manio