Thursday, August 22, 2019

Database Management Questions (MCQ) with Answers


     Database Management Questions (MCQ) with Answers


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


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

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

Q4) 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 the structure of relation.

Q5 ) 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.


Q6) 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.

§ Q7)  PRIMARY KEY - Uniquely identifies each record in a table.
            a) True   b)false


Answer: a)

Q 8) 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.

Q 9 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.

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

Q11)
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.


Q12 
SELECT emp_name  department
 dept_name LIKE ’ _____ceit’;
FROM WHERE
Which one of the following has to be added into the blank to select the dept_name which

has ceit as its ending string? 



a) %
b)   _
c)   ||
d)   $




Answer: a
Explanation: The % character matches any substring.

Q13)
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.


Q14) In SQL the spaces at the end of the string are removed by _______ function.

a)   Upper
b)   String
c)   Trim
d)   Lower

Answer: c)

Q15)  _____ operator is used for appending two strings.


a) &
b)   %
c)   ||
d)   _


Answer: c
Explanation: || is the concatenation operator.


Q16) A Delete command operates on ______ relation. 

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


Answer: a
Explanation: Delete can delete from only one table at a time.

Q17) What type of join is needed when you wish to include rows that do not have matching values? 

a) Equi-join
b)   Natural join
c)   Outer join
d)   All of the mentioned


Answer: c
Explanation: An outer join does not require each record in the two joined tables to have a matching record..

Q18 PL/SQL programs are written as lines of text using a specific set of characters.


a.   Upper- and lower-case letters A .. Z and a .. z
b.  Numerals 0 .. 9
c.   Symbols ( ) + - * / < > = ! ~ ^ ; : . ' @ % , " # $ & _ | { } ? [ ]
d.  Tabs, spaces, and carriage returns
e.   All mentioned above




ANSWER: All mentioned above Explanation:
 
PL/SQL is not a case-sensitive language. The character set has some specific set of characters which are used for the writing PL/SQL programs.


Q19) ACID stands for:

a)     Atomicity, Consistency, Isolation, Durability
b)    Atomicity, Consistency, Isolated, Durable
c)     Atomicity, Concept, Isolation, Durability
d)    None of these

Answer: a)



Q20 Which of the following has a return type in its specification and must return a value specified in that type?
a.   Function
b.   Procedure
c.   Package
d.   None of the above.




ANSWER: Function 

Explanation: 

Functions in a subprogram act like new expressions and operators. A function computes a value in a subprogram. The function has a return clause.

No comments:

Post a Comment

Create a Digital Clock using HTML and JavaScript

Create a Digital Clock using HTML and JavaScript  <! DOCTYPE html> < html > < head > <...

Followers

Search This Blog

Popular Posts