Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Relational data base management system, Lecture notes of Computer Science

Complete details regarding RELATIONAL database

Typology: Lecture notes

2017/2018

Uploaded on 10/04/2018

satishkumar117
satishkumar117 🇮🇳

5

(2)

2 documents

1 / 38

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Distributed By: www.estudyindia.com
RELATIONAL DATABASE DESIGN AND SQL
1. . Which of the following is/are true with reference to 'view' in DBMS?
(a) A 'view' is a special stored procedure executed when certain event occurs.
(b) A 'view' is a virtual table, which occurs after executing a pre-compiled query.
Code:
(1) Only (a) is true
(2) Only (b) is true
(3) Both (a) and (b) are true
(4) Neither (a) nor (b) are true
Answer: 2
2. . In SQL, .................. is an Aggregate function.
(1) SELECT
(2) CREATE
(3) AVG
(4) MODIFY
Answer: 3
3. . Match the following with respect to RDBMS:
List - I
(a) Entity integrity
(b) Domain integrity
(c) Referential integrity
(d) Userdefined integrity
List - II
(i) enforces some specific business rule that do not fall into entity or domain
(ii) Rows can't be deleted which are used by other records
(iii) enforces valid entries for a column
(iv) No duplicate rows in a table
Code:
(a) (b) (c) (d)
(1) (iii) (iv) (i) (ii)
(2) (iv) (iii) (ii) (i)
(3) (iv) (ii) (iii) (i)
(4) (ii) (iii) (iv) (i)
Answer: 2
4. . In RDBMS, different classes of relations are created using ................... technique to
prevent modification anomalies.
(1) Functional Dependencies
(2) Data integrity
(3) Referential integrity
(4) Normal Forms
Answer: 4
5. . .................. SQL command changes one or more fields in a record.
(1) LOOK-UP
(2) INSERT
(3) MODIFY
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25
pf26

Partial preview of the text

Download Relational data base management system and more Lecture notes Computer Science in PDF only on Docsity!

RELATIONAL DATABASE DESIGN AND SQL

1.. Which of the following is/are true with reference to 'view' in DBMS? (a) A 'view' is a special stored procedure executed when certain event occurs. (b) A 'view' is a virtual table, which occurs after executing a pre-compiled query. Code: (1) Only (a) is true (2) Only (b) is true (3) Both (a) and (b) are true (4) Neither (a) nor (b) are true Answer: 2 2.. In SQL, .................. is an Aggregate function. (1) SELECT (2) CREATE (3) AVG (4) MODIFY Answer: 3 3.. Match the following with respect to RDBMS: List - I (a) Entity integrity (b) Domain integrity (c) Referential integrity (d) Userdefined integrity List - II (i) enforces some specific business rule that do not fall into entity or domain (ii) Rows can't be deleted which are used by other records (iii) enforces valid entries for a column (iv) No duplicate rows in a table Code: (a) (b) (c) (d) (1) (iii) (iv) (i) (ii) (2) (iv) (iii) (ii) (i) (3) (iv) (ii) (iii) (i) (4) (ii) (iii) (iv) (i) Answer: 2 4.. In RDBMS, different classes of relations are created using ................... technique to prevent modification anomalies. (1) Functional Dependencies (2) Data integrity (3) Referential integrity (4) Normal Forms Answer: 4 5.. .................. SQL command changes one or more fields in a record. (1) LOOK-UP (2) INSERT (3) MODIFY

(4) CHANGE

Answer: 3

6.. An attribute A of datatype varchar(20) has value 'Ram' and the attribute B of datatype char(20) has value 'Sita' in oracle. The attribute A has .......... memory spaces and B has .......... memory spaces. (1) 20, 20 (2) 3, 20 (3) 3, 4 (4) 20, 4 Answer: 2 7.. Integrity constraints ensure that changes made to the database by authorized users do not result into loss of data consistency. Which of the following statement(s) is (are) true w.r.t. the examples of integrity constraints? (A) An instructor Id. No. cannot be null, provided Instructor Id. No. being primary key. (B) No two citizens have same Adhar-Id. (C) Budget of a company must be zero. (1) (A), (B) and (C) are true. (2) (A) false, (B) and (C) are true. (3) (A) and (B) are true; (C) false. (4) (A), (B) and (C) are false. Answer: 3

  1. Let M and N be two entities in an E-R diagram with simple single vale attributes. R 1 and R 2 are two relationship between M and N, whereas R 1 is one-to-many and R 2 is many-to-many. The minimum number of tables required to represent M, N, R 1 and R 2 in the relational model are .......... (1) 4 (2) 6 (3) 7 (4) 3 Answer: 4 9.. Consider a schema R(MNPQ) and functional dependencies M→N, P→Q. Then the decomposition of R into R 1 (MN) and R 2 (PQ) is ............. (1) Dependency preserving but not lossless join. (2) Dependency preserving and lossless join (3) Lossless join but not dependency preserving (4) Neither dependency preserving nor lossless join. Answer: 1
  2. DBMS provides the facility of accessing data from a database through (A) DDL (B) DML (C) DBA (D) Schema Answer: B
  3. Relational database schema normalization is NOT for: (A) reducing the number of joins required to satisfy a query. (B) eliminating uncontrolled redundancy of data stored in the database.

II. E-R diagrams are useful to logically model concepts. III. An update anomaly is when it is not possible to store information unless some other, unrelated information is stored as well. IV. SQL is a procedural language. (A) I and IV only (B) III and IV only (C) I, II and III only (D) II, III and IV only Answer: D

  1. In a relational database model, NULL values can be used for all but which one of the following? (A) To allow duplicate tuples in the table by filling the primary key column(s) with NULL. (B) To avoid confusion with actual legitimate data values like 0 (zero) for integer columns and ‘’ (the empty string) for string columns. (C) To leave columns in a tuple marked as “unknown” when the actual value is unknown. (D) To fill a column in a tuple when that column does not really “exist” for that particular tuple. Answer: A
  2. Consider the following two commands C1 and C2 on the relation R from an SQL database: C1: drop table R; C2: delete from R; Which of the following statements is TRUE? I. Both C1 and C2 delete the schema for R. II. C2 retains relation R, but deletes all tuples in R. III. C1 deletes not only all tuples of R, but also the schema for R. (A) I only (B) I and II only (C) II and III only (D) I, II and III Answer: C
  3. Consider the following database table having A, B, C and D as its four attributes and four possible candidate keys (I, II, III and IV) for this table: A B C D a1 b1 c1 d a2 b3 c3 d a1 b2 c1 d I: {B} II: {B, C} III: {A, D} IV: {C, D} If different symbols stand for different values in the table (e.g., d1 is definitely not equal to d2), then which of the above could not be the candidate key for the database table? (A) I and III only (B) III and IV only (C) II only (D) I only Answer: C
  4. Consider a “CUSTOMERS” database table having a column “CITY” filled with all the names of Indian cities (in capital letters). The SQL statement that finds all cities that have “GAR” somewhere in its name, is: (A) Select *from customers where city=’%GAR%’; (B) Select *from customers where city=’$GAR$’; (C) Select *from customers where city like ‘%GAR%’; (D) Select *from customers where city as ’%GAR’; Answer: C
  1. Match the following database terms to their functions: List-I List-II (a) Normalization (i) Enforces match of primary key to foreign key (b) Data Dictionary (ii) Reduces data redundancy in a database (c) Referential Integrity (iii) Define view(s) of the database for particular user(s). (d) External Schema (iv) Contains metadata describing database structure. Codes: (a) (b) (c) (d) (A) (iv) (iii) (i) (ii) (B) (ii) (iv) (i) (iii) (C) (ii) (iv) (iii) (i) (D) (iv) (iii) (ii) (i) Answer: B
  2. Which of the following provides the best description of an entity type? (A) A specific concrete object with a defined set of processes (e.g. Jatin with diabetes) (B) A value given to a particular attribute (e.g. height-230 cm) (C) A thing that we wish to collect data about zero or more, possibly real world examples of it may exist. (D) A template for a group of things with the same set of characteristics that may exist in the real world Answer: D
  3. Data which improves the performance and accessibility of the database are called: (A) Indexes (B) User Data (C) Application Metadata (D) Data Dictionary Answer: A
  4. A relation R={A,B,C,D,E,F,G} is given with following set of functional dependencies: F={AD→E, BE→F, B→C, AF→G} W-hich of the following is a candidate key? (A) A (B) AB (C) ABC (D) ABD Answer: D
  5. An Assertion is a predicate expressing a condition we wish database to always satisfy. The correct syntax for Assertion is : (A) CREATE ASSERTION ‘ASSERTION Name’ CHECK ‘Predicate’ (B) CREATE ASSERTION ‘ASSERTION NAME’ (C) CREATE ASSERTION, CHECK Predicate (D) SELECT ASSERTION Answer: A
  6. Which of the following concurrency protocol ensures both conflict serializability and freedom from deadlock? (a) 2-phase Locking (b) Time stamp - ordering (A) Both (a) and (b) (B) (a) only (C) (b) only (D) Neither (a) nor (b)

(A) A (B) AE

(C) BE (D) CE

Answer: A

  1. Manager's salary details are hidden from the employee. This is called as (A) Conceptual level data hiding (B) Physical level data hiding (C) External level data hiding (D) Local level data hiding Answer: C
  2. Which of the following statements is false? (A) Any relation with two attributes is in BCNF. (B) A relation in which every key has only one attribute is in 2NF. (C) A prime attribute can be transitively dependent on a key in 3NF relation. (D) A prime attribute can be transitively dependent on a key in BCNF relation. Answer: D
  3. A clustering index is created when ................ (A) primary key is declared and ordered (B) no key ordered (C) foreign key ordered (D) there is no key and no order Answer: A
  4. Let R ={A, B, C, D, E, F} be a relation schema with the following dependencies C→F,E→A,EC→D,A→B Which of the following is a key for R? (A) CD (B) EC (C) AE (D) AC Answer: B
  5. Match the following: List-I List-II a.DDL i. LOCK TABLE b. DML ii. COMMIT c. TCL iii. Natural Difference d. BINARY Operation iv. REVOKE Codes: a b c d (A) ii i iii iv (B) i ii iv iii (C) iii ii i iv (D) iv i ii iii Answer: D
  6. The student marks should not be greater than 100. This is (A) Integrity constraint (B) Referential constraint (C) Over-defined constraint (D) Feasible constraint Answer: A
  1. GO BOTTOM and SKIP-3 commands are given one after another in a database file of 30 records. It shifts the control to (A) 28th^ record (B) 27th^ record (C) 3rd^ record (D) 4th^ record Answer: B
  2. An ER Model includes I. An ER diagram portraying entity types. II. Attributes for each entity type III. Relationships among entity types. IV. Semantic integrity constraints that reflects the business rules about data not captured in the ER diagram. (A) I, II, III & IV (B) I&IV (C) I, II & IV (D) I & III Answer: A
  3. Based on the cardinality ratio and participation ............... associated with a relationship type, choose either the Foreign Key Design, the Cross Referencing Design or Mutual Referencing Design. (A) Entity (B) Constraints (C) Rules (D) Keys Answer: B
  4. Data Integrity control uses ................ (A) Upper and lower limits on numeric data. (B) Passwords to prohibit unauthorised access to files. (C) Data dictionary to keep the data (D) Data dictionary to find last access of data Answer: B
  5. Usage of Preemption and Transaction Rollback prevents .................. (A) Unauthorised usage of data file (B) Deadlock situation (C) Data manipulation (D) File pre-emption Answer: B
  6. Cross_tab displays permit users to view ................ of multidimensional data at a time. (A) One dimension (B) Two dimensions (C) Three dimensions (D) Multidimensions Answer: B
  7. Thoma’s-write rule is ................. (A) Two phase locking protocol (B) Timestamp ordering protocol (C) One phase locking protocol (D) Sliding window protocol Answer: B
  8. Which of the following is not a type of Database Management System? (A) Hierarchical (B) Network (C) Relational (D) Sequential Answer: D
  9. Manager's salary details are to be hidden from Employee Table. This Technique is called as
  1. In DML, RECONNCT command cannot be used with (A) OPTIONAL Set (B) FIXED Set (C) MANDATOR Set (D) All of the above Answer: B
  2. The User Work Area (UWA) is a set of Program variables declared in the host program to communicate the contents of individual records between (A) DBMS & the Host record (B) Host program and Host record (C) Host program and DBMS (D) Host program and Host language Answer: C
  3. Given a Relation POSITION (Posting-No, Skill), then query to retrieve all distinct pairs of posting-nos. requiring skill is (A) Select p.posting-No, p.posting-No from position p where p.skill = p.skill and p.posting-No < p.posting-No (B) Select p1.posting-No, p2.posting-No from position p1, position p where p1.skill = p2.skill (C) Select p1.posting-No, p2.posting-No from position p1, position p where p1.skill = p2.skill and p1.posting-No < p2.posting-No (D) Select p1.posting-No, p2.posting-No from position p1, position p where p1.skill = p2.skill and p1.posting-No = p2.posting-No Answer: C
  4. In multiuser database if two users wish to update the same record at the same time, they are prevented from doing so by (A) Jamming (B) Password (C) Documentation (D) Record lock Answer: D
  5. What deletes the entire file except the file structure? (A) ERASE (B) DELETE (C) ZAP (D) PACK Answer: C
  6. Which command is the fastest among the following? (A) COPY TO (B) COPY STRUCTURE TO (C) COPY FILE <FILE 1> <FILE 2> (D) COPY TO MFILE-DAT DELIMITED Answer: B
  7. A Transaction Manager is which of the following? (A) Maintains a log of transactions

(B) Maintains before and after database images (C) Maintains appropriate concurrency control (D) All of the above Answer: D

  1. What deletes the entire file except the file structure? (A) ERASE (B) DELETE (C) ZAP (D) PACK Answer: C
  2. Which command classes text file, which has been created using “SET ALTERNATIVE” “Command”? (A) SET ALTERNATE OFF (B) CLOSE DATABASE (C) CLOSE ALTERNATE (D) CLEAR ALL Answer: A
  3. Data security threats include (A) privacy invasion (B) hardware failure (C) fraudulent manipulation of data (D) encryption and decryption Answer: C
  4. Which of the following statements is true, when structure of database file with 20 records is modified? (A)? EOF ( ) Prints T (B)? BOF ( ) Prints F (C)? BOF ( ) Prints T (D)? EOF ( ) Prints F Answer: A
  5. The SQL Expression Select distinct T. branch name from branch T, branch S where T. assets > S. assets and S. branch-city = DELHI, finds the name of (A) all branches that have greater asset than any branch located in DELHI. (B) all branches that have greater assets than allocated in DELHI. (C) the branch that has the greatest asset in DELHI. (D) any branch that has greater asset than any branch located in DELHI. Answer: A
  6. Which of the following is the recovery management technique in DDBMS? (A) 2PC (Two Phase Commit) (B) Backup (C) Immediate update (D) All of the above Answer: D
  7. Which of the following is the process by which a user’s privileges ascertained? (A) Authorization (B) Authentication (C) Access Control (D) None of these Answer: A
  8. The basic variants of time-stampbased method of concurrency control are

(A) entity type (B) relationship type (C) entity and relationship type (D) None of these Answer: A

  1. Generalization is ………… process. (A) top-down (B) bottom up (C) both (A) & (B) (D) None of these Answer: B
  2. Match the following: Set-I I. 2 NF II. 3 NF III. 4 NF IV. 5 NF Set-II (a) transitive dependencies eliminated (b) multivalued attribute removed (c) contain no partial functional dependencies (d) contains no join dependency Codes : I II III IV (A) (a) (c) (b) (d) (B) (d) (a) (b) (c) (C) (c) (d) (a) (b) (D) (d) (b) (a) (c) Answer: B
  3. Which data management language component enabled the DBA to define the schema components? (A) DML (B) Sub-schema DLL (C) Schema DLL (D) All of these Answer: C
  4. The PROJECT Command will create new table that has (A) more fields than the original table (B) more rows than original table (C) both (A) & (B) (D) none of these Answer: D
  5. The E-R model is expressed in term of I. Entities II. The relationship among entities. III. The attributes of the entities.

IV. Functional relationship. (A) I, II (B) I, II, IV (C) II, II, IV (D) I, II, III Answer: D

  1. Specialization is …………… process. (A) top-down (B) bottom up (C) both (A) and (B) (D) none of these Answer: A
  2. Match the following : List-I (1) Determinants (2) Candidate key (3) Non-redundancy (4) Functional dependency List-I (a) No attribute can be added (b) Uniquely identified a row (c) A constraint between two attribute (d) Group of attributes on the left hand side of arrow of function dependency. (A) 1 – d, 2 – b, 3 – a, 4 – c (B) 2 – d, 3 – a, 1 – b, 4 – c (C) 4 – a, 3 – b, 2 – c, 1 – d (D) 3 – a, 4 – b, 1 – c, 2 – d Answer: A
  3. A function that has no partial functional dependencies is in ……………. form. (A) 3 NF (B) 2 NF (C) 4 NF (D) BCNF Answer: B
  4. Which of the following statement is wrong? I. 2-phase locking protocol suffer from dead lock. II. Time stamp protocol suffer from more aborts. III. A block hole in a DFD is a data store with only inbound flows. IV. Multivalued dependency among attribute is checked at 3 NF level. V. An entity-relationship diagram is a tool to represent event model. (A) I, II, II (B) II, III, IV (C) III, IV, V (D) II, IV, V Answer: C
  5. (i) DML includes a query language based on both relation algebra and tuple calculus
  1. Aggregation is: (A) an abstraction through which relationships are treated as lower level entities (B) an abstraction through which relationships are treated as higher level entities (C) an abstraction through which relationships are not treated at all as entities (D) none of the above Answer: B
  2. Suppose R is a relation schema and F is a set of functional dependencies on R. Further, suppose R 1 and R 2 form a decomposition of R. Then the decomposition is a lossless join decomposition of R provided that: (A) R 1 ∩R 2 →R 1 is in F
    (B) R 1 ∩R 2 →R 2 is in F
    (C) both R 1 ∩R 2 →R 1 and R 1 ∩R 2 →R 2 functional dependencies are in F
    (D) at least one from R 1 ∩R 2 →R 1 and R 1 ∩R 2 →R 2 is in F+ Answer: D
  3. A superkey for an entity consists of: (A) one attribute only (B) at least two attributes (C) at most two attributes (D) one or more attributes Answer: D
  4. Which of the following set of keywords constitutes a mapping in SQL? (A) SELECT, FROM, TABLE (B) SELECT, FROM, WHERE (C) CONNECT, TABLE, CREATE (D) SELECT, TABLE, INSERT Answer: B
  5. If a relation is in 2NF then: (A) every candidate key is a primary key (B) every non-prime attribute is fully functionally dependent on each relation key (C) every attribute is functionally independent (D) every relational key is a primary key Answer: B
  6. Which of the following is true? (A) A relation in 3NF is always in BCNF (B) A relation in BCNF is always in 3NF (C) BCNF and 3NF are totally different (D) A relation in BCNF is in 2NF but not in 3NF Answer: B
  7. Consider the query : SELECT student_name FROM student_data WHERE rollno (SELECT rollno FROM student_marks WHERE SEM1_MARK=SEM2_MARK); Which of the following is true? (A) It gives the name of the student whose marks in semester 1 and semester 2 are same. (B) It gives all the names and roll nos of those students whose marks in semester 1 and semester 2 are same. (C) It gives the names of all the students whose marks in semester 1 and semester 2 are same. (D) It gives roll numbers of all students whose marks in semester 1 and semester 2 are same.

Answer: C

  1. A primary key for an entity is: (A) a candidate key (B) any attribute (C) a unique attribute (D) a super key Answer: C
  2. Aggregate functions in SQL are: (A) GREATEST, LEAST and ABS (B) SUM, COUNT and AVG (C) UPPER, LOWER and LENGTH (D) SQRT, POWER and MOD Answer: B
  3. If a relation is in 2NF and 3NF forms then: (A) no non-prime attribute is functionally dependent on other non-prime attributes (B) no non-prime attribute is functionally dependent on prime attributes (C) all attributes are functionally independent (D) prime attribute is functionally independent of all non-prime attributes Answer: A
  4. The end of an SQL command is denoted by: (A) an end-of-line character (B) an ‘enter-key’ marker (C) entering F4 key (D) a semicolon (;) Answer: D
  5. Consider the query : SELECT student_name FROM students WHERE class_name=(SELECT class_name FROM students WHERE math_marks=100); what will be the output? (A) the list of names of students with 100 marks in mathematics (B) the names of all students of all classes in which at least one student has 100 marks in mathematics (C) the names of all students in all classes having 100 marks in mathematics (D) the names and class of all students whose marks in mathematics is 100 Answer: B
  6. Which of the following statements is wrong? (A) 2-phase Locking Protocols suffer from deadlocks (B) Time-Stamp Protocols suffer from more aborts (C) Time-Stamp Protocols suffer from cascading roll back where as 2-Phase locking Protocol do not (D) None of these Answer: C
  7. A recursive foreign key is a: (A) references a relation (B) references a table (C) references its own relation (D) references a foreign key Answer: C
  8. A sub class having more than one super class is called:

Answer: A

  1. A relation R = {A, B, C, D, E, F} is given with following set of functional dependencies: F = {A→B, AD→C, B→F, A→E} Which of the following is candidate key? (A) A (B) AC (C) AD (D) None of these Answer: C
  2. Immediate updates as a recovery protocol is preferable, when: (A) Database reads more than writes (B) Writes are more than reads (C) It does not matter as it is good in both the situations (D) There are only writes Answer: B
  3. Which of the following statement is wrong? (A) 2 - phase locking protocol suffers from deadlocks (B) Time-Stamp protocol suffers from more abort (C) Time stamp protocol suffers from cascading rollbacks where as 2-phase locking protocol do not (D) None of these Answer: C
  4. Which data management language component enabled the DBA to define the schema components? (A) DML (B) Subschema DLL (C) Schema DLL (D) All of these Answer: C
  5. A subclass having more than one super class is called ................. (A) Category (B) Classification (C) Combination (D) Partial Participation Answer: A
  6. A schema describes: (A) data elements (B) records and files (C) record relationship (D) all of the above Answer: D
  7. One approach to standardizing storing of data: (A) MIS (B) CODASYL (C) Structured Programming (D) None of the above Answer: B
  8. In a relational schema, each tuple is divided in fields called: (A) Relations (B) Domains (C) Queries (D) All the above

Answer: B

  1. An embedded pointer provides: (A) Physical record key (B) An inserted Index (C) A secondary access path (D) All the above Answer: C
  2. A locked file can be: (A) accessed by only one user (B) modified by users with the correct password (C) is used to hide sensitive information (D) both (B) and (C) Answer: A
  3. An Entity - relationship diagram is a tool to represent: (A) Data model (B) Process model (C) Event model (D) Customer model Answer: A
  4. Which of the following tools is not required during system analysis phase of system development Life cycle? (A) CASE Tool (B) RAD Tool (C) Reverse engineering tool (D) None of these Answer: C
  5. A black hole in a DFD is a: (A) A data store with no inbound flows (B) A data store with only in bound flows (C) A data store with more than one in bound flow (D) None of these. Answer: B
  6. Multi-valued dependency among attribute is checked at which level? (A) 2 NF (B) 3 NF (C) 4 NF (D) 5 NF Answer: C
  7. A WINDOW into a portion of a data base is: (A) Schema (B) View (C) Query (D) Data Dictionary Answer: B
  8. The E-R model is expressed in terms of: (i) Entities (ii) The relationship among entities (iii) The attributes of the entities Then (A) (i) and (iii) (B) (i), (ii) and (iii) (C) (ii) and (iii)