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

rdbms mcq1

Uploaded by

dhana lalitha
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)
10 views

rdbms mcq1

Uploaded by

dhana lalitha
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/ 7

1. 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.
2. Student(ID, name, dept name, tot_cred) In this query which attributes 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.
3. 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 database entries can be accessed.
4. 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 d) Intersection [Answer: b]
Explanation: Join finds the common tuple in the relations and combines it.
5. 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.
6. 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.
7. 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.
8. 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.
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) Schema diagram b) Relational algebra c) Database diagram
d) Schema flow [Answer: a]
10. 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]
1. 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.
2. 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.
3. The subset of a 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.
4. 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.
5. 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.
6. 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.
7. An 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.
8. The relation with the attribute which is the primary key is referenced in another
relation. The relation which has the attribute as a primary key is called
a) Referential relation b) Referencing relation c) Referenced relation
d) Referred relation [Answer: b]
9. 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]
10. 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.
1. 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
a relation. Keys are the constraints in a relation.
2. 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.
3. 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.
4. 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.
5. 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.
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.
a) Instance, Schema b) Relation, Schema c) Relation, Domain
d) Schema, Instance [Answer: d]
Explanation: Instance is an instance of time and schema is a representation.
7. 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 .
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.
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.
9. A domain is atomic if elements of the domain are considered to be ______ units.
a) Different b) Indivisbile c) Constant d) Divisible [Answer: b]
10. 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.
1. 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.
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) DML(Data Manipulation Langauge) b) DDL(Data Definition Langauge)
c) Query d) Relational Schema [Answer: a]
Explanation: DML performs the change in the values of the relation.
3. 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.
4. 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.
5. The basic data type char(n) is a _____ length character string and varchar(n) is
_____ length character. [Answer : C]
a) Fixed, equal b) Equal, variable c) Fixed, variable d) Variable, equal
Explanation: Varchar changes its length accordingly whereas char has a specific
length which has to be filled by either letters or spaces.
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) 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.
7. 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.
8. 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.
9. 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.
10. 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.
1.
Name
Annie
Bob
Callie
Derek
Which of these query will display the the table given above ?
a) Select employee from name b) Select name c) Select name from employee
d) Select employee [Answer: c]
Explanation: The field to be displayed is included in select and the table is included
in the from clause.
2. Here which of the following displays the unique values of the column?
SELECT ________ dept_name FROM instructor;
a) All b) From c) Distinct d) Name [Answer: c]
Explanation: Distinct keyword selects only the entries that are unique.
3. The ______ clause allows us to select only those rows in the result relation of the
____ clause that satisfy a specified predicate.
a) Where, from b) From, select c) Select, from d) From, where [Answer: a]
Explanation: Where selects the rows on a particular condition. From gives the
relation which involves the operation.
4. The query given below will not give an error. Which one of the following has to be
replaced to get the desired output?
SELECT ID, name, dept name, salary * 1.1
WHERE instructor;
a) Salary*1.1 b) ID c) Where d) Instructor [Answer: c]
Explanation: Where selects the rows on a particular condition. From gives the
relation which involves the operation. Since Instructor is a relation it has to have
from clause.
5. The ________ clause is used to list the attributes desired in the result of a query.
a) Where b) Select c) From d) Distinct [Answer: b]
Explanation: None
6. This Query can be replaced by which one of the following?
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; [Answer: b]
Explanation: Join clause joins two tables by matching the common column.
7.SELECT * FROM employee WHERE salary>10000 AND dept_id=101;
Which of the following fields are displayed as output?
a) Salary, dept_id b) Employee c) Salary d) All the field of employee relation
[Answer: d]
Explanation: Here * is used to select all the fields of the relation.
8.
Employee_id Name Salary
1001 Annie 6000
1009 Ross 4500
1018 Zeith 7000
This is Employee table.
Which of the following employee_id will be displayed for the given query?
SELECT * FROM employee WHERE employee_id>1009;
a) 1009, 1001, 1018 b) 1009, 1018 c) 1001 d) 1018 [Answer: d]
Explanation: Greater than symbol does not include the given value unlike >=.
9. Which of the following statements contains an error?
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’; [Answer: d]
Explanation: This query do not have from clause which specifies the relation from
which the values has to be selected.
10. In the given query which of the keyword has to be inserted?
INSERT INTO employee _____ (1002,Joey,2000);
a) Table b) Values c) Relation d) Field [Answer: b]
Explanation: Value keyword has to be used to insert the values into the table.
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?
a) From b) Rename c) As d) Join [Answer: c]
Explanation: As keyword is used to rename.
2. 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.
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) % b) _ c) || d) $ [Answer: a]
Explanation: The % character matches any substring.
4. ’_ _ _ ’ 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]
5. 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.
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? [Answer: c]
a) Ascending, Descending b) Asc, Desc c) Desc, Asc d) Descending, Ascending
7.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.
8.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]
Explanation: The asterisk symbol “ * ” can be usedin the select clause to denote “all
attributes.”
9. 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.
10. _____ operator is used for appending two strings.
a) & b) % c) || d) _ [Answer: c]
Explanation: || is the concatenation operator.

https://www.sanfoundry.com/database-mcqs-set-
operations/

You might also like