wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

MID SEMESTER TEST

Total questions: 30

Worksheet time: 3hrs 30mins

Name
Class
Date
1.

A _____________ is a program running on the server machine, which accepts requests from a Web browser and sends back results in the form of HTML documents.

a)

HTTP

b)

HTML

c)

Web Server

d)

Web browser

2.

Which of the following is not true about HTML ?

a)

<meta…./>

b)

<meta>…</meta>

c)

<metadata name=”” />

d)

<metadata>…</metadata>

3.

Html document must always be saved with ________________.

a)

.doc

b)

.htm

c)

.html

d)

Both .htm and .html

4.

What MySQL property is used to create a surrogate key in MySQL?

a)

UNIQUE

b)

SEQUENCE

c)

AUTO_INCREMENT

d)

None of the above.

5.

The ORDER BY clause can only be used in ___________________.

a)

INSERT queries

b)

SELECT queries

c)

HAVING queries

d)

GROUP BY queries

6.

In the following query, which expression is evaluated first?


SELECT id_number, (quantity - 100 / 0.15 - 35 * 20) FROM inventory

a)

35*20

b)

0.15-35

c)

100 / 0.15

d)

quantity – 100

7.

Which of the following queries displays the sum of all employee salaries for those employees not making commission, for each job, including only those sums greater than 2500?

a)

select job, sum(sal) from emp where sum(sal) > 2500 and comm is null;

b)

select job, sum(sal) from emp where sum(sal) > 2500 and comm is null group by job;

c)

select job, sum(sal) from emp where comm is null group by job having sum(sal) > 2500;

d)

select job, sum(sal) from emp group by job having sum(sal) > 2500 and comm is not null;

8.

Which of the following queries are legal?

a)

SELECT deptno, avg(sal) FROM emp;

b)

SELECT deptno, avg(sal) FROM emp GROUP BY deptno;

c)

SELECT deptno, count(deptno) FROM emp GROUP BY ename;

d)

SELECT deptno, count(deptno), job FROM emp GROUP BY deptno;

9.

DML changes are _______________________.

a)

Insert

b)

Create

c)

Update

d)

Both Insert and Update

10.

_______________ joins are SQL server default.

a)

Equi

b)

Inner

c)

Outer

d)

None of the above.

11.

Fill in with correct keyword to update the instructor relation.


UPDATE instructor

_____ salary= salary * 1.05;

a)

IN

b)

SET

c)

SELECT

d)

WHERE

12.

Which of the following relation updates all instructors with salary over $100,000 receive a 3 percent raise, whereas all others receive a 5 percent raise.

a)

UPDATE instructor

SET salary = salary * 1.03

WHERE salary > 100000;

UPDATE instructor

SET salary = salary * 1.05

WHERE salary <= 100000;

b)

UPDATE instructor

SET salary = salary * 1.05

WHERE salary < (SELECT avg (salary)

FROM instructor);

c)

UPDATE instructor

SET salary = CASE

WHEN salary <= 100000 THEN salary * 1.03

ELSE salary * 1.05

END

d)

None of the above.

13.

Which of the following deletes all tuples in the instructor relation for those instructors associated with a department located in the Watson building which is in department relation.

a)

DELETE FROM instructor

WHERE dept_name IN 'Watson';

b)

DELETE FROM department

WHERE building='Watson';

c)

DELETE FROM instructor

WHERE dept_name IN (SELECT dept name

FROM department

WHERE building = ’Watson’);

d)

DELETE FROM instructor

WHERE dept_name IN (SELECT dept name

FROM department

WHERE building = ’watson’);

14.

Delete from r where P;


The above command will _______________________________________.

a) Deletes a particular tuple from the relation

b) Deletes the relation

c) Clears all entries from the relation

d) All of the mentioned

a)

deletes the relation

b)

clears all entries from the relation

c)

deletes a particular tuple from the relation

d)

All of the above.

15.

Dates must be specified in the format of ___________________.

a)

d/mm/yy

b)

mm/dd/yy

c)

yy/dd/mm

d)

yyyy/mm/dd

16.

Which one of the following is used to define the structure of the relation, deleting relations and relating schemas?

a)

DDL

b)

DML

c)

Query

d)

Relational Schema

17.

Which one of the following provides the ability to query information from the database and to insert tuples into, delete tuples from, and modify tuples in the database?

a)

DDL

b)

DML

c)

Query

d)

Relational Schema

18.

SELECT * FROM employee


What type of statement is this?

a)

DDL

b)

DML

c)

View

d)

Integrity constraint

19.

CREATE TABLE employee (name VARCHAR, id INTEGER)


What type of statement is this?

a)

DDL

b)

DML

c)

View

d)

Integrity constraint

20.

Here which of the following displays the unique values of the column?


SELECT ________ dept_name

FROM instructor;

a)

IN

b)

ALL

c)

FROM

d)

DISTINCT

21.

SELECT * FROM employee WHERE salary>10000 AND dept_id=101;


Which of the following fields are displayed as output?

a)

Salary

b)

Employee

c)

Salary, dept_id

d)

All the field of employee relation

22.

This is an Employee table.


1001 Annie 6000

1009 Ross 4500

1018 Zeith 7000


Which of the following employee_id will be displayed for the given query?


SELECT * FROM employee WHERE employee_id>1009;

a)

1001

b)

1018

c)

1009, 1018

d)

1009, 1001, 1018

23.

Which of the following statements contains an error?

a)

Select empid from emp;

b)

Select * from emp where empid = 10003;

c)

Select empid from emp where empid = 10006;

d)

Select empid where empid = 1009 and lastname = ‘GELLER’;

24.

In the given query which of the keyword has to be inserted?


INSERT INTO employee _____ (1002,Joey,2000);

a)

Field

b)

Table

c)

Values

d)

Relation

25.

SELECT emp_name

FROM department

WHERE dept_name LIKE ’ _____ Computer Science’;


Which one of the following has to be added into the blank to select the dept_name which has Computer Science as its ending string?

a)

_

b)

%

c)

$

d)

||

26.

SELECT *

FROM instructor

ORDER BY salary ____, name ___;


To display the salary from greater to smaller and name in ascending order which of the following options should be used?

a)

Asc, Desc

b)

Desc, Asc

c)

Ascending, Descending

d)

Descending, Ascending

27.

SELECT name

FROM instructor

WHERE salary <= 100000 AND salary >= 90000;


This query can be replaced by which of the following ?

a)

SELECT name

FROM instructor

WHERE salary BETWEEN 90000 AND 100000;

b)

SELECT name

FROM employee

WHERE salary <= 90000 AND salary>=100000;

c)

SELECT name

FROM employee

WHERE salary BETWEEN 90000 AND 100000;

d)

SELECT name

FROM instructor

WHERE salary BETWEEN 100000 AND 90000;

28.

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

a)

True.

b)

False

29.

The OR operator displays a record if ANY conditions listed are true. The AND operator displays a record if ALL of the conditions listed are true.

a)

True.

b)

False.

30.

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

a)

True.

b)

False.