Relational DataBase | Multiple Choice Questions With Answer









A database is an organized collection of _______________.

a. data

b. Attributes

c. Record

d. None of the above

 

ANSWER : a (data)

 

 

 

 

 

 

In the relational model, the row of the table is known to be

A. Relation

B. Attribute

C. Tuple

D. Entity field

 

ANSWER: C

 

 

 

 

 

 

 A relational database consists of a collection of

A. Tables

B. Fields

C. Records

D. Keys

 

ANSWER: A

 

 

 

 

 

 

A ________ in a table represents a relationship among a set of values.

A. Column

B. Key

C. Row

D. Entry

 

ANSWER: C

 

 

 

 

 

 

The term _______ is used to refer to a row.

A. Attribute

B. Tuple

C. Field

D. Instance

 

ANSWER: B

 

 

 

 

 

 

 

The term attribute refers to a ___________ of a table.

A. Record

B. Column

C. Tuple

D. Key

 

ANSWER: B

 

 

 

 

 

 

In the __________ normal form, a composite attribute is converted to individual attributes.

A. First

B. Second

C. Third

D. Fourth

ANSWER: A

 

 

 

 

 

 

Tables in second normal form (2NF):

A. Eliminate all hidden dependencies

B. Eliminate the possibility of a insertion anomalies

C. Have a composite key

D. Have all non key fields depend on the whole primary key

 

ANSWER: A

 

 

 

 

 

 

Functional Dependencies are the types of constraints that are based on______

A. Key

B. Key revisited

C. Superset key

D. None of these

 

ANSWER: A

 

 

 

 

 

 

 

Which of the following creates a virtual table for storing the query ?

A. Function

B. View

C. Procedure

D. None of the mentioned

 

ANSWER: B

 

 

 

 

 

Which of the following software is appropriate to store data about school students?

a. MS-Access

b. Writer

c. Calc

d. Impress

 

ANSWER :. a. MS-Access

 

 

 

 

 

 

Which of the following is not a database programs?

a. MySQL

b. Oracle

c. Writer

d. OObase

 

ANSWER :. c. Writer

 

 

 

 

 

 

__________ store data in Single table.

a. Flat File

b. Relational

c. Single File

d. One File

 

ANSWER :. a. Flat File

 

 

 

 

 

 

 ___________ are dedicated computers that hold the actual databases and run only DBMS and related Software.

a. Main Server

b. Web Server

c. Database Server

d. Non Database Server

 

ANSWER :. c. Database Server

 

 

 

 

 

 

GUI act as front end and database server act as _____

a. Container

b. Back End

c. End

d. None of the above

 

ANSWER : b. Back End

 

 

 

 

 

 

Duplication of data is called _________.

a. Inconsistency

b. Consistency

c. Redundancy

d. Foreign Key

 

ANSWER : c. Redundancy

 

 

 

 

 

 

Which of the following is not the advantage of database?

a. Sharing of Data

b. Reduce Data Redundancy

c. Increase Data Inconsistency

d. Data Security

 

ANSWER :. c. Increase Data Inconsistency

 

 

 

 

 

Data Integrity means that data is accurate and consistent in the database.(T/F)

a. True

b. False

 

ANSWER :. a. True

 

 

 

 

 

 

 

 

A database can have only one table.(T/F)

a. True

b. False

 

ANSWER :. b. False

 

 

 

 

 

 

 

 

A relational database consists of a collection of

a) Tables

b) Fields

c) Records

d) Keys

 

Answer:a

Explanation:Fields are the column of the relation or tables.Records

are each row in relation.Keys are the constraints in a relation .

 

 

 

A ________ in a table represents a relationship among a

set of values.

a) Column

b) Key

c) Row

d) Entry

Answer:c

Explanation:Column has only one set of values.Keys are constraints

and row is one whole set of attributes.Entry is just a piece of data.

 

 

The term _______ is used to refer to a row.

a) Attribute

b) Tuple

c) Field

d) Instance

 

Answer:b

Explanation:Tuple is one entry of the relation with several attributes

which are fields.

 

 

 

The term attribute refers to a ___________ of a table.

a) Record

b) Column

c) Tuple

d) Key

 

Answer:b

Explanation:Attribute is a specific domain in the relation which has

entries of all tuples.

 

 

 

For each attribute of a relation, there is a set of permitted

values, called the ________ of that attribute.

a) Domain

b) Relation

c) Set

d) Schema

 

Answer:a

Explanation:The values of the attribute should be present in the

domain.Domain is a set of values permitted .

 

 

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.

a) Instance, Schema

b) Relation, Schema

c) Relation, Domain

d) Schema, Instance

Answer:d

Explanation:Instance is a instance of time and schema is a

representation.

Course(course_id,sec_id,semester)

Here the course_id,sec_id and semester are __________

and course is a _________ .

a) Relations, Attribute

b) Attributes, Relation

c) Tuple, Relation

d) Tuple, Attributes

Answer:b

Explanation:The relation course has a set of attributes

course_id,sec_id,semester .

 

 

 

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.

a) Attributes of common

b) Tuple of common

c) Tuple of distinct

d) Attributes of distinct

Answer:c

Explanation:Here the relations are connected by the common

attributes.

A domain is atomic if elements of the domain are

considered to be ____________ units.

a) Different

b) Indivisbile

c) Constant

d) Divisible

Answer:b

Explanation:None.

 

 

 

 

 

The tuples of the relations can be of ________ order.

a) Any

b) Same

c) Sorted

d) Constant

Answer:a

Explanation:The values only count .The order of the tuples does not

matter.

 

 

 

 

Which one of the following is a set of one or more

attributes taken collectively to uniquely identify a record?

a) Candidate key

b) Sub key

c) Super key

d) Foreign key

Answer:c

Explanation:Super key is the superset of all the keys in a relation.

 

 

 

Consider attributes ID , CITY and NAME . Which one of

this can be considered as a super key ?

a) NAME

b) ID

c) CITY

d) CITY , ID

Answer:b

Explanation:Here the id is the only attribute which can be taken as a

key. Other attributes are not uniquely identified .

 

 

 

The subset of super key is a candidate key under what

condition ?

a) No proper subset is a super key

b) All subsets are super keys

c) Subset is a super key

d) Each subset is a super key

Answer:a

Explanation:The subset of a set cannot be the same set.Candidate key

is a set from a super key which cannot be the whole of the super set

 

 

 

A _____ is a property of the entire relation, rather than

of the individual tuples in which each tuple is unique.

a) Rows

b) Key

c) Attribute

d) Fields

Answer:b

Explanation:Key is the constraint which specifies uniqueness.

 

 

 

Which one of the following attribute can be taken as a

primary key ?

a) Name

b) Street

c) Id

d) Department

Answer:c

Explanation:The attributes name , street and department can repeat

for some tuples.But the id attribute has to be unique .So it forms a

primary key.

 

 

Which one of the following cannot be taken as a primary

key ?

a) Id

b) Register number

c) Dept_id

d) Street

Answer:d

Explanation:Street is the only attribute which can occur more than

once.

 

 

 

A attribute in a relation is a foreign key if the _______

key from one relation is used as an attribute in that relation

.

a) Candidate

b) Primary

c) Super

d) Sub

Answer:b

Explanation:The primary key has to be referred in the other relation

to form a foreign key in that relation .

 

 

 

The relation with the attribute which is the primary key

is referenced in another relation. The relation which has

the attribute as primary key is called

a) Referential relation

b) Referencing relation

c) Referenced relation

d) Referred relation

Answer:b

Explanation:None.

 

 

 

The ______ is the one in which the primary key of one

relation is used as a normal attribute in another relation .

a) Referential relation

b) Referencing relation

c) Referenced relation

d) Referred relation

Answer:c

Explanation:None.

 

 

 

 

A _________ integrity constraint requires that the values appearing in specified attributes of any tuple in the referencing relation also appear in specified attributes of at least one tuple in the referenced relation.

a) Referential

b) Referencing

c) Specific

d) Primary

Answer:a

Explanation:A relation, say r1, may include among its attributes the primary key of another relation, say r2. This attribute is called a foreign key from r1, referencing r2. The relation r1 is also called the referencing relation of the foreign key dependency, and r2 is called the referenced relation of the foreign key.

 

Using which language can a user request information

from a database ?

a) Query

b) Relational

c) Structural

d) Compiler

Answer:a

Explanation:Query language is a method through which the database

entries can be accessed.

 

 

 

 

Student(ID, name, dept name, tot_cred)

In this query which attribute form the primary key?

a) Name

b) Dept

c) Tot_cred

d) ID

Answer:d

Explanation:The attributes name ,dept and tot_cred can have same

values unlike ID .

 

 

 

Which one of the following is a procedural language ?

a) Domain relational calculus

b) Tuple relational calculus

c) Relational algebra

d) Query language

Answer:c

Explanation:Domain and Tuple relational calculus are non-procedural

language.Query language is a method through which the database

entries can be accessed.

 

 

 

The_____ operation allows the combining of two

relations by merging pairs of tuples, one from each

relation, into a single tuple.

a) Select

b) Join

c) Union

Answer:b

Explanation:Join finds the common tuple in the relations and

combines it.

 

 

 

The result which operation contains all pairs of tuples

from the two relations, regardless of whether their

attribute values match.

a) Join

b) Cartesian product

c) Intersection

d) Set difference

Answer:b

Explanation:Cartesian product is the multiplication of all the values in

the attributes.

 

 

 

The _______operation performs a set union of two

“similarly structured” tables

a) Union

b) Join

c) Product

d) Intersect

Answer:a

Explanation:Union just combines all the values of relations of same

attributes.

 

 

 

The most commonly used operation in relational

algebra for projecting a set of tuple from a relation is

a) Join

b) Projection

c) Select

d) Union

Answer:c

Explanation:Select is used to view the tuples of the relation with or

without some constraints.

 

 

The _______ operator takes the results of two queries

and returns only rows that appear in both result sets.

a) Union

b) Intersect

c) Difference

d) Projection

Answer:b

Explanation:The union operator gives the result which is the union of

two queries and difference is the one where query which is not a part

of second query .

 

 

What is the purpose of index in SQL?

A. To enhance the query performance

B. To provide an index to a record

C. To perform fast searches

D. All of the above

ANSWER: D

 

 

 

 

 

 

 

What is the full form of SQL?

A. Structured Query Language

B. Structured Query List

C. Simple Query Language

D. None of these

ANSWER: A

 

 

 

 

 

 

 

Which operator performs pattern matching?

A. BETWEEN

B. LIKE

C. IN

D. AND

ANSWER: B

 

 

 

 

 

 

 

What operator tests column for the absence of data?

A. ISNULL

B. IN

C. AND

D. NOT

ANSWER: A

 

 

 

 

 

 

In SQL, which of the following is not a Data Definition Language(DDL) commands?

A. UPDATE

B. CREATE

C. GRANT

D. REVOKE

ANSWER: A

 

 

 

 

 

In SQL, which command is used to SELECT only one copy of each set of duplicable rows

A. SELECT UNIQUE

B. SELECT DIFFERENT

C. SELECT DISTINCT

D. All of the above

ANSWER: A

 

 

 

 

 

 

 

A command that lets you change one or more fields in a record is

A. Insert

B. Modify

C. Look-up

D. Select

ANSWER: B

 

 

 

 

 

 

 

 

Which of the SQL statement is correct?

A. SELECT Username AND Password FROM Student

B. SELECT Username, Password WHERE Username = 'HICAS’

C. SELECT Username, Password FROM Student

D. None of these

ANSWER: C

 

 

 

 

 

 

The FROM clause in SQL is used to ------------

A. specify range for search condition

B. specify search condition

C. specify what table we are selecting

D. None of these

ANSWER: C

 

 

 

 

 

 

 

Which SQL keyword is used to retrieve only unique values?

A. DISTINCTIVE

B. UNIQUE

C. DISTINCT

D. DIFFERENT

ANSWER: C

 

 

 

 

 

 

Which SQL keyword is used to retrieve a maximum value?

A. TOP

B. MOST

C. UPPER

D. MAX

ANSWER: D

 

 

 

 

 

 

 

What is a view?

A. A view is a special stored procedure executed when certain event occurs.

B. A view is a virtual table which results of executing a pre-compiled query.

C. A view is a database diagram.

D. None of these

ANSWER: B

 

 

 

 

 

 

Which of the following SQL command is used to retrieve data?

A. DELETE

B. INSERT

C. SELECT

D. JOIN

ANSWER: C

 

 

 

 

 

 

 

Which of the following is a SQL aggregate function?

A. LEFT

B. AVG

C. JOIN

D. LEN

ANSWER: B

 

 

 

 

 

 

 

Which SQL statement is used to update data in a database?

A. SAVE

B. UPDATE

C. SAVE AS

D. MODIFY

ANSWER: B

 

 

 

 

 

 

 

 

Which SQL statement is used to delete data FROM a database?

A. COLLAPSE

B. REMOVE

C. ALTER

D. DELETE

ANSWER: D

 

 

 

 

 

 

 

Which SQL keyword is used to sort the Data?

A. SORT BY

B. ORDER

C. ORDER BY

D. SORT

ANSWER: C

 

 

 

 

 

 

Which of the following group functions ignore NULL values?

A. MAX

B. COUNT

C. SUM

D. All of the above

ANSWER: D

 

 

 

 

 

 

 

Which of the following command makes the updates performed by the transaction permanent in the database?

A. ROLLBACK

B. COMMIT

C. TRUNCATE

D. DELETE

ANSWER: B

 

 

 

 

 

 

Which command undo all the updates performed by the SQL in the transaction?

A. ROLLBACK

B. COMMIT

C. TRUNCATE

D. DELETE

ANSWER: A

 

 

 

 

 

 

Find all the cities whose Temperature is 90 from the Table weather.

A. SELECT city WHERE Temperature =90;

B. SELECT city FROM weather WHERE Temperature = 90;

C. SELECT Temperature = 90 FROM weather;

D. SELECT city FROM weather;

ANSWER: B

 

 

 

 

 

Find the temperature in increasing order of all cities from the Table weather.

A. SELECT city FROM weather ORDER BY temperature;

B. SELECT city, temperature FROM weather;

C. SELECT city, temperature FROM weather ORDER BY temperature;

D. SELECT city, temperature FROM weather ORDER BY city;

ANSWER: C

 

 

 

 

 

What is the meaning of LIKE '%0%0%'

A. Feature begins with two 0's

B. Feature ends with two 0's

C. Feature has more than two 0's

D. Feature has two 0's in it, at any position

ANSWER: D

 

 

 

 

 

 

 

Find temperature is in the range of 65 to 76 from the table weather.

A. SELECT * FROM weather WHERE Temperature IN (65 to 75)

B. SELECT * FROM weather WHERE Temperature NOT IN (65 AND 75)

C. SELECT * FROM weather WHERE Temperature BETWEEN 65 AND 75

D. SELECT * FROM weather WHERE Temperature NOT BETWEEN 65 AND 75

ANSWER: C

 

 

 

 

The SELECT statement SELECT 'HELLO' FROM DUAL WHERE NULL = NULL; Output is.

A. HELLO

B. FLASE

C. TRUE

D. Nothing

ANSWER: D

 

 

 

 

 

Which of the following SQL command can be used to add data to a database table?

A. ADD

B. UPDATE

C. APPEND

D. INSERT

ANSWER: D

 

 

 

 

 

 

Which of the following join is also called as an 'inner-join'?

A. Outer join

B. Self-Join

C. Equijoin

D. None of these

ANSWER: C

 

 

 

 

 

 

 

Which of the following is NOT a SQL constraint?

A. PRIMARY KEY

B. ALTERNATE KEY

C. FOREIGN KEY

D. UNIQUE

ANSWER: B

 

 

 

 

 

 

 

 

What is an SQL virtual table that is constructed from other tables?

A. view

B. A relation

C. Null

D. Query

ANSWER: A

 

 

 

 

 

 

The SQL ALTER statement can be used to:

A. Change the table data.

B. Change the table structure.

C. Delete rows from the table.

D. Add rows to the table.

ANSWER: B

 

 

 

 

 

 

 

What SQL command can be used to add columns to a table?

A. ALTER TABLE TableName ADD ColumnName

B. ALTER TABLE TableName ADD COLUMN ColumnName

C. MODIFY TABLE TableName ADD ColumnName

D. MODIFY TABLE TableName ADD COLUMN ColumnName

ANSWER: A

 

 

 

 

 

The command to remove rows from a table 'CUSTOMER' is:

A. DROP FROM CUSTOMER ...

B. UPDATE FROM CUSTOMER ...

C. REMOVE FROM CUSTOMER ...

D. DELETE FROM CUSTOMER WHERE ...

ANSWER: D

 

 

 

 

 

 

The SQL WHERE clause:

A. Limits the row data are returned.

B. Limits the column data that are returned.

C. Both A and B are correct.

D. Neither A nor B are correct

ANSWER: A

 

 

 

 

 

 

 

Which of the following is the original purpose of SQL?

A. To define the data structures

B. To specify the syntax and semantics of SQL Data definition language

C. To specify the syntax and semantics of SQL Data manipulation language

D. All of the above

ANSWER: D

 

 

 

 

 

 

The command to eliminate a table from a database is:

A. DROP TABLE CUSTOMER;

B. DELETE TABLE CUSTOMER;

C. REMOVE TABLE CUSTOMER;

D. UPDATE TABLE CUSTOMER;

ANSWER: A

 

 

 

 

 

 

 

 

The SQL keyword(s) ________ is used with wildcards.

A. NOT IN only

B. LIKE only

C. IN only

D. IN and NOT IN

ANSWER: B

 

 

 

 

 

 

 

A Subquery in an SQL SELECT statement is enclosed in:

A. Parenthesis (...).

B. Brackets [...].

C. Hash #--#

D. Braces {...}.

ANSWER: A

 

 

 

 

 

 

In SQL SELECT statement the asterisk (*) means that:

A. All columns of the table are to be returned.

B. All records meeting the full criteria are to be returned.

C. All records with even partial criteria met are to be returned.

D. None of the above is correct.

ANSWER: A

 

 

 

 

 

The HAVING clause does which of the following?

A. Acts EXACTLY like a WHERE clause.

B. Acts like a WHERE clause but is used for columns rather than groups.

C. Acts like a WHERE clause but is used for groups rather than rows.

D. Acts like a WHERE clause but is used for rows rather than columns.

ANSWER: C

 

 

 

 

 

Which of the following do you need to consider when you make a table in SQL?

A. Data types

B. Primary keys

C. Default values

D. All of the above.

ANSWER: D

 

 

 

 

 

 

 

SQL can be used to:

A. Create database structures only.

B. Query database data only.

C. Modify database data only.

D. All of the above can be done by SQL.

ANSWER: D

 

 

 

 

 

 

 

 

The SQL keyword BETWEEN is used:

A. To limit the columns displayed.

B. For ranges.

C. As a wildcard.

D. None of these is correct.

ANSWER: B

 

 

 

 

 

 

 

Select all data from student table the name starting with 'r'?

A. SELECT * FROM student WHERE name LIKE 'r%';

B. SELECT * FROM student WHERE name LIKE '%r%';

C. SELECT * FROM student WHERE name LIKE '%r';

D. SELECT * FROM student WHERE name LIKE '_r%';

ANSWER: A

 

 

 

 

 

 

Select the right statement to insert values to the student table.

A. INSERT student VALUES (

B. INSERT VALUES (

C. INSERT INTO student VALUES (

D. INSERT VALUES INTO student (

ANSWER: C

 

 

 

 

 

Which joins two or more tables based on a specified column value not equaling a specified column value in another

table.

A. EQUIJOIN

B. NON-EQUIJOIN

C. OUTER JOIN

D. NATURAL JOIN

ANSWER: B

 

 

 

 

 

In SQL, which of the following is not a (DDL)Data definition language command?

A. REVOKE

B. RENAME

C. UPDATE

D. GRANT

ANSWER: C

 

 

 

 

 

 

Count function in SQL returns the number of

A. Values.

B. Distinct values.

C. Groups.

D. Columns.

ANSWER: A

 

 

 

 

 

 

 

NULL is

A. The same as 0 for integer

B. The same as blank for character

C. The same as 0 for integer and blank for character

D. Not a value

ANSWER: D

 

 

 

 

 

 

 

Which subprogram is used to compute a value?

A. Procedure

B. Function

C. Both A & B

D. None of the above

ANSWER: B

 

 

 

 

 

 

 

Which is a procedural extension of Oracle?

A. PQL

B. Advanced SQL

C. PL/SQL

D. SQL

ANSWER: C

 

 

 

 

 

 

 

Which of the following combines the data manipulating power of SQL with the data processing power of Procedural

languages?

A. PQL

B. Advanced SQL

C. PL/SQL

D. SQL

ANSWER: C

 

 

 

 

 

 

Which keyword and parameter used for declaring an explicit cursor?

A. Constraint

B. Cursor_variable_declaration

C. Collection_declaration

D. Cursor_declaration

ANSWER: D

 

 

 

 

 

 

Which keyword is used instead of the assignment operator to initialize variables?

A. NOT NULL

B. DEFAULT

C. %TYPE

D. %ROWTYPE

ANSWER: B

 

 

 

 

 

 

Which statements execute a sequence of statements multiple times?

A. EXIT

B. LOOP

C. Both A & B

D. None of the above

ANSWER: B

 

 

 

 

 

 

 

Which statements are used to control a cursor variable?

A. OPEN-FOR

B. FETCH

C. CLOSE

D. All mentioned above

ANSWER: D

 

 

 

 

 

 

 

The variables or expressions passed from the calling subprogram are -

A. Actual Parameters

B. Formal Parameters

C. Both A & B

D. None of the above

ANSWER: A

 

 

 

 

 

 

 

 

Which attribute returns NULL?

A. %FOUND

B. %ISOPEN

C. %NOTFOUND

D. %ROWCOUNT

ANSWER: A

 

 

 

 

 

 

 

Which type of cursor is automatically declared by Oracle every time an SQL statement is executed?

A. An Implicit

B. An Explicit

C. Both A & B

D. None of the above

ANSWER: A

 

 

 

 

 

 

What are the different datatypes that can be defined in a PL/SQL block?

A. Scalar

B. Composite

C. Reference

D. All mentioned above

ANSWER: D

 

 

 

 

 

 

 

 

Which is a simple or compound symbol that has a special meaning to PL/SQL?

A. Delimiters

B. Identifiers

C. Literals

D. Comments

ANSWER: A

 

 

 

 

 

 

Which structure executes a sequence of statements repeatedly as long as a condition holds true?

A. Selection structure

B. Iteration structure

C. Sequence structure

D. None of the above

ANSWER: B

 

 

 

 

 

 

 

Which of the following returns the current value in a specified sequence.

A. CURRVAL

B. NEXTVAL

C. Both A & B

D. None of the above

ANSWER: A

 

 

 

 

 

 

 

Which operators combine the results of two queries into one result?

A. Set operator

B. Row Operator

C. Both A & B

D. None of the above

ANSWER: A

 

 

 

 

 

 

 

In PL/SQL, a warning or error condition is called an exception.

A. True

B. False

C. NULL

D. NOT NULL

ANSWER: A

 

 

 

 

 

 

 

PL/SQL stands for -

A. Programming Language/Sql

B. Procedural Language/Sql

C. Portable Language/Sql

D. Preference Language/Sql

ANSWER:B

 

 

 

 

 

 

 

 

Select invalid variable Data type

A. CHAR

B. VARCHAR1

C. VARCHAR2

D. NUMBER

ANSWER: B

 

 

 

 

 

 

 

List the correct sequence of commands to process a set of records when using explicit cursors

A. INITIALIZE, GET, CLOSE

B. CURSOR, GET, FETCH, CLOSE

C. OPEN, FETCH, CLOSE

D. CURSOR, FETCH, CLOSE

ANSWER: C

 

 

 

 

 

 

Which of the following is not a grouping function.

A. COUNT

B. SUM

C. DISTINCT

D. MIN

ANSWER: C

 

 

 

 

 

 

 

If you don't specify a mode for a parameter, what is the default mode?

A. OUT

B. IN

C. COPY

D. DEFAULT

ANSWER: B

 

 

 

 

 

 

 

What are the three parameter modes for procedures?

A. IN, OUT, IN OUT

B. Read, Write, Append

C. CONSTANT, VARIABLE, DEFAULT

D. COPY, NOCOPY, REF

ANSWER: A

 

 

 

 

 

 

 

 

Which of the following function checks whether the expression is a valid date or not?

A. ISDATE

B. ISDAY

C. ISVALID

D. ISYEAR

ANSWER: A

 

 

 

 

 

 

 

Which of the following are TCL commands?

A. UPDATE and TRUNCATE

B. SELECT and INSERT

C. GRANT and REVOKE

D. ROLLBACK and SAVEPOINT

ANSWER: D

 

 

 

 

 

 

Which is not a category of SQL command.

A. TCL

B. SCL

C. DCL

D. DDL

ANSWER: B

 

 

 

 

 

 

 

Which function returns leading and trailing characters of a string?

A. SUBSTR

B. SUBSTRB

C. SOUNDEX

D. TRIM

ANSWER: D

 

 

 

 

 

 

 

The function returns a string with first letter of each word in uppercase

A. SUBSTR

B. INITCAP

C. SOUNDEX

D. TRIM

ANSWER: B

 

 

 

 

 

 

 

The function returns current date SQL is

A. SYSDATE

B. DUAL

C. MONTHS_BETWEEN

D. ISDATE

ANSWER: A

 

 

 

 

 

 

 

The function returns the next day of week following a given date is

A. DUAL

B. MONTHS_BETWEEN

C. ISDATE

D. NEXT_DAY

ANSWER: D

 

 

 

 

 

 

Select __________ from instructor where deptname= ’bbaca.’;Which of the following should be used to find the AV

ERAGE of the salary?

A. AVERAGE(salary)

B. Avg(salary)

C. Sum(salary)

D. Count(salary)

ANSWER: B

 

 

 

 

 

 

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) Schema diagram

b) Relational algebra

c) Database diagram

d) Schema flow

Answer:a

Explanation:None.

 

 

 

 

 

 

The _________ provides a set of operations that take

one or more relations as input and return a relation as an

output.

a) Schematic representation

b) Relational algebra

c) Scheme diagram

d) Relation flow

Answer:b

Explanation:None.

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

schemas ?

a) DML(Data Manipulation Langauge)

b) DDL(Data Definition Langauge)

c) Query

d) Relational Schema

Answer:b

Explanation: Data Definition language is the language which performs

all the operation in defining structure of relation.

 

 

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) DML(Data Manipulation Langauge)

b) DDL(Data Definition Langauge)

c) Query

d) Relational Schema

Answer:a

Explanation: DML performs change in the values of the relation .

 

 

 

Create table employee (name varchar ,id integer)

What type of statement is this ?

a) DML

b) DDL

c) View

d) Integrity constraint

Answer:b

Explanation:Data Definition language is the language which performs

all the operation in defining structure of relation.

 

 

 

Select * from employee

What type of statement is this?

a) DML

b) DDL

c) View

d) Integrity constraint

Answer:a

Explanation: Select operation just shows the required fields of the

relation. So it forms a DML

 

 

 

 

The basic data type char(n) is a _____ length character

string and varchar(n) is _____ length character.

a) Fixed, equal

b) Equal, variable

c) Fixed, variable

d) Variable, equal

Answer:c

Explanation: Varchar changes its length accordingly whereas char has

a specific length which has to be filled by either letters or spaces .

 

 

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) 3, 20

b) 20, 4

c) 20 , 20

d) 3, 4

Answer:a

Explanation: Varchar changes its length accordingly whereas char has

a specific length which has to be filled by either letters or spaces.

To remove a relation from an SQL database, we use the

______ command.

a) Delete

b) Purge

c) Remove

d) Drop table

Answer:d

Explanation: Drop table deletes the whole structure of the relation

.purge removes the table which cannot be obtained again.

 

 

 

Delete from r; r – relation

This command performs which of the following action ?

a) Remove relation

b) Clear relation entries

c) Delete fields

d) Delete rows

Answer:b

Explanation: Delete command removes the entries in the table.

 

 

 

 

Insert into instructor values (10211, ’Smith’, ’Biology’,

66000);

What type of statement is this ?

a) Query

b) DML

c) Relational

d) DDL

Answer:b

Explanation: The values are manipulated .So it is a DML .

 

 

 

Updates that violate __________ are disallowed .

a) Integrity constraints

b) Transaction control

c) Authorization

d) DDL constraints

Answer:a

Explanation:Integrity constraint has to be maintained in the entries of

the relation .

 

 

 

 

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 ?

a) From

b) Rename

c) As

d) Join

Answer:c

Explanation:As keyword is used to rename.

 

 

 

Select * from employee where dept_name=”Comp Sci”;

In the SQL given above there is an error . Identify the error.

a) Dept_name

b) Employee

c) “Comp Sci”

d) From

Answer:c

Explanation:For any string operations single quoted(‘) must be used

to enclose.

 

 

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) $

Answer:a

Explanation:The % character matches any substring.

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

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

a) Atleast, Exactly

b) Exactly, Atleast

c) Atleast, All

d) All , Exactly

Answer:b

Explanation:None.

 

 

 

 

 

Select name

from instructor

where dept name = ’Physics’

order by name;

By default, the order by clause lists items in ______ order.

a) Descending

b) Any

c) Same

d) Ascending

Answer:d

Explanation:Specification of descending order is essential but it not

for ascending.

 

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) Ascending, Descending

b) Asc, Desc

c) Desc, Asc

d) Descending, Ascending

Answer:c

Explanation:None.

 

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;

Answer:a

Explanation: SQL includes a between comparison operator to simplify

where clauses that specify that a value be less than or equal to some

value and greater than or equal to some other value.

 

 Select instructor.*

from instructor, teaches

where instructor.ID= teaches.ID;

This query does which of the following operation?

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

Answer:b

 

In SQL the spaces at the end of the string are removed

by _______ function .

a) Upper

b) String

c) Trim

d) Lower

Answer:c

Explanation: The syntax of trim is Trim(s); where s-string .

 

 

 

 

_____ operator is used for appending two strings.

a) &

b) %

c) ||

d) _

Answer:c

Explanation: || is the concatenation operator.

 

 

 

 

 

 

 The union operation is represented by

a) n

b) U

c) –

d5) *

Answer:b

Explanation:Union operator combines the relations.

 

 

 

 

 

 

 The intersection operator is used to get the _____

tuples.

a) Different

b) Common

c) All

d) Repeating

Answer:b

Explanation:Intersection operator ignores unique tuples and takes

only common ones.

 

 

 

The union operation automatically __________,

unlike the select clause.

a) Adds tuples

b) Eliminates unique tuples

c) Adds common tuples

d) Eliminates duplicate

Answer:d

Explanation:None.

 

 

 

 

 

If we want to retain all duplicates, we must write

________ in place of union.

a) Union all

b) Union some

c) Intersect all

d) Intersect some

Answer:a

Explanation:Union all will combine all the tuples including duplicates.

 

 

 

 

 

(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

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

Answer:d

Explanation:Except keyword is used to ignore the values.

For like predicate which of the following is true.

i) % matches zero of more characters.

ii) _ matches exactly one character.

a) i-only

b) ii-only

c) Both of the mentioned

d) None of the mentioned

Answer:a

Explanation:% is used with like and _ is used to fill in the character

 

 

 

The number of attributes in relation is called as its

a) Cardinality

b) Degree

c) Tuples

d) Entity

Answer:b

Explanation:None.

 

 

 

 

 

 

 _____ clause is an additional filter that is applied to the

result.

a) Select

b) Group-by

c) Having

d) Order by

Answer:c

Explanation:Having is used to provide additional aggregate filtration

to the query.

 

 

 

 

_________ joins are SQL server default

a) Outer

b) Inner

c) Equi

d) None of the mentioned

Answer:b

Explanation:It is optional to give the inner keyword with join as it is

default .

 

 

 

 

 

The _____________ is essentially used to search for

patterns in target string.

a) Like Predicate

b) Null Predicate

c) In Predicate

d) Out Predicate

Answer:a

Explanation:Like predicate matches the string in the given pattern.

 

 

 

 

 

A _____ indicates an absent value that may exist but be

unknown or that may not exist at all.

a) Empty tuple

b) New value

c) Null value

d) Old value

Answer:c

Explanation:None.

 

 

 

 

 

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

a) 0

b) –

c) Null

d) Empty space

Answer:c

Explanation:Null is used to represent absence of a value.

 

 

 

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 _____.

a) Unknown, unknown, false

b) True, false, unknown

c) True, unknown, unknown

d) Unknown, false, unknown

Answer:d

Explanation:None.

 

 

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

Explanation:Not null constraint removes the tpules of null values.

 

 

 

In a employee table to include the attributes whose

value always have some value which of the following

constraint must be used ?

a) Null

b) Not null

c) Unique

d) Distinct

Answer:b

Explanation:Not null constraint removes the tpules of null values.

 

 

 

Using the ______ clause retains only one copy of such

identical tuples.

a) Null

b) Unique

c) Not null

d) Distinct

Answer:d

Explanation:Unique is a constraint.

 

 

 

 

 

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.

a) Insert into employee values (1005,Rach,0);

b) Insert into employee values (1002,Joey,335);

c) Insert into employee values (1007,Ross, );

d) Both a and c

Answer:c

Explanation:Not null constraint is specified which means sone value

(can include 0 also) should be given.

The primary key must be

a) Unique

b) Not null

c) Both a and b

d) Either a or b

Answer:c

Explanation:Primary key must satisfy unique and not null condition

for sure.

 

 

 

 

 

You attempt to query the database with this command:

(25) select nvl (100 / quantity, none) from inventory;

Why does this statement cause an error when QUANTITY values are null?

a. The expression attempts to divide by a null value.

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

Answer:a

Explanation: The expression attempts to divide by a null value is errorneous in sql.

The result of _____unknown is unknown.

a) Xor

b) Or

c) And

d) Not

Answer:d

Explanation:Since unknown does not hold any value the value cannot

have a reverse value.

 

 

 

 

 

Aggregate functions are functions that take a

___________ as input and return a single value.

a) Collection of values

b) Single value

c) Aggregate value

d) Both a & b

Answer:a

Explanation:None.

 

 

 

 

 

Select __________

from instructor

where dept name= ’Comp. Sci.’;

Which of the following should be used to find the mean of

the salary ?

a) Mean(salary)

b) Avg(salary)

c) Sum(salary)

d) Count(salary)

Answer:b

Explanation:Avg() is used to find the mean of the values.

 

 

 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

Explanation:Distinct keyword is used to select only unique items from

the relation.

All aggregate functions except _____ ignore null values

in their input collection.

 

a) Count(attribute)

b) Count(*)

c) Avg

d) Sum

Answer:b

Explanation:* is used to select all values including null.

 

 

 

A Boolean data type that can take values true, false,

and________ .

a) 1

b) 0

c) Null

d) Unknown

Answer:d

Explanation:Unknown values do not take null value but it is not

known.

 

 

 

 

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.

a) Or, in

b) Not in, in

c) In, not in

d) In, or

Answer:c

Explanation:In checks if the query has the value but not in checks if it

does not have the value.

 

The ________________ is essentially used to search for patterns in a string.

A. Like Predicate

B. Null Predicate

C. In Predicate

D. Out Predicate

ANSWER: A

 

 

 

 

 

 

Which of the following constraint does not enforce uniqueness?

A. UNIQUE

B. Primary key

C. Foreign key

D. None

ANSWER: C

 

 

 

 

 

 

 

Constraints can be applied on ___________

A. Column

B. Table

C. Field

D. All the above

ANSWER: D

 

 

 

 

 

 

 

Which of the constraint can be enforced one per table?

A. Primary key constraint

B. Not Null constraint

C. Foreign Key constraint

D. Check constraint

ANSWER: A

 

 

 

 

 

 

 

The BEGIN and END statements are used when ____________

A. A WHILE loop needs to include a block of statements

B. An element of a CASE expression needs to include a block of statements

C. An IF or ELSE clause needs to include a block of statements

D. All the above

ANSWER: D

 

 

 

 

 

Which one of the following is a set of one or more attributes taken collectively to uniquely identify a record?

A. Candidate key

B. Sub key

C. Super key

D. Foreign key

ANSWER: C

 

 

 

 

 

 

 

Consider attributes ID , NAME AND ADDRESS . Which one of this can be considered as a super key ?

A. NAME

B. ID

C. CITY

D. CITY,ID

ANSWER: B

 

 

 

 

 

 

Which one of the following attribute can be taken as a primary key ?

A. Name

B. Address

C. Id

D. Department

ANSWER: C

 

 

 

 

 

 

 

 

Which of the following is used to store movie and image files ?

A. Clob

B. Blob

C.Img

D.Gif

ANSWER: B

 

 

 

 

 

 

Which one of the following is used to define the structure of the TABLE?

A. DML

B. DDL

C. Query

D. TCL

ANSWER: B

 

 

 

 

 

 

 

Which one of the following provides the ability to query information from the database and to insert .delete and mod

ify records in the database ?

A. DML

B. DDL

C. Query

D. TCL

ANSWER: A

 

 

 

 

 

 

Create table student (name varchar , id number, dob date) What type of statement is this ?

A. DML

B. Join

C. View

D. DDL

ANSWER: D

 

 

 

 

 

 

 

 

Select * from Student what type of statement is this?

A. DML

B. DDL

C. View

D. Index

ANSWER: A

 

 

 

 

 

 

To remove a Table from an SQL database, we use the ______ command.

A. Delete Table

B. Truncate Table

C. Remove Table

D. Drop Table

ANSWER: D

 

 

 

 

 

 

 

The AUTO_INCREMENT sequences normally begin at __________

A. 0

B. 1

C. 11

D. 2

ANSWER: B

 

 

 

 

 

 

 

Syntax for creating views is __________

A. CREATE VIEW AS SELECT

B. CREATE VIEW AS UPDATE

C. DROP VIEW AS SELECT

D. CREATE VIEW AS UPDATE

ANSWER: A

 

 

 

 

 

 

 

You can delete a view with ___________ command.

A. DROP VIEW

B. DELETE VIEW

C. REMOVE VIEW

D. TRUNCATE VIEW

ANSWER: A

 

 

 

 

 

 

 

The full form of DDL is

A. Dynamic Data Language

B. Detailed Data Language

C. Data Definition Language

D. Data Derivation Language

ANSWER: C

 

 

 

 

 

 

 

Which of the following is a comparison operator in SQL?

A. =

B. LIKE

C. BETWEEN

D. +

ANSWER: A

 

 

 

 

 

 

 

Which function divides one numeric expression by another and returns the remainder

A. POWER

B. MOD

C. ROUND

D. REMAINDER

ANSWER: B

 

 

 

 

 

 

Key to represent relationship between tables is called

A. Primary key

B. Secondary Key

C. Foreign Key

D. Candidate Key

ANSWER: A

 

 

 

 

 

 

A data manipulation command the combines the records from one or more tables is called

A. SELECT

B. PROJECT

C. JOIN

D. PRODUCT

ANSWER: C

 

 

 

 

 

 

 

 

DBMS helps tO achieve

A. Data independence

B. Centralized control of data

C. Control redundancy

D. All of above

ANSWER: D

 

 

 

 

 

 

 

Which of the following are the properties of entities?

A. Groups

B. Table

C. Attributes

D. Switchboards

ANSWER: C

 

 

 

 

 

 

 

A primary key is combined with a foreign key creates

A. Parent-Child relationship between the tables that connect them

B. Many to many relationship between the tables that connect them

C. Network model between the tables that connect them.

D. None of the above

ANSWER: A

 

 

 

 

 

 

In E-R Diagram relationship type is represented by

A. Ellipse

B. Dashed ellipse

C. Rectangle

D. Diamond

ANSWER: D

 

 

 

 

 

 

A table joined with itself is called

A. Join

B. Self Join

C. Outer Join

D. Equi Join

ANSWER: B

 

 

 

 

 

 

 

A many to many relationship between two entities usually results in how many tables?

A. One

B. Two

C. Three

D. Four

ANSWER: C

 

 

 

 

 

 

 

Entity is a _________

A. Object of relation

B. Present working model

C. Thing in real world

D. Model of relation

ANSWER: C

 

 

 

 

 

 

 

To include integrity constraint in an existing TABLE use :

A. Modify table

B. Drop table

C. Alter table

D. Create table

 

ANSWER: C

 

 

 

 

 

 

 

Which of the following is not an integrity constraint?

A. Not null

B. Positive

C. Unique

D. Check

ANSWER: B

 

 

 

 

 

Foreign key is the one in which the ________ of one relation is referenced in another relation.

A. Foreign key

B. Primary key

C. References

D. Check constraint

ANSWER: B

 

 

 

 

 

 

Choose the most suitable data type iColumn Name: Date_Of_Birth ;

A. Timestamp

B. VARCHAR2(11)

C. Blob

D. Date

ANSWER: D

 

 

 

 

 

 

Determine data type for the given column? Column Name: REGNO ; Example: 19GDT251

A. VARCHAR2(15)

B. NUMBER

C. DATE

D. NUMBER(11)

ANSWER: A

 

 

 

 

 

 

which of the following is/are the DDL statements?

A. Create

B. Drop

C. Alter

D. All of the Mentioned

ANSWER: D

 

 

 

 

 

 

 

SQL has how many main commands for DDL:

A. 1

B. 2

C. 3

D. 4

ANSWER: D

 

 

 

 

 

 

 

TRUNCATE Command in SQL is a

A. DDL

B. DML

C. DCL

D. TCL

ANSWER: A

 

 

 

 

 

 

 

How many types of indexes are there in sql server?

a. 1

b. 2

c. 3

d. 4

ANSWER: B

 

 

 

 

 

 

 

5NF is designed to cope with :

A. Transitive dependency

B. Join dependency

C. Multi valued dependency

D. None of these

ANSWER: B

 

 

 

 

 

 

 

Alias or Alternate name for a Table ,View and Sequence is

A. Synonyms

B. Sequence

C. Unique

D. Index

ANSWER: A

 

 

 

 

 

 

 

Simple Indexes are created by using a Keyword

A. Not null

B. Positive

C. Unique

D. Check

ANSWER: C

 

 

 

 

 

 

 

The Keyword used to display data in descending order is

A. ASC

B. Descend

C. Unique

D. Desc

ANSWER: D

 

 

 

 

 

 

 

By default,the ORDER BY clause list items in

A. Descending order

B. Ascending Order

C. Unique

D. None

ANSWER: B

 

 

 

 

 

 

 

 

The process of Efficiently Eliminating data is

A. Denormalization

B. Join

C. Normalization

D. Indexes

ANSWER: C

 

 

 

 

 

 

 

The advance Version of 3NF is

A. DNF

B. FNCF

C. GNCF

D. BCNF

ANSWER: D

 

 

 

 

 

 

 

Abbreviation of BCNF is

A. Boyce–Codd Normal form

B. Brief–Codd Normal form

C. Bi-polar Normal form

D. BCC Normal Form

ANSWER: A

 

 

 

 

 

 

 

 

BCNF is also referred as

A. 3.0NF

B. 3.1NF

C. 3.3NF

D. 3.5NF

ANSWER: D

 

 

 

 

 

 

 

 

The opposite process of normalization is

A. Normal Forms

B. Normal View

C. Denormalization

D. Renormalization

ANSWER: C

 

 

 

 

 

 

 

 

Join which returns all records from the left table, and the matched records from the right table is

A. FULL JOIN

B. SELF JOIN

C. LEFT (OUTER) JOIN

D. RIGHT (OUTER) JOIN

ANSWER: C

 

 

 

 

 

 

Join which returns records that have matching values in both tables

A. FULL JOIN

B. SELF JOIN

C. LEFT (OUTER) JOIN

D. RIGHT (OUTER) JOIN

ANSWER: A

 

 

 

 

 

 

 

SQL provides constructs for

A. Updation

B. Insertion

C. Deletion

D. All of the Above

ANSWER: D

 

 

 

 

 

 

 

 

SQL expresses an insertion operation as

A. Insert into r

B. Insert to r

C. Insert for r

D. Insert in r

ANSWER: A

 

 

 

 

 

 

 

If any of the input values is null, the result of an arithmetic expression, would be

A. 0

B. Null

C. 1

D. Undefined

ANSWER: B

 

 

 

 

 

 

For understanding of operations, the clauses must be written in the order

A. Select, where, from

B. From, select, where

C. Select, from, where

D. From, where, select

ANSWER: C

 

 

 

 

 

 

 

In result if we want to retain all duplicates, we must write

A. Join all operator

B. Join operator

C. Union operator

D. Union all operator

ANSWER: D




 

Post a Comment

0 Comments