0% found this document useful (0 votes)
11 views22 pages

Test 2

The document contains a series of multiple-choice questions and answers related to database concepts, SQL operations, and data integrity constraints. Each question is numbered and includes options for answers, with the correct answers indicated. The topics covered include relational data models, SQL commands, transaction properties, and database indexing.

Uploaded by

nguyenqminh10a4
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views22 pages

Test 2

The document contains a series of multiple-choice questions and answers related to database concepts, SQL operations, and data integrity constraints. Each question is numbered and includes options for answers, with the correct answers indicated. The topics covered include relational data models, SQL commands, transaction properties, and database indexing.

Uploaded by

nguyenqminh10a4
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 22

QN=1 The conceptual model is

a. Dependent on hardware
b. Dependent on software
c. Dependent on both hardware and software
d. Independent of both software and hardware
e.
f.
Answer: d
Mark:
Unit: 4
Mix choices: Yes

QN=2 When the number of entities are borrowed together into one entity based
on their similar characteristics, what is this process called?
a. Generalization
b. Specialization
c. Inheritance
d. Abstraction
e.
f.
Answer: a
Mark:
Unit: 4
Mix Yes
choices:
QN=3 Consider the following Statements:
(1) An Entity Integrity constraint states that the primary key value cannot
be null.
(2) A referential integrity constraint is specified between two relations.
(3) A foreign key cannot be used to refer to its own relation.
Which of the above statements are correct?
a. Only (1)
b. Only (2)
c. Only (2) and (3)
d. Only (1) and (2)
e.
f.
Answer: d
Mark:
Unit: 4
Mix Yes
choices:

QN=4 Which of the following is a component of the relational data model


included to specify business rules to maintain the integrity of data when
they are manipulated?
a. Business rule constraint
b. Data integrity
c. Business integrity
d. Data structure
e. Entity integrity
f.
Answer: b
Mark:
Unit: 4
Mix Yes
choices:

QN=5 What should we do when converting the 1-M binary relationship into
tables?
a. Create a table with all attributes from both entities
b. Add foreign key to the many side referencing to the parent (1 side)
c. Add foreign key to the 1 side referencing to the child (M side)
d. Add foreign key to all of tables
e.
f.
Answer: b
Mark:
Unit:
Mix choices: Yes

QN=6 What is the output of conceptual design model


a. ER diagram
b. Relational database schema
c. Technical specifications for construction of the database
d. None of the others
e.
f.
Answer: a
Mark:
Unit: 4
Mix choices: Yes

QN=7 The difference between PRIMARY KEY constraint and UNIQUE


constraint is:
a. The data of field has UNIQUE constraint that can be NULL, otherwise
to PRIMARY KEY constraint
b. The data of field has PRIMARY constraint that can be NULL, otherwise
to UNIQUE constraint
c. These constraints are not different.
d. None of the others.
e.
f.
Answer: a
Mark:
Unit: 6
Mix choices: Yes

QN=8 A domain of CustomerType attributes in Customer relation have


3 types: VIP, NOR, POT. Which statement is used to validate the
data entries?(Note: VIP: very important; NOR: normal; POT:
potential)
a. …CHECK CustomerType IN(‘VIP’,’NOR’,’POT’)
b. …CHECK CustomerType =’VIP’, ‘NOR’, ‘POT’
c. …CHECK (CustomerType = ‘VIP’ AND CustomerType =
‘NOR’ CustomerType = ‘POT’)
d. None of the others
e.
f.
Answer: a
Mark:
Unit: 6
Mix choices: Yes

QN=9 Which statement is use to add FOREIGN KEY constraint into


Student table (IdClass is a foreign key which refer to Class table)
a. ALTER TABLE Student
ADD CONSTRAINT FKStudent FOREIGN KEY(IdClass)
REFERENCES Class(IdClass)
b. ALTER TABLE Student
ADD FOREIGN KEY(IdClass) REFERENCES Class(IdClass)
c. ALTER TABLE Student
ADD FKStudent FOREIGN KEY(IdClass)
REFERENCES Class(IdClass)
d. None of the others
e.
f.
Answer: a
Mark:
Unit: 6
Mix choices: Yes

QN=10 Selecting the victim to be rollbacked to the previous state is determined


by the minimum cost. The factors determining cost of rollback is
a. How long the transaction has computed, and how much longer the
transaction will compute before it completes its designated task.
b. How many data items the transaction has used
c. How many more data items the transaction needs for it to complete
d. All of these answers
e.
f.
Answer: d
Mark:
Unit: 7
Mix choices: Yes

QN=11 What is the property of a transaction which ensures that either all
operations of the transaction are reflected properly in the database or
none?
a. Atomicity
b. Durability
c. Isolation
d. Consistency
e. Deadlock
f.
Answer: a
Mark:
Unit: 7
Mix choices: Yes

QN=12 Which of the following is a comparison operator in SQL?


a. =
b. LIKE
c. BETWEEN
d. All of the answers
e.
f.
Answer: d
Mark:
Unit:
Mix choices: Yes

QN=13 This index reorders the physical order of the table and searches based on
the basis of key values. What is the type of index?
a. Unique Index
b. Clustered Index
c. Non-Clustered Index
d. None of the answers
e.
f.
Answer: b
Mark:
Unit: 7
Mix choices: Yes

QN=14 What type of function returns the unit, not a table?


a. Scalar Functions
b. Inline Table-valued functions
c. Multi-statement valued functions
d. All of the answers
e.
f.
Answer: a
Mark:
Unit: 9
Mix choices: Yes

QN=15 Which of the following group functions ignore NULL values?


a. MAX
b. SUM
c. COUNT
d. All of these answers
e.
f.
Answer: d
Mark:
Unit: 6
Mix choices: Yes

QN=16 Suppose you want to compare three keys (‘Primary Key’, ‘Super Key’
and ‘Candidate Key’) in a database. Which of the following option(s)
is/are correct?

(1)Minimal super key is a candidate key


(2)Only one Candidate Key can be Primary Key
(3)All super keys can be a candidate key
(4)We cannot find “Primary Key” from “Candidate Key”
a. (1) & (2)
b. (1) & (3)
c. (2) & (3)
d. (3) & (4)
e.
f.
Answer: a
Mark:
Unit: 4
Mix choices: Yes

QN=17 Which of the following statement(s) is/are true about “HAVING” and
“WHERE” clauses in SQL?
(1) WHERE” is always used before “GROUP BY” and HAVING
after “GROUP BY”
(2) WHERE” is always used after “GROUP BY” and “HAVING”
before “GROUP BY”
(3) “WHERE” is used to filter rows but “HAVING” is used to filter
groups
(4) “WHERE” is used to filter groups but “HAVING” is used to
filter rows
a. (1) & (4)
b. (1) & (3)
c. (2) & (3)
d. (2) & (4)
e.
f.
Answer: b
Mark:
Unit: 6
Mix choices: Yes

QN=18 Which of the following is true for TRUNCATE in SQL?


a. It is usually slower than DELETE command
b. It is usually faster than DELETE command
c. There is no comparison between DELETE & TRUNCATE
d. Truncate command can be rolled back
e.
f.
Answer: b
Mark:
Unit: 6
Mix choices: Yes

QN=19 In the language constructs for procedures, PSM stands for


a. Permanent Storage Module
b. Persistent Storage Module
c. Prepared statement module
d. Prepared storage module
e.
f.
Answer: b
Mark:
Unit: 8
Mix choices: Yes

QN=20 The main purpose of Indexes using in DBMS is


a. Providing a quicker way to store data
b. Decreasing the amount of disk space utilized
c. Providing rapid, random and sequential access to base-table data
d. Increasing the cost of implementation
e. Decreasing the cost of implementation
f.
Answer: c
Mark:
Unit: 7
Mix choices: Yes

QN=21 Which of the following types of index is automatically created


combining with the primary key when we do not specify?
a. Bitmap
b. Balanced Tree index
c. Binary tree index
d. Hashed
e. Sparse index
f.
Answer: B
Mark:
Unit: 7
Mix choices: Yes

QN=22 Which of the following statements is true?


a. A weak entity set may exist without participation in any relationship
b. A weak entity should participate in relationship with another weak
entity set
c. A weak entity set should participate in relationship with at least one
strong entity set
d. Weak entity sets have no primary key that is derived from the parent
entity in the binary relationship with at least one strong entity set.
e.
f.
Answer: d
Mark:
Unit: 4
Mix choices: Yes

QN=23 Which statement is used to modify the value of Address in table


Student selected from Addr column in table
EnrollmentInformation ?
a. UPDATE Student
SET Address = (SELECT Addr FROM EnrollmentInformation
WHERE Student.Id = EnrollmentInformation.Id)
b. UPDATE Student
SET Addr = (SELECT Address FROM EnrollmentInformation
WHERE Student.Id = EnrollmentInformation.Id)
c. UPDATE Student
SET Address = (SELECT Addr FROM EnrollmentInformation)

d. None of the others


e.
f.
Answer: a
Mark:
Unit: 6
Mix choices: Yes

QN=24 Which statement is used to insert data from table HREmp to table
Employee:
a. INSERT INTO Employee
SELECT * FROM HREmp
b. INSERT INTO Employee
VALUES(SELECT * FROM HREmp)
c. INSERT INTO Employee (Dept)
VALUES(‘HREmp)
d. None of the others
e.
f.
Answer: a
Mark:
Unit: 6
Mix choices: Yes
QN=25 Which statement is used to delete all the data but keep the
structure of table Student
a. DELETE FROM Student
b. DELETE TABLE Student
c. DROP TABLE Student
d. None of the others
e.
f.
Answer: a
Mark:
Unit: 6
Mix choices: Yes

QN=26 What type of join is needed when you wish to include rows that
do not have matching values?
a. Equi-join
b. Natural join
c. Outer join
d. All of the others
e.
f.
Answer: c
Mark:
Unit: 6
Mix choices: Yes

QN=27 Give the query:


SELECT E.*
FROM dbo.tblEmployee E, dbo.tblDepartment D
WHERE E.depNum = D.depNum
AND depName LIKE N'Phòng phần mềm trong nước'
Which query below is equivalent to this one?
a. SELECT E.*
FROM dbo.tblEmployee E JOIN dbo.tblDepartment D
ON E.depNum = D.depNum
AND depName LIKE N'Phòng phần mềm trong nước'
b. SELECT *
FROM dbo.tblEmployee
WHERE depnum IN
(SELECT depnum
FROM dbo.tblDepartment
WHERE depName LIKE N'Phòng phần mềm trong nước')
c. SELECT *
FROM dbo.tblEmployee
WHERE depnum =
(SELECT depnum
FROM dbo.tblDepartment
WHERE depName LIKE N'Phòng phần mềm trong nước')
d. All of the others
e.
f.
Answer: d
Mark:
Unit: 6
Mix choices: Yes

QN=28 Which of the following should be used to find all the courses
taught in the Fall 2014 semester but not in the Spring 2015
semester
a. SELECT DISTINCT courseid
FROM section
WHERE semester = ’Fall’ and year= 2014 and
Courseid not in (SELECT courseid FROM section
WHERE semester = ’Spring’ and year= 2015);
b. SELECT distinct course_id
FROM instructor
WHERE name NOT IN (’Fall’, ’Spring’);
c. (SELECT course id
FROM section
WHERE semester = ’Spring’ and year= 2015)
d. SELECT distinct course_id
FROM instructor
WHERE name = ’Fall’ OR name= ’Spring’;
e.
f.
Answer: a
Mark:
Unit: 6
Mix choices: Yes

QN=29 Give the SQL statement:


SELECT * FROM Worker WHERE first_name like '%a%'
a. This statement is used to print details of the workers whose first_name
contains ‘a’

b. This statement is used to print details of the workers whose first_name


ends with ‘a’
c. This statement is used to print details of the workers whose first_name
begins with ‘a’
d. This statement is used to print details of the workers whose first_name
begins and ends with ‘a’
e.
f.
Answer: a
Mark:
Unit: 6
Mix choices: Yes

QN=30 Which operator(s)are used in the SELECT statement?


a. Expression
b. Operator
c. Aggregate functions
d. All of these answers
e.
f.
Answer: d
Mark:
Unit: 6
Mix choices: Yes

QN=31 To display the unique values of a column, which word is used?


a. Top
b. Distinct
c. All
d. From
e.
f.
Answer: b
Mark:
Unit: 6
Mix choices: Yes

QN=32 Which statement does not fire the trigger?


a. INSERT
b. UPDATE
c. DELETE
d. SELECT
e.
f.
Answer: d
Mark:
Unit: 7
Mix choices: Yes

QN=33 How to declare a variable idStudent with int type in trigger?


a. Declare @idStudent int;
b. Int idStudent;
c. Var idStudent int;
d. None of the others
e.
f.
Answer: a
Mark:
Unit: 8
Mix choices: Yes

QN=34 The CREATE TRIGGER statement is used to create the trigger.


The_____ clause specifies the table name on which the trigger is to be
attached. The ______ specifies that this is an AFTER INSERT trigger.
a. FOR, UPDATE
b. ON, FOR INSERT
c. FOR, INSERT
d. FOR INSERT, ON
e.
f.
Answer: b
Mark:
Unit: 8
Mix choices: Yes

QN=35 Which of the following creates a virtual relation for storing the data ?
a. Function
b. View
c. Procedure
d. All of the others
e.
f.
Answer: b
Mark:
Unit: 8
Mix choices: Yes
QN=36 Which of the following is used at the end of the view to reject the tuples
which do not satisfy the condition in the WHERE clause ?
a. With
b. Check
c. With check
d. None of the others
e.
f.
Answer: c
Mark:
Unit: 8
Mix choices: Yes

QN=37 What is a benefit of stored procedure in SQL Server?


a. Network efficiency
b. Encapsulate business logic
c. Maintainable
d. Stronger security
e. All of the others
f.
Answer: e
Mark:
Unit: 8

QN=38 CREATE PROCEDURE dbo.uspGetAddress @City nvarchar(30)


AS
SELECT *
FROM Person.Address
WHERE City = @City
GO;
@City is:
a. An input parameter
b. An output parameter
c. Not a parameter
d. None of the others
e.
f.
Answer: a
Mark:
Unit: 8
Mix choices: Yes

QN=39 Which keyword is used to create a variable in a stored procedure?


a. UPDATE
b. DECLARE
c. SET NOCOUNT
d. CREATE
e.
f.
Answer: b
Mark:
Unit: 8
Mix choices: Yes

QN=40 Which statement is used to drop multiple stored procedure?


a. DROP PROC dbo.uspGetAddress, dbo.uspInsertAddress,
dbo.uspDeleteAddress
b. DROP PROCEDURE dbo.uspGetAddress, dbo.uspInsertAddress,
dbo.uspDeleteAddress
c. All of the answers
d.
e.
f.
Answer: c
Mark:
Unit: 8
Mix choices: Yes

You might also like