finalExamCode2V1 (3)
finalExamCode2V1 (3)
True or False
Instruction: For each of the following questions write TRUE if the statement is correct or FALSE if
it is incorrect at the space provide on the answer sheet. (5 points)
1. Entity sets, attributes and Relationship sets are components of an E-R Diagram.
2. SQL is the standard database language for non-Relational database management system.
3. The data type of bit in SQL server allows 0, 1 or NULL.
4. An E-R diagram can be used to represent the conceptual design of a database.
5. Database is a collection of interrelated data.
Instruction: For each of the following questions choose the correct answer and write the letter to
your answer on the answer sheet provided. (1.5 points each)
1. Which one of the following SQL syntax is used to delete both the structure and record
stored in the table?
A. DROP TABLE table_name C. TRUNCATE TABLE table_name;
B. DELETE FROM table_name D.ALTER TABLE table_name
2. Which one of the following is used to ensure the referential integrity of the data in one
table to match values in another table?
A. Primary Key C.Check
B. Foreign key D. Composite Key
3. Identify the correct statement about A relation or table which is in first normal form.
A. A relation contain composite or multi-valued attribute is under first normal form.
A. A relation is in first normal form if every attribute in that relation is singled valued
attribute.
B. The order, in which data is stored, does not matter in first normal form.
C. If each table cell contains a single value, then the table is under first normal form.
4. One of the following is incorrect about primary key of a table
A. A primary key cannot be NULL
B. A primary key value must be unique
C. The primary key must be given a value when a new record is inserted.
B. None of the above
5. Which one of the following data type is different from the other?
A. varchar(n) B. Text C. Real D. binary(n)
6. Which one of the following is used to uniquely identify an entity from the entity set?
A. Primary key attribute B. Foreign key attribute C. Derived attribute D. None
7. Hjhkjhjkh
8. jkjlkjkljlk
Part III. Matching
Instruction: for each of the following SQL Commandsfound under column A match their types from
column B and write the letter of your answer on the answer sheet provided. Note: a given SQL type
could be used more than ones(7 points)
Column A 7. Delete
1. Alter
2. Grant Column B
3. Select A. Data Definition Language (DDL)
4. Update B. Data Query Language (DQL)
5. Insert C. Data Manipulation Language (DML)
6. Create
D. Data Control Language (DCL)
Instruction: Based on the tables found below, choose the correct answer and write it on the space
provided at the answer sheet(2 points each).
1. Which one of the following SQL query can be used to create tblBorrowwithout adding foreign key
constraint?
A. CREATE TABLE tblBorrow(NO bigintNOT NULLPRIMARY KEY IDENTITY(12,1), User_Id varchar(60),
Middle_name varchar(20), Last_name varchar(20),Date_of_birth date, Sex varchar(10));
B. CREATEtblBorrow TABLE (NO bigintNOT NULLPRIMARY KEY IDENTITY(1,1), User_Id varchar(60),
Middle_name varchar(20), Last_name varchar(20),Date_of_birth date, Sex varchar(10));
C. CREATE TABLE tblBorrow(NO bigintNOT NULLPRIMARY KEY IDENTITY(102,1), User_Id varchar(60),
Middle_name varchar(20), Last_name varchar(20),Date_of_birth , Sex varchar(10));
D. ALTER TABLE tblBorrow(NO bigintNOT NULLPRIMARY KEY IDENTITY(12,1), User_Id varchar(60),
Middle_name varchar(20), Last_name varchar(20),Date_of_birth date, Sex varchar(10));
2. Which one of the following SQL query can be used to create tblUser?
A. CREATE tblUserTABLE (User_Idvarchar(60) NOT NULLPRIMARY KEY, First_name varchar(20),
Middle_name varchar(20), Last_name varchar(20),Date_of_birth date, Sex varchar(10));
B. CREATE TABLE tblUser(User_Idvarchar(60) NOT NULLPRIMARY KEY, First_name varchar(20),
Middle_name varchar(20), Last_name varchar(20),Date_of_birth date, Sex varchar(10));
C. ALTER TABLE tblUser(User_Idvarchar(60) NOT NULLPRIMARY KEY, First_name varchar(20),
Middle_name varchar(20), Last_name varchar(20),Date_of_birth date, Sex varchar(10));
D. CREATE TABLE tblBook(User_Idvarchar(60) NOT NULLPRIMARY KEY, First_name varchar(20),
Middle_name varchar(20), Last_name varchar(20),Date_of_birth date, Sex varchar(10));
3. Which one of the following SQL command is used to change the book_authorElmasri to
Abebe in the table tblBook?
A. UPDATEtblBookSETBook_Author=’Abebe’
B. UPDATEtblBookSET Book_Author=’Abebe’ WHERE Book_ISBN=1701
C. UPDATEtblBookSET Book_Author=’Abebe’ WHERE Book_ISBN=Elmasri
D. UPDATEtblBookSET Book_Author=’Abebe’ WHERE Book_ISBN=1702
4. Assume tblBorrow is already created, which one of the following query can be used to add a foreign
key constraint to the attribute Book_ISBN?
A. ALTER TABLE tblBorrow
ADD FOREIGN KEY (Book_ISBN) REFERENCES tblBook(Book_ISBN);
B. ALTER TABLE tblBorrow
ADD FOREIGN KEY (Book_ISBN) REFERENCES tblBorrow (Book_ISBN);
C. Create TABLE tblBorrow
ADD FOREIGN KEY (Book_ISBN) REFERENCES tblBorrow (Book_ISBN);
D. Create TABLE tblBorrow
ADD FOREIGN KEY (Book_ISBN) REFERENCES tblBook(Book_ISBN);
5. Which one of the following query is used to retrieve 2000 edition books from tblBook
A. SELECT * FROM tblBook WHERE Edition =’2000’
B. SELECT * FROM tblBook WHERE Edition Like ‘20’
C. SELECT * FROM tblBook WHERE Edition is 2000
D. SELECT * FROM tblBook WHERE Edition <> 2000
Instruction: Based on the tables (tblUser,tblBook and tblBorrow) found Above, give short answer for
the following questions.(3 points each)