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

DataBase Tech

database mcq

Uploaded by

pmayuresh7588
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
45 views

DataBase Tech

database mcq

Uploaded by

pmayuresh7588
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

Vidyanidhi Info Tech Academy

PG DAC Question Bank

1) In ..................... , we have a strict parent-child relationship only.


A) hierarchical databases. B) network databases
C) object oriented databases D) relational databases

2) The file in DBMS is called as .................. in RDBMS.


A) console B) schema C) table D) object

3) What operator tests column for the absence of data?


A) IS NULL operator B) ASSIGNMENT operator
C) LIKE operator D) NOT operator

4) The .................... refers to the way data is organized in and accessible from DBMS.
A) database hierarchy B) data organization
C) data sharing D) data model

5) ............................ is the powerful language for working with RDBMS.


A) Embedded Programs B) Dynamic Programs
C) Query Language D) Static Language Programs

6) A table can have only 0 or 1 primary key


A) True B)False

7) How many unique keys can a table have


A) 1 B) 0 C) 2 D) Multiple

8) SQL stands for


A) Structured Query Language C) Simple Query Language
B) Solid Query Language D) Science Query Language

9) Which is more secured


A) File System B) RDBMS C) Both D) None

10) Excel is ---------------


A) DBMS B) Database C) RDBMS D) ORDBMS

11) Oracle is -----------


A) DBMS B) Database C) RDBMS D) ORDBMS

12) Office register is ---------


A) DBMS B) Database C) RDBMS D) ORDBMS

13) Various Keywords supported by SQL are


A) Insert B) Update C) Select D) All of the Above

14) Which Databases supports SQL


A) Oracle B) SQL Server C) MySQL D)All of the above
15) Example of Non-Numerical Data is
1
Vidyanidhi Info Tech Academy
Vidyanidhi Info Tech Academy
PG DAC Question Bank
A) Employee Address C) Examination Score
B) Bank Balance D) None of the Above

16) which of the following is a correct SQL query


A) Select * from emp where eid=100 , ename=’a’
B) Select * from emp where eid=100 ename=’a’
C) Select * where eid=100 and ename=’a’ from emp
D) Select * from emp where eid=100 and ename=’a’

17) which of the following constraint is not supported by MySQL


A) Primary Key B) Unique Key C) Check Constraint D) Not Null

18) How many null values can a unique key column have in MySQL
A) Multiple B) 0 C) 1 D) 2

19) How many null values can a primary key column have in MySQL
A) Multiple B) 0 C) 1 D) 2

20) Can the child table foreign key column has null value?
A) True B) False

21) which of the following query is used to delete data from table
A) Drop B) Delete C) Update D) Alter
22) Does MySQL supports composite Primary keys?
A) True B) False

23) Does MySQL supports composite Unique keys?


A) True B) False

24) Does MySQL supports composite Foreign keys?


A) True B) False

25) which of the following set operators are supported by MySQL


A) Union B) Intersect C) Minus D) Except

26) which of the following joins are not supported by MySQL


A) FULL B) Left C) Right D) Inner

27) which of the following joins will return highest number of rows?
A) Cross Join B) Left Join C) Inner Join D) Right Join

28) does MySQL supports case statements?


A) True B) False

29) Can we have a HAVING Clause in the query without group by clause?
A) True B) False

30) What is the default sort done in MySQL when you order by clause?
Vidyanidhi Info Tech Academy
PG DAC Question Bank
A) Ascending B) Descending C) None D) both

31) Which of the following is an aggregate function in SQL?


A) Union B) Like C) Group By D) Max

32) Every Boyce-Codd normal form is in


A) First normal form C) Second normal form
B) Third normal form D) All of the above

33) 4NF is designed to cope with:


A) Transitive dependency
B) Join dependency
C) Multi valued dependency
D) None of these

34) In a relational database a referential integrity constraint can be specified with the help of
A) primary key
B) foreign key
C) secondary key
D) none of the above

35) A Function that has no partial dependencies is in


A) 3NF
B) 2NF
C) 4NF
D) BCNF

36) If every non-key attribute is functionally dependent on the entire primary key, then the relation will be in:
A) 1NF
B) 2NF
C) 3NF
D) 4NF

37) Third normal form is based on the concept of


A) Closure Dependency
B) Transitive Dependency
C) Normal Dependency
D) Functional Dependency

38) A relation is ................... if every field contains only atomic values that is, no lists or sets.
A) 1 NF B) 2 NF C) 3 NF D) BCNF

39) Which of the following can add a row to a table?


A) Add B) Insert C) Update D) Alter

40) In a LIKE clause, you can could ask for any value ending in "qpt" by writing
A) LIKE %qpt
B) LIKE *ton
C) LIKE ton$
D) LIKE ^.*ton$

51. A NULL value is treated as a blank or 0.


A) True B) False

52 MySQL is
A) A Programming language
B) A Programming language
C) A technique for writing reliable programs
D) A Relational Database Management System

53 In a LIKE clause, you can ask for any 6 letter value by writing?
Vidyanidhi Info Tech Academy
PG DAC Question Bank
A) LIKE ??????
B) LIKE .{6} Answer 5: LIKE ^.{6}$
C) LIKE ...... (that's six dots)
D) LIKE ______ (that's six underscore characters)

54. The result of a SELECT statement can contain duplicate rows.


a) False b) True

55. A table may be joined to itself.


a) True b) false

56. Which of the following is not a valid aggregate function?


a) COUNT b) MIN c) MAX d) COMPUTE

57. What SQL clause is used to restrict the rows returned by a query?
a) AND b) WHERE c) Group d) FROM

58. Which of the following commands should be used to create a database named “student”?
a) CREATE ?I student b) CREATE DATABASE student
c) DATABASE /student d) DATABSE student

59. Which one will delete the table data as well as table structure?
a) TRUNCATE b) DROP c) delete d) All of the above

60. The USE command?


a) Is used to load code from another file
b) Has been deprecated and should be avoided for security reasons
c) Is a pseudonym for the SELECT command
d) Should be used to choose the database you want to use once you've connected to MySQL

61. A SELECT command without a WHERE clause returns?


a) All the records from a table that match the previous WHERE clause
b) All the records from a table, or information about all the records
c) SELECT is invalid without a WHERE clause
d) Nothing

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


A. REMOVE FROM CUSTOMER ...
B. DROP FROM CUSTOMER ...
C. DELETE FROM CUSTOMER WHERE ...
D. UPDATE FROM CUSTOMER ...

63. The SQL WHERE clause:


A. limits the column data that are returned.
B. limits the row data are returned.
C. Both A and B are correct.
D. Neither A nor B are correct.

64. The command to eliminate a table from a database is:


A. REMOVE TABLE CUSTOMER;
B. DROP TABLE CUSTOMER;
C. DELETE TABLE CUSTOMER;
D. UPDATE TABLE CUSTOMER

65. Which of the following is the correct order of keywords for SQL SELECT statements?
A. SELECT, FROM, WHERE
B. FROM, WHERE, SELECT
C. WHERE, FROM,SELECT
D. SELECT,WHERE,FROM;
Vidyanidhi Info Tech Academy
PG DAC Question Bank
66. A subquery in an SQL SELECT statement is enclosed in:
A. braces -- {...}.
B. CAPITAL LETTERS.
C. parenthesis -- (...) .
D. brackets -- [...].

67. Which of the following are the five built-in functions provided by SQL?
A. COUNT, SUM, AVG, MAX, MIN
B. SUM, AVG, MIN, MAX, MULT
C. SUM, AVG, MULT, DIV, MIN
D. SUM, AVG, MIN, MAX, NAME

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

69. Find the SQL statement below that is equal to the following: SELECT NAME FROM CUSTOMER WHERE STATE =
'VA';
A. SELECT NAME IN CUSTOMER WHERE STATE IN ('VA');
B. SELECT NAME IN CUSTOMER WHERE STATE = 'VA';
C. SELECT NAME IN CUSTOMER WHERE STATE = 'V';
D. SELECT NAME FROM CUSTOMER WHERE STATE IN ('VA');

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

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

72. Create table employee (name varchar ,id integer)


What type of statement is this ?
a) DML b) DDL c) View d) Integrity constraint

73. To remove a relation from an SQL database, we use the ______ command.
a) Delete b) Purge c) Remove d) Drop table

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

75. A _________ consists of a sequence of query and/or update statements.


a) Transaction b) Commit c) Rollback d) Flashback

76. Which of the following makes the transaction permanent in the database ?
a) View b) Commit c) Rollback d) Flashback

77. In order to undo the work of transaction after last commit which one should be used ?
a) View b) Commit c) Rollback d) Flashback

78. Consider the following action:


Transaction…..
Vidyanidhi Info Tech Academy
PG DAC Question Bank
Commit;
Rollback;
What does Rollback do?
a) Undoes the transactions before commit
b) Clears all transactions
c) Redoes the transactions before commit
d) No action

79. In case of any shut down during transaction before commit which of the following statement is done automatically ?
a) View b) Commit c) Rollback d) Flashback

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

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

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

83. 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);

84. The phrase “greater than at least one” is represented in SQL by _____.
a) < all b) < some c) > all d) > any

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

86. Which of the following is not a aggregate function ?


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

87. The EXISTS keyword will be true if:


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.
88. To include integrity constraint in a existing relation use :
a) Create table b) Modify table c) Alter table d) Drop table
Vidyanidhi Info Tech Academy
PG DAC Question Bank
89. Which of the following is not a integrity constraint ?
a) Not null b) Positive c) Unique d) Check ‘predicate’

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

91. Which of the following can be addressed by enforcing a referential integrity constraint?
a) All phone numbers must include the area code
b) Certain fields are required (such as the email address, or phone number) before the record is accepted
c) Information on the customer must be known before anything can be sold to that customer
d) When entering an order quantity, the user must input a number and not some text (i.e., 12 rather than ‘a dozen’)

92. The____condition allows a general predicate over the relations being joined.
a) On b) Using c) Set d) Where

93. Which of the join operations do not preserve non matched tuples.
a) Left outer join b) Right outer join c) Inner join d) Natural join

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

95. How many tables may be included with a join?


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

96. In SQL the statement select * from R, S is equivalent to


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

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

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

99. The primary key must be


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

100. Which one of the following deletes all the entries but keeps the structure of the relation .
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;

101. 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) Both a and c

102.. Update instructor


_____ salary= salary * 1.05;
Vidyanidhi Info Tech Academy
PG DAC Question Bank
Fill in with correct keyword to update the instructor relation.
a) Where b) Set c) In d) Select

103. 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) Case
when pred1 then result1
when pred2 then result2
...
when predn then resultn
else result0
d) All of the mentioned

104. A collection of data designed to be used by different people is called a/an


a) Organization b) Database c) Relationship d) Schema

105. Which of the following terms does refer to the correctness and completeness of the data in a database?
a) Data security b) Data constraint c) Data independence d) Data integrity

106. The relationship between DEPARTMENT and EMPLOYEE is a


a) One-to-one relationship b) One-to-many relationship
c) Many-to-many relationship d) Many-to-one relationship

107. If the state of the database no longer reflects a real state of the world that the database is supposed to capture,
then such a state is called
a) Consistent state b) Parallel state c) Durable state d) Inconsistent state

108. Each modification done in database transaction are first recorded into the
a) Harddrive b) Log c) Disk d) Datamar

109. When the transaction finishes the final statement the transaction enters into
a) Active state b) Committed state c) Partially committed state d) Abort state

110. Which of the following is an atomic sequence of database actions?


a) Transaction b) Concurrency c) Relations d) All of the mentioned

111. _______ means that data used during the execution of a transaction cannot be used by a second transaction until
the first one is completed.
a) Serializability b) Atomicity c) Isolation d) Time stamping

112. In SQL, which command is used to select only one copy of each set of duplicate rows
A) SELECT DISTINCT B) SELECT UNIQUE C) SELECT DIFFERENT D) All of the above

113. Composite key is made up of ................


A) One column B) One super key C) One foreign key D) Two or more columns

114. What command is used to get back the privileges offered by the GRANT command?
A) Grant B) Revoke C) Execute D) Run
Vidyanidhi Info Tech Academy
PG DAC Question Bank
115. Which of the following query is correct for using comparison operators in SQL?
A) SELECT sname, coursename FROM studentinfo WHERE age>50 and <80;
B) SELECT sname, coursename FROM studentinfo WHERE age>50 and age <80;
C) SELECT sname, coursename FROM studentinfo WHERE age>50 and WHERE age<80;
D) None of the above

116. How to select all data from studentinfo table starting the name from letter 'r'?
A) SELECT * FROM studentinfo WHERE sname LIKE 'r%';
B) SELECT * FROM studentinfo WHERE sname LIKE '%r%';
C) SELECT * FROM studentinfo WHERE sname LIKE '%r';
D) SELECT * FROM studentinfo WHERE sname LIKE '_r%';

117. Which of the following SQL query is correct for selecting the name of staffs from 'tblstaff' table where salary is
15,000 or 25,000?
A) SELECT sname from tblstaff WHERE salary IN (15000, 25000);
B) SELECT sname from tblstaff WHERE salary BETWEEN 15000 AND 25000;
C) Both A and B
D) None of the above

118. Select a query that retrieves all of the unique course name from the student table?
A) SELECT DISTINCT coursename FROM studentinfo;
B) SELECT UNIQUE coursename FROM studentinfo;
C) SELECT DISTINCT coursename FROM TABLE studentinfo;
D) SELECT INDIVIDUAL coursename FROM studentinfo;

119. Which query is used for sorting data that retrieves the all the fields from empinfo table and listed them in the
ascending order?
A) SELECT * FROM empinfo ORDER BY age;
B) SELECT * FROM empinfo ORDER age;
C) SELECT * FROM empinfo ORDER BY COLUMN age;
D) SELECT * FROM empinfo SORT BY age;

120. Select the right statement to insert values to the stdinfo table.
A) INSERT VALUES ("15", "Hari Thapa", 45, 5000) INTO stdinfo;
B) INSERT VALUES INTO stdinfo ("15", "Hari Thapa", 45, 5000);
C) INSERT stdinfo VALUES ("15", "Hari Thapa", 45, 5000);
D) INSERT INTO stdinfo VALUES ("15", "Hari Thapa", 45, 5000);

121. How to Delete records from studentinfo table with name of student 'Hari Prasad'?
A) DELETE FROM TABLE studentinfo WHERE sname='Hari Prasad';
B) DELETE FROM studentinfo WHERE sname='Hari Prasad';
C) DELETE FROM studentinfo WHERE COLUMN sname='Hari Prasad';
D) DELETE FROM studentinfo WHERE sname LIKE 'Hari Prasad';

122. Which of the following statement is correct?


A) SQL processes sets of data as groups rather than as individual units
B) SQL processes sets of data as individual units rather than as groups
C) SQL is not a data sublanguage
D) SQL does not provide an interface to a relational database

123. Which is the default isolation level in MySQL


A) Repeatable Reads B) Read Committed
C) Read uncommitted D) Serializable

124. Which of the following isolation levels allow dirty reads?


A) Repeatable Reads B) Read Committed
C) Read uncommitted D) Serializable

125. Which of the following isolation levels doesn’t allow phantom reads?
A) Repeatable Reads B) Read Committed
C) Read uncommitted d) Serializable
Vidyanidhi Info Tech Academy
PG DAC Question Bank
126. Which of the following isolation levels doesn’t allow non-repeatable reads?
A) Repeatable Reads B) Read Committed
C) both D) none

127. How many primary keys are allowed in a table?


A) 0 B) 1 C) both D) None

128. How many Unique keys are allowed in a table?


A) 0 B) Multiple C) both D) None

129. Can we create composite foreign keys?


A) True B) False

You might also like