wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

WORKSHOP

Total questions: 20

Worksheet time: 7mins

Name
Class
Date
1.

Which SQL function is used to count the total number of rows in a table, including those with NULL values?

a)

COUNT(column_name)

b)

NUMBER()

c)

SUM()

d)

COUNT(*)

2.

Which of the following is not a DDL command?

a)

UPDATE

b)

TRUNCATE

c)

ALTER

d)

None of the above

3.

How many Primary keys can a table have?

a)

Only 1

b)

Only 2

c)

Depends on number of columns

d)

Depends on DBA

4.

The ______ clause allows us to select only those rows in the result relation of the ____ clause that satisfy a specified predicate.

a)

WHERE, FROM

b)

FROM, SELECT

c)

SELECT, FROM

d)

FROM, WHERE

5.

his Query can be replaced by which one of the following?

SELECT name, course_id

FROM instructor, teaches

WHERE instructor_ID= teaches_ID;

a)

Select name,course_id from teaches,instructor where instructor_id=course_id;

b)

Select name, course_id from instructor natural join teaches;

c)

Select name, course_id from instructor;

d)

Select course_id from instructor join teaches;

6.

What type of database model organizes data in tables with rows and columns?

a)

Hierarchical

b)

Network

c)

Relational

d)

Object-Oriented

7.

In SQL, which data type is best suited for storing large texts such as articles or comments?

a)

TEXT

b)

VARCHAR

c)

CHAR

d)

BLOB

8.

In SQL, what is the difference between CHAR and VARCHAR data types?

a)

CHAR is fixed length, VARCHAR is variable length

b)

CHAR is variable length, VARCHAR is fixed length

c)

No difference

d)

VARCHAR is used only for numeric data

9.

What is the difference between the DROP and TRUNCATE commands in SQL?

a)

DROP deletes the table, TRUNCATE deletes only the table data

b)

TRUNCATE deletes the table, DROP deletes only the table data

c)

No difference

d)

Both commands modify table data

10.

What does the WHERE clause do in an SQL query?

a)

Sorts the result set

b)

Filters rows before grouping

c)

Joins Tables

d)

Filters rows after grouping

11.

Which of the following is a correct PHP tag?

a)

<?php ?>

b)

<php>

c)

<? ?>

d)

<% %>

12.

PHP can be embedded in which of the following types of documents?

a)

HTML only

b)

CSS only

c)

JavaScript only

d)

HTML, CSS, and JavaScript

13.

What is the correct way to declare a variable in PHP?

a)

int $varName

b)

$varName

c)

var $varName

d)

declare $varName

14.

What will be the output of the following PHP code?

<?php

echo "This", "was", "a", "bad", "idea";

?>

a)

This, was, a, bad, idea

b)

This was a bad idea

c)

Thiswasabadidea

d)

Error

15.

Consider the PHP array:

$arr = array(1, 2, 3, 4);

What is the correct way to access the third element?

a)

$arr[2]

b)

$arr[3]

c)

$arr[2]

d)

$arr(3)

16.

What will be the output of the following PHP code if a user submits a form with an input named email?

if (isset($_POST['email'])) {

echo $_POST['email'];

}

?>

a)

The value of the email input field

b)

NULL

c)

An empty string

d)

An error message

17.

Consider the following PHP code:

for ($i = 1; $i <= 5; $i++) {

if ($i == 3) {

continue;

}

echo $i;

}

?>

a)

1245

b)

12345

c)

1234

d)

125

18.

Which PHP function is used to connect to a MySQL database?

a)

mysql_connect()

b)

mysqli_connect()

c)

connect_db()

d)

db_connect()

19.

Which symbol is used to concatenate strings in PHP?

a)

+

b)

.

c)

&

d)

:

20.

Which of the following statements is true about PHP variables?

a)

PHP variables must begin with a dollar sign ($) followed by a letter or underscore.

b)

PHP variables are case-sensitive.

c)

PHP variables can be declared without specifying a data type.

d)

All of the above