22319 Database Management System Mcq pdf [ Relational Data Model ]

22319 mcq
Subject subject details
Program: Diploma in computer engineering
Program Code CO
Scheme I
Semester 3
Course: Database Management System
Course Code 22319
 "1. Which one of the following is used to define the structure of the relation, deleting relations and" 
relating schemas? 
a) DML(Data Manipulation Language) 
b) DDL(Data Definition Language) 
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 Language) 
b) DDL(Data Definition Language) 
c) Query 
d) Relational Schema 
Answer: a 
Explanation: DML performs the change in the values of the relation. 

3. CREATE TABLE employeee (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. 
"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. 

6. An attribute A of datatype varchar (20) has the value “Avi”. The attribute B of data type 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
11.Name, Annie ,Bob ,Callie
.Which of these query will display the table given below? 
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. 

12. Here which of the following displays the unique values of the column? 
a) All 
b) From 
c) Distinct 
d) Name 
Answer: c 
Explanation: Distinct keyword selects only the entries that are unique. 

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

14. 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. 
SELECT dept_name FROM instructor; 

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

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

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

18. 
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? 
"a) 1009, 1001, 1018" 
"b) 1009, 1018" 
c) 1001 
d) 1018 
Answer: d 
Explanation: Greater than symbol does not include the given value unlike >=. 

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

20. In the given query which of the keyword has to be inserted? 
SELECT * FROM employee WHERE employee_id>1009; 
a) Table 
b) Values 
c) Relation 
d) Field 
Answer: b 
Explanation: Value keyword has to be used to insert the values into the table. 

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


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

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

24. ‟_ _ _ ‟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." 

"25. By default, the order by clause lists items in order." 
SELECT emp_name FROM department WHERE dept_name LIKE ‟ Computer Science‟; 
SELECT 
FROM 
name 
a) Descending 
b) Any 
c) Same 
d) Ascending 
Answer: d 
Explanation: Specification of descending order is essential but it not for ascending. 

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

27. 
SELECT name from instructor WHERE salary <= 100000 AND salary >= 90000;
This query can be replaced by which of the following ? 
SELECT SELECT SELECT SELECT 
FROM FROM FROM FROM 
a) name 
b) name 
c) name 
d) name 
instructor WHERE salary BETWEEN 90000 AND 100000; 
employee WHERE salary <= 90000 AND salary>=100000; employee WHERE salary BETWEEN 90000 AND 100000; 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. 

28. 
instructor 
"instructor, teaches W" 
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.” 

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

30. operator is used for appending two strings. 
a) & 
b) % 
c) || 
d) _ 
Answer: c 
Explanation: || is the concatenation operator. 

Comments

Popular posts from this blog

Getting started with c programming (step-by-step) explanation

22620 Network and Information Security NIS solved lab manual pdf

22413 software engineering notes [ ⚠️] pdf | Msbte 4th semester diploma