wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

MySQL & PHP Basic MCQs

Total questions: 20

Worksheet time: 7mins

Name
Class
Date
1.

Which command is used to create a new database?

a)

CREATE NEW DATABASE dbname;

b)

MAKE DATABASE dbname;

c)

CREATE DATABASE dbname;

d)

ADD DATABASE dbname;

2.

Which command is used to remove a database?

a)

DROP DATABASE dbname;

b)

DELETE DATABASE dbname;

c)

REMOVE DATABASE dbname;

d)

DESTROY DATABASE dbname;

3.

Which statement is used to retrieve data from a database?

a)

FIND

b)

GET

c)

SELECT

d)

RETRIEVE

4.

Which keyword is used to sort the result set in ascending order?

a)

ORDER BY ASC

b)

SORT ASC

c)

ASCEND

d)

SORT BY

5.

Which function is used to count rows?

a)

COUNT()

b)

SUM()

c)

ROWS()

d)

TOTAL()

6.

Which SQL statement is used to add new data to a table?

a)

INSERT INTO

b)

ADD TO

c)

UPDATE

d)

APPEND

7.

Which SQL keyword is used to update existing data?

a)

CHANGE

b)

MODIFY

c)

UPDATE

d)

ALTER

8.

Which command is used to delete a table completely?

a)

DELETE TABLE

b)

DROP TABLE

c)

REMOVE TABLE

d)

DESTROY TABLE

9.

Which SQL statement is used to prevent duplicate rows?

a)

DISTINCT

b)

UNIQUE

c)

PRIMARY

d)

KEY

10.

Which SQL clause is used to filter records?

a)

WHERE

b)

FILTER

c)

HAVING

d)

CHECK

11.

PHP stands for:

a)

Personal Home Page

b)

Private Home Page

c)

Preprocessor Home Page

d)

PHP Hypertext Program

12.

Which symbol is used to declare variables in PHP?

a)

#

b)

$

c)

@

d)

%

13.

Which of the following is used to output data in PHP?

a)

echo

b)

printf

c)

println

d)

console.log

14.

Which function is used to connect to a MySQL database in PHP (MySQLi)?

a)

mysqli_connect()

b)

mysql_connect()

c)

connect_db()

d)

db_connect()

15.

Which function is used to include a file in PHP?

a)

require()

b)

include()

c)

require_once()

d)

All of the above

16.

Which of the following is a PHP superglobal variable?

a)

$_POST

b)

$_GET

c)

$_SESSION

d)

All of the above

17.

What will echo 5 . 3; output in PHP?

a)

8

b)

53

c)

15

d)

Error

18.

Which operator is used for string concatenation in PHP?

a)

+

b)

.

c)

&

d)

*

19.

Which function is used to get the length of a string in PHP?

a)

strlen()

b)

length()

c)

size()

d)

strlength()

20.

Which function is used to get the current date in PHP?

a)

time()

b)

date()

c)

current_date()

d)

now()