0% found this document useful (0 votes)
19 views

dbms

The document consists of a series of questions and answers related to Database Management Systems (DBMS), covering definitions, functions, types, and commands associated with databases. It includes topics such as the structure of databases, types of data storage, SQL commands, and integrity constraints. Additionally, it provides explanations for certain concepts, enhancing the understanding of DBMS functionalities.

Uploaded by

zmd141479
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)
19 views

dbms

The document consists of a series of questions and answers related to Database Management Systems (DBMS), covering definitions, functions, types, and commands associated with databases. It includes topics such as the structure of databases, types of data storage, SQL commands, and integrity constraints. Additionally, it provides explanations for certain concepts, enhancing the understanding of DBMS functionalities.

Uploaded by

zmd141479
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/ 32

1

DBMS
1. What is the full form of DBMS?(b)
a) Data of Binary Management System
b) Database Management System
c) Database Management Service
d) Data Backup Management System

2. What is a database?(c)
a) Organized collection of information that cannot be accessed, updated, and managed
b) Collection of data or information without organizing
c) Organized collection of data or information that can be accessed, updated, and managed
d) Organized collection of data that cannot be updated

3. What is DBMS?(d)
a) DBMS is a collection of queries
b) DBMS is a high-level language
c) DBMS is a programming language
d) DBMS stores, modifies and retrieves data

4. Who created the first DBMS?(b)


a) Edgar Frank Codd
b) Charles Bachman
c) Charles Babbage
d) Sharon B. Codd

Explanation: Charles Bachman along with his team invented the first DBMS known as
Integrated Data Store (IDS).

5. Which type of data can be stored in the database?(d)


a) Image oriented data
b) Text, files containing data
c) Data in the form of audio or video
d) All of the above

6. In which of the following formats data is stored in the database management


system?(c)
a) Image
b) Text
c) Table
d) Graph

7. Which of the following is not a type of database?(d)


a) Hierarchical
b) Network
c) Distributed
2

d) Decentralized

Explanation: Different types are:


1) Centralized
2) Distributed
3) Relational
4) NoSQL
5) Cloud
6) Object-oriented
7) Hierarchical
8) Network

8. Which of the following is not an example of DBMS?d)


a) MySQL
b) Microsoft Acess
c) IBM DB2
d) Google

9. Which of the following is not a feature of DBMS?(c)


a) Minimum Duplication and Redundancy of Data
b) High Level of Security
c) Single-user Access only
d) Support ACID Property

10. Which of the following is a feature of the database?(b)


a) No-backup for the data stored
b) User interface provided
c) Lack of Authentication
d) Store data in multiple locations

11. Which of the following is not a function of the database?(d)


a) Managing stored data
b) Manipulating data
c) Security for stored data
d) Analysing code

12. Which of the following is a function of the DBMS?(d)


a) Storing data
b) Providing multi-users access control
c) Data Integrity
d) All of the above

13. Which of the following is a component of the DBMS?(d)


a) Data
b) Data Languages
c) Data Manager
d) All of the above
3

14. Which of the following is known as a set of entities of the same type that share
same properties, or attributes?(c)
a) Relation set
b) Tuples
c) Entity set
d) Entity Relation model

15. What is information about data called?(c)


a) Hyper data
b) Tera data
c) Meta data
d) Relations

16. What does an RDBMS consist of?(c)


a) Collection of Records
b) Collection of Keys
c) Collection of Tables
d) Collection of Fields

17. The values appearing in given attributes of any tuple in the referencing relation
must likewise occur in specified attributes of at least one tuple in the referenced
relation, according to _____________________ integrity constraint.(a)
a) Referential
b) Primary
c) Referencing
d) Specific

18. _____________ is a hardware component that is most important for the operation
of a database management system.(b)
a) Microphone
b) High speed, large capacity disk to store data
c) High-resolution video display
d) Printer

19. The DBMS acts as an interface between ________________ and


________________ of an enterprise-class system.(c)
a) Data and the DBMS
b) Application and SQL
c) Database application and the database
d) The user and the software

20. The ability to query data, as well as insert, delete, and alter tuples, is offered by
____________(d)
a) TCL (Transaction Control Language)
b) DCL (Data Control Language)
c) DDL (Data Definition Langauge)
d) DML (Data Manipulation Langauge)
4

21. ______________ is a set of one or more attributes taken collectively to uniquely


identify a record.(c)
a) Primary Key
b) Foreign key
c) Super key
d) Candidate key

22. Which command is used to remove a relation from an SQL?(a)


a) Drop table
b) Delete
c) Purge
d) Remove

23. Which of the following set should be associated with weak entity set for weak
entity to be meaningful?(d)
a) Neighbour set
b) Strong entity set
c) Owner set
d) Identifying set

24. Which of the following command is correct to delete the values in the relation
teaches?(a)
a) Delete from teaches;
b) Delete from teaches where Id =’Null’;
c) Remove table teaches;
d) Drop table teaches;

25. Procedural language among the following is __________(c)


a) Domain relational calculus
b) Tuple relational calculus
c) Relational algebra
d) Query language

26. _________________ operations do not preserve non-matched tuples.(b)


a) Left outer join
b) Inner join
c) Natural join
d) Right outer join

27. Which forms have a relation that contains information about a single entity?(a)
a) 4NF
b) 2NF
c) 5NF
d) 3NF

28. The top level of the hierarchy consists of ______ each of which can contain
_____.(d)
a) Schemas, Catalogs
5

b) Schemas, Environment
c) Environment, Schemas
d) Catalogs, Schemas

29. _______ indicates the maximum number of entities that can be involved in a
relationship.(c)
a) Greater Entity Count
b) Minimum cardinality
c) Maximum cardinality
d) ERD

30. The user IDs can be added or removed using which of the following fixed roles?
(b)
a) db_sysadmin
b) db_accessadmin
c) db_securityadmin
d) db_setupadmin

31. Why the following statement is erroneous?(a)

SELECT dept_name, ID, avg (salary)


FROM instructor
GROUP BY dept_name;

a) Dept_id should not be used in group by clause


b) Group by clause is not valid in this query
c) Avg(salary) should not be selected
d) None

32. The traditional storage of data organized by the customer, stored in separate
folders in filing cabinets is an example of ______________ type of ‘database’
management system.(d)
a) Object-oriented database management system
b) Relational database management system
c) Network database management system
d) Hierarchical database management system
.

33. After groups have been established, SQL applies predicates in the ___________
clause, allowing aggregate functions to be used.(b)
a) Where
b) Having
c) Group by
d) With

34. Which of the following is not the utility of DBMS?(a)


i) Backup ii) Loading iii) Process Organization iv) File organization
a) i, ii, and iv only
b) i, ii and iii only
6

c) i, iii and iv only


d) All i, ii, iii, and iv

\35. What does a foreign key combined with a primary key create?(a)
a) Network model between the tables that connect them
b) Parent-Child relationship between the tables that connects them
c) One to many relationship between the tables that connects them
d) All of the mentioned

36. Which of the following is correct according to the technology deployed by


DBMS?(c)
a) Pointers are used to maintain transactional integrity and consistency
b) Cursors are used to maintain transactional integrity and consistency
c) Locks are used to maintain transactional integrity and consistency
d) Triggers are used to maintain transactional integrity and consistency

37. Which of the following is correct regarding the file produced by a spreadsheet?(a)
a) can be used as it is by the DBMS
b) stored on disk in an ASCII text format
c) all of the mentioned
d) none of the mentioned

38. What is the function of the following command?(c)

Delete from r where P;

a) Clears entries from relation


b) Deletes relation
c) Deletes particular tuple from relation
d) All of the mentioned

39. ______ resembles Create view(a).


a) Create table . . . as
b) Create view as
c) Create table . . .like
d) With data

40. The query specifying the SQL view is said to be updatable if it meets which of the
following conditions?(d)
a) select clause contains relation attribute names but not have expressions, aggregates, or
distinct specification
b) from clause has 1 relation
c) query does not have group by or having clause
d) All of the mentioned

41. When the “ROLLUP” operator for expression or columns within a “GROUP BY”
clause is used?(c)
a) Find the groups that make up the subtotal in a row
7

b) Create group-wise grand totals for the groups indicated in a GROUP BY clause
c) Group expressions or columns specified in a GROUP BY clause in one direction, from
right to left, for computing the subtotals
d) To produce a cross-tabular report for computing subtotals by grouping phrases or
columns given within a GROUP BY clause in all available directions

42. Which of the following is the best way to represent the attributes in a large db?
a) Dot representation(b)
b) Concatenation
c) Relational-and
d) All of the mentioned

43. Which of the following is the subset of SQL commands used to manipulate Oracle
Structures, including tables?(d)
a) Data Described Language
b) Data Retrieval Language
c) Data Manipulation Language
d) Data Definition Language

44. Which of the following functions construct histograms and use buckets for
ranking?(a)
a) Ntil()
b) Newtil()
c) Rank()
d) All of the mentioned

Explanation: ntile(n) returns the number of the bucket in which each tuple is stored, with
bucket numbers beginning with 1.

45. __________ command is used in SQL to issue multiple CREATE TABLE, CREATE
VIEW and GRANT statements in a single transaction.(c)
a) CREATE CLUSTER
b) CREATE PACKAGE
c) CREATE SCHEMA
d) All of the mentioned

46. Which of the following key is required in to handle the data when the encryption
is applied to the data so that the unauthorised user cannot access the data?(c)
a) Primary key
b) Authorised key
c) Encryption key
d) Decryption key

47. Which of the following is known as the process of viewing cross-tab with a fixed
value of one attribute?(c)
a) Dicing
b) Pivoting
c) Slicing
8

d) Both Pivoting and Dicing

48. For designing a normal RDBMS which of the following normal form is considered
adequate?(b)
a) 4NF
b) 3NF
c) 2NF
d) 5NF

49. Which of the following is popular for applications such as storage of log files in a
database management system since it offers the best write performance?(b)
a) RAID level 0
b) RAID level 1
c) RAID level 2
d) RAID level 3

Explanation: RAID level 0 refers to data stripping. RAID level 1 refers to disk mirroring with
block striping. RAID level 2 refers to bit-level stripping and RAID level 3 refers to byte-level
striping with dedicated parity.

50. Which of the following represents a query in the tuple relational calculus?(b)
a) { }{P(t) | t }
b) {t | P(t)}
c) t | P() | t
d) All of the mentioned

51. The oldest DB model is _______________(a)


a) Network
b) Physical
c) Hierarchical
d) Relational

52. Evaluate the statements issued by the DBA in the given sequence if OE and
SCOTT are the users and the ORDERS table is owned by OE.(c)

CREATE ROLE r1;


GRANT SELECT, INSERT ON oe. orders TO r1;
GRANT r1 TO scott;
GRANT SELECT ON oe. orders TO scott;
REVOKE SELECT ON oe.orders FROM scott;

What would be the outcome after executing the statements?


a) The REVOKE statement would give an error because the SELECT privilege has been
granted to the role R1
b) The REVOKE statement would remove the SELECT privilege from SCOTT as well as
from the role R1
c) SCOTT would be able to query the OE.ORDERS table
9

d) SCOTT would not be able to query the OE.ORDERS table

53. Which of the following establishes a top-to-bottom relationship among the items?
(c)
a) Relational schema
b) Network schema
c) Hierarchical schema
d) All of the mentioned

54. A major goal of the db system is to minimize the number of block transfers
between the disk and memory. Which of the following helps in achieving this goal?
(d)
a) Secondary storage
b) Storage
c) Catalog
d) Buffer

55. What happens if a piece of data is stored in two places in the db?(a)
a) Storage space is wasted & Changing the data in one spot will cause data inconsistency
b) In can be more easily accessed
c) Changing the data in one spot will cause data inconsistency
d) Storage space is wasted

56. The logical design, and the snapshot of the data at a given instant in time is
known as?(d)
a) Instance & Relation
b) Relation & Schema
c) Domain & Schema
d) Schema & Instance

1. A relational database consists of a collection of(a)


a) Tables
b) Fields
c) Records
d) Keys

2. A ________ in a table represents a relationship among a set of values.(c)


a) Column
b) Key
c) Row
d) Entry

3. The term _______ is used to refer to a row.(b)


a) Attribute
b) Tuple
c) Field
10

d) Instance

4. The term attribute refers to a ___________ of a table.(b)


a) Record
b) Column
c) Tuple
d) Key

5. For each attribute of a relation, there is a set of permitted values, called the
________ of that attribute.(a)
a) Domain
b) Relation
c) Set
d) Schema

6. Database __________ which is the logical design of the database, and the database
_______ which is a snapshot of the data in the database at a given instant in time.(d)
a) Instance, Schema
b) Relation, Schema
c) Relation, Domain
d) Schema, Instance

7. Course(course_id,sec_id,semester)
Here the course_id,sec_id and semester are __________ and course is a
_________(b)
a) Relations, Attribute
b) Attributes, Relation
c) Tuple, Relation
d) Tuple, Attributes

8. Department (dept name, building, budget) and Employee (employee_id, name, dept
name, salary)
Here the dept_name attribute appears in both the relations. Here using common
attributes in relation schema is one way of relating ___________ relations.(c)
a) Attributes of common
b) Tuple of common
c) Tuple of distinct
d) Attributes of distinct

9. A domain is atomic if elements of the domain are considered to be ____________


units.(b)
a) Different
b) Indivisbile
c) Constant
d) Divisible

10. The tuples of the relations can be of ________ order.(a)


a) Any
11

b) Same
c) Sorted
d) Constant

1. Using which language can a user request information from a database?(a)


a) Query
b) Relational
c) Structural
d) Compiler

2. Student(ID, name, dept name, tot_cred)


In this query which attributes form the primary key?(d)
a) Name
b) Dept
c) Tot_cred
d) ID

3. Which one of the following is a procedural language?(c)


a) Domain relational calculus
b) Tuple relational calculus
c) Relational algebra
d) Query language

4. The_____ operation allows the combining of two relations by merging pairs of


tuples, one from each relation, into a single tuple.(b)
a) Select
b) Join
c) Union
d) Intersection

5. The result which operation contains all pairs of tuples from the two relations,
regardless of whether their attribute values match.(b)
a) Join
b) Cartesian product
c) Intersection
d) Set difference

6. The _______operation performs a set union of two “similarly structured” tables(a)


a) Union
b) Join
c) Product
d) Intersect

7. The most commonly used operation in relational algebra for projecting a set of
tuple from a relation is(c)
a) Join
b) Projection
12

c) Select
d) Union

8. The _______ operator takes the results of two queries and returns only rows that
appear in both result sets.(b)
a) Union
b) Intersect
c) Difference
d) Projection

9. A ________ is a pictorial depiction of the schema of a database that shows the


relations in the database, their attributes, and primary keys and foreign keys.(a)
a) Schema diagram
b) Relational algebra
c) Database diagram
d) Schema flow

10. The _________ provides a set of operations that take one or more relations as
input and return a relation as an output.(b)
a) Schematic representation
b) Relational algebra
c) Scheme diagram
d) Relation flow

1. Which one of the following is used to define the structure of the relation, deleting
relations and relating schemas?(b)
a) DML(Data Manipulation Langauge)
b) DDL(Data Definition Langauge)
c) Query
d) Relational Schema

2. 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)
a) DML(Data Manipulation Langauge)
b) DDL(Data Definition Langauge)
c) Query
d) Relational Schema
.

3.

CREATE TABLE employee (name VARCHAR, id INTEGER)

What type of statement is this?(b)


a) DML
b) DDL
c) View
13

d) Integrity constraint

4.

SELECT * FROM employee

What type of statement is this?(a)


a) DML
b) DDL
c) View
d) Integrity constraint

5. The basic data type char(n) is a _____ length character string and varchar(n) is
_____ length character.(c)
a) Fixed, equal
b) Equal, variable
c) Fixed, variable
d) Variable, equal

6. An attribute A of datatype varchar(20) has the value “Avi”. The attribute B of


datatype char(20) has value ”Reed”. Here attribute A has ____ spaces and attribute B
has ____ spaces.(a)
a) 3, 20
b) 20, 4
c) 20, 20
d) 3, 4

7. To remove a relation from an SQL database, we use the ______ command.(d)


a) Delete
b) Purge
c) Remove
d) Drop table

8.

DELETE FROM r; //r - relation

This command performs which of the following action?(b)


a) Remove relation
b) Clear relation entries
c) Delete fields
d) Delete rows

9.

INSERT INTO instructor VALUES (10211, ’Smith’, ’Biology’, 66000);

What type of statement is this?(b)


a) Query
14

b) DML
c) Relational
d) DDL

10. Updates that violate __________ are disallowed.(a)


a) Integrity constraints
b) Transaction control
c) Authorization
d) DDL constraints

1.

Name

Annie

Bob

Callie

Derek

Which of these query will display the the table given above ?(c)
a) Select employee from name
b) Select name
c) Select name from employee
d) Select employee

2. Here which of the following displays the unique values of the column?(c)

SELECT ________ dept_name


FROM instructor;
a) All
b) From
c) Distinct
d) Name

3. The ______ clause allows us to select only those rows in the result relation of the
____ clause that satisfy a specified predicate.(a)
a) Where, from
b) From, select
15

c) Select, from
d) From, where

4. The query given below will not give an error. Which one of the following has to be
replaced to get the desired output?(c)

SELECT ID, name, dept name, salary * 1.1


WHERE instructor;
a) Salary*1.1
b) ID
c) Where
d) Instructor

5. The ________ clause is used to list the attributes desired in the result of a query.(b)
a) Where
b) Select
c) From
d) Distinct

6. This Query can be replaced by which one of the following?(b)

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;

7.

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


Which of the following fields are displayed as output?(d)
a) Salary, dept_id
b) Employee
c) Salary
d) All the field of employee relation

8.

Employee_id Name Salary

1001 Annie 6000


16

1009 Ross 4500

1018 Zeith 7000

This is Employee table.


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

SELECT * FROM employee WHERE employee_id>1009;


a) 1009, 1001, 1018
b) 1009, 1018
c) 1001
d) 1018

9. Which of the following statements contains an error?(d)


a) Select * from emp where empid = 10003;
b) Select empid from emp where empid = 10006;
c) Select empid from emp;
d) Select empid where empid = 1009 and lastname = ‘GELLER’;

10. In the given query which of the keyword has to be inserted?(b)

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


a) Table
b) Values
c) Relation
d) Field

1.

SELECT name ____ instructor name, course id


FROM instructor, teaches
WHERE instructor.ID= teaches.ID;
Which keyword must be used here to rename the field name?(c)
a) From
b) Rename
c) As
d) Join

2.

SELECT * FROM employee WHERE dept_name="Comp Sci";


In the SQL given above there is an error . Identify the error.(c)
a) Dept_name
b) Employee
c) “Comp Sci”
17

d) From

3.

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)
a) %
b) _
c) ||
d) $

4. ’_ _ _ ’ matches any string of ______ three characters. ’_ _ _ %’ matches any string


of at ______ three characters.(b)
a) Atleast, Exactly
b) Exactly, Atleast
c) Atleast, All
d) All, Exactly
.

5.

SELECT name
FROM instructor
WHERE dept name = ’Physics’
ORDER BY name;
By default, the order by clause lists items in ______ order.(d)
a) Descending
b) Any
c) Same
d) Ascending
6.

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?(c)
a) Ascending, Descending
b) Asc, Desc
c) Desc, Asc
d) Descending, Ascending

7.

SELECT name
FROM instructor
18

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;

Answer: a

8.

SELECT instructor.*
FROM instructor, teaches
WHERE instructor.ID= teaches.ID;
This query does which of the following operation?(b)
a) All attributes of instructor and teaches are selected
b) All attributes of instructor are selected on the given condition
c) All attributes of teaches are selected on given condition
d) Only the some attributes from instructed and teaches are selected

9. In SQL the spaces at the end of the string are removed by _______ function.(c)
a) Upper
b) String
c) Trim
d) Lower

10. _____ operator is used for appending two strings(c).


a) &
19

b) %
c) ||
d) _
1. The union operation is represented by(b)
a) ∩
b) U
c) –
d) *

2. The intersection operator is used to get the _____ tuples.(b)


a) Different
b) Common
c) All
d) Repeating

3. The union operation automatically __________ unlike the select clause.(d)


a) Adds tuples
b) Eliminates unique tuples
c) Adds common tuples
d) Eliminates duplicate

4. If we want to retain all duplicates, we must write ________ in place of union.(a)


a) Union all
b) Union some
c) Intersect all
d) Intersect some

(SELECT course id
FROM SECTION
WHERE semester = ’Fall’ AND YEAR= 2009)
EXCEPT
(SELECT course id
FROM SECTION
WHERE semester = ’Spring’ AND YEAR= 2010);
This query displays (d)
a) Only tuples from second part
b) Only tuples from the first part which has the tuples from second part
c) Tuples from both the parts
d) Tuples from first part which do not have second part

6. For like predicate which of the following is true.(c)

i) % matches zero OF more characters.


ii) _ matches exactly one CHARACTER.
a) i-only
b) ii-only
c) i & ii
d) None of the mentioned
20

7. The number of attributes in relation is called as its(b)


a) Cardinality
b) Degree
c) Tuples
d) Entity

8. _____ clause is an additional filter that is applied to the result.(c)


a) Select
b) Group-by
c) Having
d) Order by

9. _________ joins are SQL server default(b)


a) Outer
b) Inner
c) Equi
d) None of the mentioned

10. The _____________ is essentially used to search for patterns in target string.(a)
a) Like Predicate
b) Null Predicate
c) In Predicate
d) Out Predicate

1. A _____ indicates an absent value that may exist but be unknown or that may not
exist at all.(c)
a) Empty tuple
b) New value
c) Null value
d) Old value

2. If the attribute phone number is included in the relation all the values need not be
entered into the phone number column. This type of entry is given as(c)
a) 0
b) –
c) Null
d) Empty space

3. The predicate in a where clause can involve Boolean operations such as and. The
result of true and unknown is_______ false and unknown is _____ while unknown
and unknown is _____(d)
a) Unknown, unknown, false
b) True, false, unknown
c) True, unknown, unknown
d) Unknown, false, unknown

4.
21

SELECT name
FROM instructor
WHERE salary IS NOT NULL;
Selects
a) Tuples with null value
b) Tuples with no null values
c) Tuples with any salary
d) All of the mentioned

Answer: b

5. In an employee table to include the attributes whose value always have some value
which of the following constraint must be used?(b)
a) Null
b) Not null
c) Unique
d) Distinct

6. Using the ______ clause retains only one copy of such identical tuples.(d)
a) Null
b) Unique
c) Not null
d) Distinct

7.

CREATE TABLE employee (id INTEGER,name VARCHAR(20),salary NOT NULL);


INSERT INTO employee VALUES (1005,Rach,0);
INSERT INTO employee VALUES (1007,Ross, );
INSERT INTO employee VALUES (1002,Joey,335);
Some of these insert statements will produce an error. Identify the statement.(c)
a) Insert into employee values (1005,Rach,0);
b) Insert into employee values (1002,Joey,335);
c) Insert into employee values (1007,Ross, );
d) None of the mentioned

8. The primary key must be(c)


a) Unique
b) Not null
c) Both Unique and Not null
d) Either Unique or Not null

9. You attempt to query the database with this command:

SELECT nvl (100 / quantity, NONE)


FROM inventory;
Why does this statement cause an error when QUANTITY values are null?(a)
a) The expression attempts to divide by a null value
22

b) The data types in the conversion function are incompatible


c) The character string none should be enclosed in single quotes (‘ ‘)
d) A null value used in an expression cannot be converted to an actual value

10. The result of _____unknown is unknown.(d)


a) Xor
b) Or
c) And
d) Not

1. Aggregate functions are functions that take a ___________ as input and return a
single value.(a)
a) Collection of values
b) Single value
c) Aggregate value
d) Both Collection of values & Single value

2.

SELECT __________
FROM instructor
WHERE dept name= ’Comp. Sci.’;
Which of the following should be used to find the mean of the salary ?(b)
a) Mean(salary)
b) Avg(salary)
c) Sum(salary)
d) Count(salary)

SELECT COUNT (____ ID)


FROM teaches
WHERE semester = ’Spring’ AND YEAR = 2010;
If we do want to eliminate duplicates, we use the keyword ______in the aggregate
expression.
a) Distinct
b) Count
c) Avg
d) Primary key

Answer: a

4. All aggregate functions except _____ ignore null values in their input collection.(b)
a) Count(attribute)
b) Count(*)
c) Avg
d) Sum

5. A Boolean data type that can take values true, false, and________(d)
a) 1
23

b) 0
c) Null
d) Unknown

6. The ____ connective tests for set membership, where the set is a collection of
values produced by a select clause. The ____ connective tests for the absence of set
membership.(c)
a) Or, in
b) Not in, in
c) In, not in
d) In, or

7. Which of the following should be used to find all the courses taught in the Fall 2009
semester but not in the Spring 2010 semester .
a)

SELECT DISTINCT course id


FROM SECTION
WHERE semester = ’Fall’ AND YEAR= 2009 AND
course id NOT IN (SELECT course id
FROM SECTION
WHERE semester = ’Spring’ AND YEAR= 2010);
b)

SELECT DISTINCT course_id


FROM instructor
WHERE name NOT IN (’Fall’, ’Spring’);
c)

(SELECT course id
FROM SECTION
WHERE semester = ’Spring’ AND YEAR= 2010)
d)

SELECT COUNT (DISTINCT ID)


FROM takes
WHERE (course id, sec id, semester, YEAR) IN (SELECT course id, sec id,
semester, YEAR
FROM teaches
WHERE teaches.ID= 10101);
View Answer

Answer: a

8. The phrase “greater than at least one” is represented in SQL by _____(d)


a) < all
b) < some
24

c) > all
d) > some

9. Which of the following is used to find all courses taught in both the Fall 2009 semester
and in the Spring 2010 semester .
a)

SELECT course id
FROM SECTION AS S
WHERE semester = ’Fall’ AND YEAR= 2009 AND
EXISTS (SELECT *
FROM SECTION AS T
WHERE semester = ’Spring’ AND YEAR= 2010 AND
S.course id= T.course id);
b)

SELECT name
FROM instructor
WHERE salary > SOME (SELECT salary
FROM instructor
WHERE dept name = ’Biology’);
c)

SELECT COUNT (DISTINCT ID)


FROM takes
WHERE (course id, sec id, semester, YEAR) IN (SELECT course id, sec id,
semester, YEAR
FROM teaches
WHERE teaches.ID= 10101);
d)

(SELECT course id
FROM SECTION
WHERE semester = ’Spring’ AND YEAR= 2010)
View Answer

Answer: a

10. We can test for the nonexistence of tuples in a subquery by using the _____
construct.(b)
a) Not exist
b) Not exists
c) Exists
d) Exist
25

1.

SELECT dept_name, ID, avg (salary)


FROM instructor
GROUP BY dept_name;
This statement IS erroneous because
a) Avg(salary) should not be selected
b) Dept_id should not be used in group by clause
c) Misplaced group by clause
d) Group by clause is not valid in this query

Answer: b

2. SQL applies predicates in the _______ clause after groups have been formed, so
aggregate functions may be used.(d)
a) Group by
b) With
c) Where
d) Having

3. Aggregate functions can be used in the select list or the_______clause of a select


statement or subquery. They cannot be used in a ______ clause.(b)
a) Where, having
b) Having, where
c) Group by, having
d) Group by, where

4. The ________ keyword is used to access attributes of preceding tables or


subqueries in the from clause.(b)
a) In
b) Lateral
c) Having
d) With

Eg : SELECT name, salary, avg salary


FROM instructor I1, lateral (SELECT avg(salary) AS avg salary
FROM instructor I2
WHERE I2.dept name= I1.dept name);
Without the lateral clause, the subquery cannot access the correlation variable
I1 from the outer query.

5. Which of the following creates a temporary relation for the query on which it is
defined?(a)
a) With
b) From
c) Where
d) Select
26

6.

WITH max_budget (VALUE) AS


(SELECT MAX(budget)
FROM department)
SELECT budget
FROM department, max_budget
WHERE department.budget = MAX budget.value;
In the query given above which one of the following is a temporary relation?(d)
a) Budget
b) Department
c) Value
d) Max_budget

7. Subqueries cannot(c)
a) Use group by or group functions
b) Retrieve data from a table different from the one in the outer query
c) Join tables
d) Appear in select, update, delete, insert statements.

8. Which of the following is not an aggregate function?(c)


a) Avg
b) Sum
c) With
d) Min

9. The EXISTS keyword will be true if:(a)


a) Any row in the subquery meets the condition only
b) All rows in the subquery fail the condition only
c) Both of these two conditions are met
d) Neither of these two conditions is met

10. How can you find rows that do not match some specified condition?(b)
a) EXISTS
b) Double use of NOT EXISTS
c) NOT EXISTS
d) None of the mentioned

1. A Delete command operates on ______ relation.(a)


a) One
b) Two
c) Several
d) Null

2.Delete from r where P;The above command(a)


a) Deletes a particular tuple from the relation
b) Deletes the relation
27

c) Clears all entries from the relation


d) All of the mentioned

3. Which one of the following deletes all the entries but keeps the structure of the
relation.(d)
a) Delete from r where P;
b) Delete from instructor where dept name= ’Finance’;
c) Delete from instructor where salary between 13000 and 15000;
d) Delete from instructor;

4. Which of the following is used to insert a tuple from another relation?


a)

INSERT INTO course (course id, title, dept name, credits)


VALUES (’CS-437’, ’DATABASE Systems’, ’Comp. Sci.’, 4);
b)

INSERT INTO instructor


SELECT ID, name, dept name, 18000
FROM student
WHERE dept name = ’Music’ AND tot cred > 144;
c)

INSERT INTO course VALUES (’CS-437’, ’DATABASE Systems’, ’Comp. Sci.’, 4);
d) Not possible

Answer: b

5. 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) None of the mentioned
28

Answer: c

6.

UPDATE instructor
_____ salary= salary * 1.05;
Fill in with correct keyword to update the instructor relation.(b)
a) Where
b) Set
c) In
d) Select

7. _________ are useful in SQL update statements, where they can be used in the set
clause.(d)
a) Multiple queries
b) Sub queries
c) Update
d) Scalar subqueries

8. The problem of ordering the update in multiple updates is avoided using(c)


a) Set
b) Where
c) Case
d) When

9. Which of the following is the correct format for case statements.


a)

CASE
WHEN pred1 ... result1
WHEN pred2 ... result2
. . .
WHEN predn ... resultn
ELSE result0
END
b)

CASE
WHEN pred1 THEN result1
WHEN pred2 THEN result2
. . .
WHEN predn THEN resultn
ELSE result0
END
c)
29

CASE
WHEN pred1 THEN result1
WHEN pred2 THEN result2
. . .
WHEN predn THEN resultn
ELSE result0
d) All of the mentioned

Answer: b

10. 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)
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 mentioned

1. The____condition allows a general predicate over the relations being joined.(a)


a) On
b) Using
c) Set
d) Where

2. Which of the join operations do not preserve non matched tuples?(c)


a) Left outer join
b) Right outer join
c) Inner join
d) Natural join

3.
30

SELECT *
FROM student JOIN takes USING (ID);
The above query is equivalent to
a)

SELECT *
FROM student INNER JOIN takes USING (ID);
b)

SELECT *
FROM student OUTER JOIN takes USING (ID);
c)

SELECT *
FROM student LEFT OUTER JOIN takes USING (ID);
d) None of the mentioned

Answer: a

4. What type of join is needed when you wish to include rows that do not have
matching values?(c)
a) Equi-join
b) Natural join
c) Outer join
d) All of the mentioned

5. How many tables may be included with a join?(d)


a) One
b) Two
c) Three
d) All of the mentioned

6. Which are the join types in join condition(d)


a) Cross join
b) Natural join
c) Join with USING clause
d) All of the mentioned

7. How many join types in join condition(d)


a) 2
b) 3
c) 4
d) 5

Explanation: Types are inner join, left outer join, right outer join, full join, cross join.
31

8. Which join refers to join records from the right table that have no matching key in
the left table are include in the result set(b)
a) Left outer join
b) Right outer join
c) Full outer join
d) Half outer join

9. The operation which is not considered a basic operation of relational algebra is(a)
a) Join
b) Selection
c) Union
d) Cross product

10. In SQL the statement select * from R, S is equivalent to(b)


a) Select * from R natural join S
b) Select * from R cross join S
c) Select * from R union join S
d) Select * from R inner join S

1. Which of the following creates a virtual relation for storing the query?(b)
a) Function
b) View
c) Procedure
d) None of the mentioned

2. Which of the following is the syntax for views where v is view name?(c)
a) Create view v as “query name”;
b) Create “query expression” as view;
c) Create view v as “query expression”;
d) Create view “query expression”;

3.

SELECT course_id
FROM physics_fall_2009
WHERE building= ’Watson’;
Here the tuples are selected from the view.Which one denotes the view.(c)
a) Course_id
b) Watson
c) Building
d) physics_fall_2009

4. Materialised views make sure that(b)


a) View definition is kept stable
b) View definition is kept up-to-date
c) View definition is verified for error
d) View is deleted after specified time
32

5. Updating the value of the view(a)


a) Will affect the relation from which it is defined
b) Will not change the view definition
c) Will not affect the relation from which it is defined
d) Cannot determine

6. SQL view is said to be updatable (that is, inserts, updates or deletes can be applied
on the view) if which of the following conditions are satisfied by the query defining
the view?(d)
a) The from clause has only one database relation
b) The query does not have a group by or having clause
c) The select clause contains only attribute names of the relation and does not have any
expressions, aggregates, or distinct specification
d) All of the mentioned

7. Which of the following is used at the end of the view to reject the tuples which do
not satisfy the condition in where clause?(c)
a) With
b) Check
c) With check
d) All of the mentioned

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy