Data Collection DBMS Question Bank
Data Collection DBMS Question Bank
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
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
27) Which of the following joins will return highest number of rows? A) Cross Join B) Left Join
C) Inner Join D) Right Join
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? A) Ascending B)
Descending C) None D) both
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
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
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
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$
42) MySQL is
A) A Programming language B) A Programming language
C) A technique for writing reliable programs D) A Relational Database Management System
43) In a LIKE clause, you can ask for any 6 letter value by writing? A) LIKE ??????
B) LIKE .{6} Answer 5: LIKE ^.{6}$
C) LIKE ...... (that's six dots)
D) LIKE ______ (that's six underscore characters)
47) What SQL clause is used to restrict the rows returned by a query?
A) AND B) WHERE C) Group D) FROM
48) 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
49) Which one will delete the table data as well as table structure?
A) TRUNCATE B) DROP C) delete D) All of the above
USM’s Shriram Mantri Vidyanidhi Info Tech Academy
Data Collection DBMS Question Bank eDBDA Sept 21
55) 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;
57) 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
58) 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.
59) Find the SQL statement below that is equal to the following: SELECT NAME FROM CUSTOMER WHERE STATE
=
'VA';
USM’s Shriram Mantri Vidyanidhi Info Tech Academy
Data Collection DBMS Question Bank eDBDA Sept 21
60) 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
61) 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
62) Create table employee (name varchar ,id integer) What type of statement is this ?
A) DML B) DDL C) View D) Integrity constraint
63) To remove a relation from an SQL database, we use the ______ command.
A) Delete B) Purge C) Remove D) Drop table
66) Which of the following makes the transaction permanent in the database ?
A) View B) Commit C) Rollback D) Flashback
67) In order to undo the work of transaction after last commit which one should be used ?
A) View B) Commit C) Rollback D) Flashback
D) No action
69) 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
70) 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
71) 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)
72) All aggregate functions except _____ ignore null values in their input collection.
A) Count(attribute) B) Count(*) C) Avg D) Sum
73) 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);
74) The phrase “greater than at least one” is represented in SQL by _____.
A) < all B) < some C) > all D) > any
75) 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
80) 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
81) 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’)
82) The condition allows a general predicate over the relations being joined.
A) On B) Using C) Set D) Where
83) 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
84) 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
88) 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
90) 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;
91) 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
93) 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
95) 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
96) 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-toone relationship
USM’s Shriram Mantri Vidyanidhi Info Tech Academy
Data Collection DBMS Question Bank eDBDA Sept 21
97) 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
98) Each modification done in database transaction are first recorded into the
A) Harddrive B) Log C) Disk D) Datamar
99) When the transaction finishes the final statement the transaction enters into
A) Active state B) Committed state C) Partially committed state D) Abort state
101) _______ 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
102) 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
104) What command is used to get back the privileges offered by the GRANT command? A) Grant
B) Revoke C) Execute D) Run
105) 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
106) 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%';
107) 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
USM’s Shriram Mantri Vidyanidhi Info Tech Academy
Data Collection DBMS Question Bank eDBDA Sept 21
108) 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;
109) 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;
110) 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);
111) 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';
115) Which of the following isolation levels doesn’t allow phantom reads?
A) Repeatable Reads B) Read Committed C) Read uncommitted D) Serializable
USM’s Shriram Mantri Vidyanidhi Info Tech Academy
Data Collection DBMS Question Bank eDBDA Sept 21
116) Which of the following isolation levels doesn’t allow non-repeatable reads?
A) Repeatable Reads B) Read Committed C) both D) none
128) Which is following query is correct- A) Select from emp having count(*)=1
B) select 1 from emp group by deptid having count(*)=1
C) select from dept from emp group by deptname
D) None
USM’s Shriram Mantri Vidyanidhi Info Tech Academy
Data Collection DBMS Question Bank eDBDA Sept 21
133) What is the command show list of all users in mysql A) select user from mysql.user B) select
user
C) show users D) select current_user()
134) What is the command show list the currently connected user in mysql session
A) select user from mysql.user B) select user
C) show users D) select current_user()
137) Which Normal form allows dependency of one non-key attribute on another non-key attribute?
A) 2nd Normal form B) 3rd Normal form
C) 4th Normal form D) None
Extra MCQ
1. Redo Log Buffer SGA stores all the redo log entries.
2. Process is a ’thread of control’ or mechanism in Operating System that executes series of steps.
3. The data of a row in a table may not be able to fit the same data block. Data for row is stored in a chain of
data blocks which is called as Row chaining
7. An defined as the collection of blocks which must be continuous whenever allocation takes
place.
13. To define access keys in the menu give the ______symbol before the desired character.
15. To print the message along with the variable ew use the package .
19. Once the values are inserted in a table, the size of its columns can only be Increased & can never be
decreased
USM’s Shriram Mantri Vidyanidhi Info Tech Academy
Data Collection DBMS Question Bank eDBDA Sept 21
21. In DBMS terms, the number of rows in a table is called its cardinality & the no. of columns it has defines its
degree
22. The most serious drawback in the ER model is that it cannot depict relationships
23. Dummy records is used to represent many to many relationship in the Network model
24. The data structure used in the Network model is graph & that used in the hierarchical model is tree
25. An SQL query is interpreted & a PL/SQL block is compiled before execution
26. The 4 phases of processing a cursor are Declare, Open, Fetch & Close
27. The FOR UPDATE clause when used with a SELECT query locks a table
28. When a user executes SELECT ……. FOR UPDATE on a table, it tries to lock it, but if the table is already
locked, the user is placed in a no-operation mode. This situation can be prevented by using NOWAIT clause
29. A table whose primary key retains its uniqueness in the view created over it is called a key preserved table
30. Instead of trigger is used to take care of operations on columns of a Non Key-preserved table through the
join view
32. The SQL query for calculating the cube of 4 is SELECT POWER(4, 3) FROM dual
33. WITH READ ONLY clause when used with CREATE VIEW statement prevents the users from modifying the
underlying base tables through the view
34. The With admin option clause of the GRANT command makes the recipient the owner of the granted
object
35. The With grant option clause of the GRANT command allows the recipient to pass the privilege to others
36. The 5 important components of a Database Management system (DBMS) are Database engine, data
dictionary, query processor, report writer & form generator
40. All uncommitted data during the course of a transaction is stored in REDO LOG buffer
41. The precompiler used for SQL statements embedded in a C program is Pro*C
43. The 2 implicit variables available to a trigger that contain the row values before and after updates are :new
and :old
44. The error codes for user defined error messages must lie between -20000, and -20999
45. RAISE_APPLICATION_ERROR statement terminates the PL/SQL block abruptly and displays the specified
error message
46. A NULL value in the column indicates that the value is not applicable or currently not available
52. Which of the following objects are dropped automatically when a table is dropped.
A. Procedure B. Constraints C. Views
D.Synonyms
53. Consider the following four options from a single statement. Which of the following
lines in the SELECT statement below contain an error.
A. SELECT DECODE (EMPID, 58385,’INACTIVE’,’ACTIVE’) EMPID
B. FROM EMP
C. WHERE SUBSTR (LASTNAME, 1, 1) > TO_NUMBER (‘S’)
D. AND EMPID > 02000
E. ORDER BY EMPID DESC, LASTNAME ASC;
54. User ‘Janko’ would like to insert a row into the Emp table, which has 3 columns: empid, lastname, salary. The
user would like to enter data for empid 59694, lastname Harry, but no salary. Which statement would work
best.
A. INSERT INTO EMP VALUES (59694,’Harry’, NULL);
B. INSERT INTO EMP VALUES (59694,’Harry’);
C. INSERT INTO EMP (empid, lastname, salary) VALUES (59694,’Harry’);
D. INSERT INTO EMP VALUES (Select 59694 from ‘Harris’);
E. INSERT INTO EMP(empid, lastname) VALUES (59694,’Harry’);
Which statement must be added to make this trigger execute after updating the salary column of player
table
A. After update on player B. After salary update of player
C. After update [salary] on player D. After update of salary on player
56. For every new ballplayer added to the Player table, a record must be inserted into the Player_Bat_Stat
table.
You have written a trigger to accomplish this task. To which timing will this trigger be assigned.
A. After B. Instead of C. Statement D. Pre-Insert
57. Which of the following is one of the benefits of using procedures and functions A. Procedures and
functions increase the number of calls to the database.
B. Procedures and functions are reparsed for multiple users by exploiting shared SQL areas.
C. Procedures and functions avoid reparsing for multiple users by exploiting shared SQL areas.
D. Testing of procedures and functions requires the database to the restarted to clear out shared SQL areas for
future access.
58. Overall logical structure of a database can be expressed graphically by A. ER diagram B. Records
C. Relations D.
Hierarchy
59. A table can have maximum no. Of Long Raw datatype columns
A. One B. No limit C. 255 D. depends on tablespace
60. A user is setting up a join operation between Emp and Dept tables. The query should return all the
employees, which are assigned dept, as well as the employees which are yet not assigned any dept.
A. Select e.empid, d.head from emp e, dept d;
B. Select e.empid, d.head from emp e, dept d where e.deptno = d.deptno;
C. Select e.empid, d.head from emp e, dept d where e.deptno = d.deptno (+);
D. Select e.empid, d.head from emp e, dept d where e.deptno (+)= d.deptno;
61. Output from a table called PLAYS with two columns, PLAY_NAME and AUTHOR, is shown next. Which of the
following SQL statements produced it?
PLAY_TABLE
-------------------------------------
"Midsummer Night’s Dream", SHAKESPEARE
"Waiting For Godot", BECKETT
"The Glass Menagerie", WILLIAMS
A. select PLAY_NAME|| AUTHOR from PLAYS;
B. select PLAY_NAME, AUTHOR from PLAYS;
C. select PLAY_NAME||’, ’ || AUTHOR from PLAYS;
D. select PLAY_NAME||’, ’ || AUTHOR play_table from PLAYS;
USM’s Shriram Mantri Vidyanidhi Info Tech Academy
Data Collection DBMS Question Bank eDBDA Sept 21
63. Which of the following statements are NOT TRUE about ORDER BY clauses?
A. Ascending or descending order can be defined with the asc or desc keywords.
B. Only one column can be used to define the sort order in an order by clause.
C. Multiple columns can be used to define sort order in an order by clause.
D. Columns can be represented by numbers indicating their listed order in the select
E. clause within order by.
65. A user is setting up a join operation between tables EMP and DEPT. There are some employees in the EMP
table that the user wants returned by the query, but the employees are not assigned to department heads
yet. Which SELECT statement is most appropriate for this user?
A. select e.empid, d.head from emp e, dept d;
B. select e.empid, d.head from emp e, dept d where e.dept# = d.dept#;
C. select e.empid, d.head from emp e, dept d where e.dept# = d.dept# (+);
D. select e.empid, d.head from emp e, dept d where e.dept# (+) = d.dept#;
66. Developer ANJU executes the following statement: CREATE TABLE animals AS SELECT * from
MASTER.ANIMALS; What is the effect of this statement?
A. A table named ANIMALS will be created in the MASTER schema with the same data as the ANIMALS table
owned by ANJU.
B. A table named ANJU will be created in the ANIMALS schema with the same data as the ANIMALS table
owned by MASTER.
C. A table named ANIMALS will be created in the ANJU schema with the same data as the ANIMALS table
owned by MASTER.
D. A table named MASTER will be created in the ANIMALS schema with the same data as the ANJU table
owned by ANIMALS.
69. You issue the following statement. What will be displayed if the EMPID selected is 60494? SELECT
DECODE (empid,38475, ’Terminated’,60494, ’LOA’, ’ACTIVE’) FROM emp;
A. 60494 B. LOA C. Terminated D. ACTIVE
70. After executing an UPDATE statement, the developer codes a PL/SQL block to perform an operation based
on SQL%ROWCOUNT. What data is returned by the SQL%ROWCOUNT operation?
A. A Boolean value representing the success or failure of the update
B. A numeric value representing the number of rows updated
C. A VARCHAR2 value identifying the name of the table updated D. A LONG value containing all data
from the table
71. A procedure declares a user-defined exception but does not raise it explicitly. Which of the following
statements is true about this function?
A. The user-defined exception will never be raised.
B. The user-defined exception will be handled by a WHEN OTHERS exception handler.
C. The procedure will fail on compile.
D. The user-defined exception is defined incorrectly.
72. Which statement most accurately describes the result of not creating an exception handler for a raised
exception?
A. The program will continue without raising the exception.
B. There will be a memory leak.
C. Control will pass to the PL/SQL block caller’s exception handler.
D. The program will return a %notfound error.
74. If left out, which of the following would cause an infinite loop to occur in a simple loop? A. loop
B. end loop C. if-then D. exit
76. Developer JANET receives an error due to the following statement in the DECLARATION section: PI
CONSTANT NUMBER;. The problem is because:
A. There is not enough memory in the program for the constant.
B. There is no value associated with the constant.
C. There is no datatype associated with the constant.
D. PI is a reserved word.
79. Which of the following statements are true about WHILE loops? A.
Explicit exit statements are required in while loops.
B. Counter variables are required in while loops.
C. An if-then statement is needed to signal when a while loop should end.
D. All exit conditions for while loops are handled in the exit when clause.
82. After executing an UPDATE statement, the developer codes a PL/SQL block to perform an operation based
on SQL%ROWCOUNT. What data is returned by the SQL%ROWCOUNT operation?
A. A Boolean value representing the success or failure of the update
B. A numeric value representing the number of rows updated
C. A VARCHAR2 value identifying the name of the table updated D. A LONG value containing all data from the
table
83. A developer would like to use referential datatype declaration on a variable. The variable name is
EMPLOYEE_LASTNAME, and the corresponding table and column is EMPLOYEE, and LASTNAME,
respectively.
How would the developer define this variable using referential datatypes?
A. Use employee.lname%type.
B. Use employee.lname%rowtype.
C. Look up datatype for EMPLOYEE column on LASTNAME table and use that.
D. Declare it to be type LONG.
USM’s Shriram Mantri Vidyanidhi Info Tech Academy
Data Collection DBMS Question Bank eDBDA Sept 21
84. The RAISE_APPLICATION_ERROR( ) procedure defines errors returned in which of the following numeric
ranges?
A. -00000 and -99999 B. -01200 and -01299
C. -00030 and -00039 D. -20000 and -20999
85. When developing a PL/SQL library, the developer defines variable NUM2 as IN OUT in the ADD_NUMS( )
function. Which of the following statements may happen as a result of this? A. The add_nums( ) function
will not compile.
B. Code running after add_nums( ) that uses the NUM2 variable may behave unpredictably because NUM2’s
value was changed in add_nums( ).
C. The add_nums( ) function will return errors to the user when run.
D. The add_nums( ) function will cause a memory leak.
86. In which areas of a PL/SQL block must the developer place code for user-defined exceptions? (Choose three)
A. Command line PL/SQL block call B. Variable declaration section
C. Executable section D. Exception handler
87. A procedure declares a user-defined exception but does not raise it explicitly. Which of the following
statements is true about this function?
A. The user-defined exception will never be raised.
B. The user-defined exception will be handled by a WHEN OTHERS exception handler.
C. The procedure will fail on compile.
D. The user-defined exception is defined incorrectly.
88. Which of the following lines in the PL/SQL source code will return an error?
A. create procedure estatus (
B. eid NUMBER, statchar CHAR ) is begin
C. select status into statchar from EMP where EMPID = eid; end; D. There are no errors in this code block
89. Which of the following trigger types will be impacted by constraining factors brought on by mutating tables?
A. Row triggers only B. Statement triggers only
C. Both row and statement triggers D. Neither row or statement triggers
91. To find information about trigger status, which of the following views are appropriate?
USM’s Shriram Mantri Vidyanidhi Info Tech Academy
Data Collection DBMS Question Bank eDBDA Sept 21
A. ALL_TRIGGERS B. ALL_OBJECTS
C. ALL_TRIGGER_COLS D. ALL_SOURCE
92. UPDATE OR DELETE ON SOCCER_FAN_SNACKS. Which two of the following keywords may be useful in your
trigger source code to distinguish what should run, and when?
A. inserting B. updating C. deleting D. truncating
93. The SOCCER_FANS table has a trigger associated with it that inserts data into
SOCCER_FANS_SNACKS whenever rows are inserted into SOCCER_FANS. A foreign key constraint
exists between FAN_ID on SOCCER_FANS and SOCCER_FANS_SNACKS. What happens when the
trigger fires?
A. The trigger processes normally.
B. The trigger invalidates.
C. The trigger execution fails because of a mutating or constraining table.
D. The trigger execution succeeds because the trigger is a statement trigger.
102. The clause(s) that every SQL Server query must have is/are
A. Select B. From C. Where D. Both (a) and (b)
116. In a query with a GROUP BY clause, the columns in the SELECT clause
A. must be aggregate functions only
B. must also appear in the GROUP BY clause
C. must also appear in the GROUP BY and HAVING clauses
D. Both (a) and (b)
E. Can be selected arbitrarily
125.. For an Oracle user, the privilege to access the tables of other users is known as __________.
A. Object level security B. Command level security
C. Logging in security D. File level security
129. In a SELECT statement, the WHERE clause is used to retrieve rows from __________.
USM’s Shriram Mantri Vidyanidhi Info Tech Academy
Data Collection DBMS Question Bank eDBDA Sept 21
131. __________ is used for importing data from other RDBMS into Oracle.
A. IMP B. SQL*Loader C. Oraterm D. EXP
132. The component of SQL that is used for inserting rows in tables is known as __________.
A. DDL B. DML C. DCL D. DQL
133. The component of SQL that is used for granting and revoking privileges is known as __________.
A. DDL B. DML C. DCL D. DQL
135. In Oracle, you can have a maximum of __________ columns per table.
A. 1000 B. 254 C. 255 D. 256
136. To suppress the duplicate values, you can use the keyword __________.
A. Distinct B. Unique C. Either of the above D. None of the above
143. The transaction control that prevents more than one user from updating data in a table is called
__________.
A. Locks B. Commits C. Rollbacks D. Savepoints
151. Omitting the WHERE clause from a DELETE statement has which of the following effects? A. The delete
statement will fail because there are no records to delete.
B. The delete statement will prompt the user to enter the criteria for the deletion.
C. The delete statement will fail because of syntax error.
D. The delete statement will remove all records from the table.
152. When char datatype is converted to Varchar2 data type of same width then
A. All the blank spaces associated with that column value are removed.
B. All the blank spaces associated with that column value will remain.
C. It is not possible to convert the character to varchar2 data type.
D. None of the above
USM’s Shriram Mantri Vidyanidhi Info Tech Academy
Data Collection DBMS Question Bank eDBDA Sept 21
155. Select ' " ' || SUBSTR('happybirthday',-4,6)||' " ' from dual;
What is the output of the above statement?
A. "happyb” B. "ybirth" C. Statement generates an error D. "hday"
156. Which function will NOT automatically return NULL if passed a NULL argument ?
A. TRUNC B. INSTR C. REPLACE D. TRANSLATE
158. How many columns are presented after executing this query:
SELECT address1||','||address2||','||address2 "Address" FROM
employee; A. 3 B. 2 C. 1
D. ERROR
160. Choose the correct pattern Matching sign for matching a single character.
A. _ B. ? C. * D. %
161. EDIT or ED command places the contents of the query buffer in a file named _____ by default
A. AFEIDT.BUF B. ATFIED.BUF C. AFIEDT.BUF D. AETIED.BUF
164. ____________ makes a string of certain length by adding a certain set of characters to the left A.
LTRIM B. LPAD 3. SUBSTR 4. INSTR
USM’s Shriram Mantri Vidyanidhi Info Tech Academy
Data Collection DBMS Question Bank eDBDA Sept 21
167. In Oracle, the upper limit for nested functions is upto __________ levels.
A. 0 B. 32 C. 64 D. 255
173. To lock the rows of a table manually, you can use a Select statement with the __________ clause. A.
For Update B. For Delete C. For Insert D. For Lock
174. __________ function can be used to make character column data as right-justified.
A. Lpad B. Rpad C. Ljustify D. Rjustify
178. Which line in the following SELECT statement will produce an error?
A. select dept, avg(salary) B. from emp
C. group by empid; D. No errors in this statement
179. Which of the following is the correct order of precedence of SQL clauses?
A. HAVING, GROUP BY, WHERE B. WHERE, GROUP BY, HAVING
C. GROUP BY, HAVING, WHERE D. HAVING, WHERE, GROUP BY
180. Fill in the blank with a numeric function to get 15 as the output.
SELECT __________(-15) "Absolute" FROM DUAL;
A. FLOOR B. MOD C. EXP D. ABS
182. Which of the following SOL functions is used to display the current session date and time?
A. DATE B. TO_DATE C. SYSDATE D. CURRDATE
183. Which of the following is the correct syntax for using the HAVING clause?
A. SELECT (column_name)
HAVING (function condition)
GROUP BY (column_name)
FROM (entity_name);
D. SELECT (column_name)
HAVING (function condition)
FROM (entity_name)
GROUP BY (column_name);
USM’s Shriram Mantri Vidyanidhi Info Tech Academy
Data Collection DBMS Question Bank eDBDA Sept 21
184. Which of the following SQL functions can operate on any datatype?
A. TO_CHAR B. LOWER C. LPAD D. MAX
187. Which of the following uses of the HAVING clause are appropriate?
A. To put returned data into sorted order.
B. To execute certain data groups based on known criteria.
C. To include certain data groups based on unknown criteria.
D. To include certain data groups based on known criteria
190. Select CEIL(MOD(POWER(2,3), FLOOR(3.5))) from dual; What is the result of the above statement?
A. 0 B.1 C. 2 D. 4
191. ____________ makes a string of certain length by adding a certain set of characters to the left
A. LTRIM B. LPAD C. SUBSTR D. INSTR
197. Which one of the following statements about oracle’s set operators is incorrect:
A. UNION - Combine the unique rows returned by 2 SELECT statements
B. UNION ALL - Combine the rows returned by 2 SELECT statements (including all duplicates)
C. INTERSECT - Return only those rows that are in both SELECT statements
D. EXCEPT - Return the rows that are in the first SELECT but not the second
198. To alter the Oracle prompt for accepting input from the keyboard, one an A.
Change the prompt in the config.ora file.
B. Use the prompt clause of the accept command.
C. Enter a new prompt in the login.sql file.
D. There is no way to change a prompt in Oracle.
199. The default character for specifying substitution variables in SELECT statements is
A. Ampersand B. Ellipses C. Quotation marks D.
Asterisk
201. If five tables are given & three join conditions are given & select Query is applied then what will happen?
A. Cartesian product of first 3 tables
B. Three joins make relation between four tables & keep the fifth independent
C. We cannot apply 3 joins on 5 tables
USM’s Shriram Mantri Vidyanidhi Info Tech Academy
Data Collection DBMS Question Bank eDBDA Sept 21
D. None of above
204. A user is setting up a join operation between Emp and Dept tables. The query should return all the
employees, which are assigned a dept, as well as the employees which are yet not assigned any dept.
A. Select e.empid, d.dname from emp e, dept d;
B. Select e.empid, d.dname from emp e, dept d where e.deptno = d.deptno;
C. Select e.empid, d.dname from emp e, dept d where e.deptno = d.deptno (+); D. Select e.empid, d.dname
from emp e, dept d where e.deptno (+)= d.deptno
209. Which SQL commands are used to create, modify and delete database structure but not data?
A. DDL B. DML C. DCLD. D. QL
212. Which of the following queries can you use to search for employees with the pattern 'A_B' in their names?
A. SELECT last_name FROM employees WHERE last_name LIKE '%A\_B%';
B. SELECT last_name FROM employees WHERE last_name LIKE '%A_B%';
USM’s Shriram Mantri Vidyanidhi Info Tech Academy
Data Collection DBMS Question Bank eDBDA Sept 21
213. Which of the following correctly shows the correct use of the TRUNC command on a date?
A. SELECT TRUNC(TO_DATE(12-Feb-99,DD-MON-YY, 'YEAR')) "Date " FROM DUAL;
B. TRUNC = TO_DATE('12-Feb-99','DD-MON-YY'), 'YEAR', "Date " FROM DUAL;
C. SELECT TRUNC(TO_DATE('12-Feb-99','DD-MON-YY'), 'YEAR') "Date " FROM DUAL;
D. date = TRUNC(TO_DATE('12-Feb-99','DD-MON-YY'), 'YEAR') "Date " FROM DUAL
214. Evaluate this SQL statement: SELECT e.employee_id, (.15* e.salary) + (.5 * e.commission_pct) +
(s.sales_amount * (.35 * e.bonus)) AS CALC_VALUE FROM employees e, sales WHERE e.employee_id =
s.emp_id; What will happen if you remove all the parentheses from the calculation?
A. The value displayed in the CALC_VALUE column will be lower.
B. The value displayed in the CALC_VALUE column will be higher.
C. There will be no difference in the value displayed in the CALC_VALUE column.
D. An error will be reported.
215. The EMPLOYEES table contains these columns: EMPLOYEE_ID NUMBER(4) ENAME VARCHAR2 (25) JOB_ID
VARCHAR2(10) Which SQL statement will return the ENAME, length of the ENAME, and the numeric position of
the letter "a" in the ENAME column, for those employees whose ENAME ends with a the letter "n"?
A. SELECT ENAME, LENGTH(ENAME), INSTR(ENAME, 'a') FROM EMPLOYEES WHERE SUBSTR(ENAME, -1, 1) =
'n';
B. SELECT ENAME, LENGTH(ENAME), INSTR(ENAME, ,-1,1) FROM EMPLOYEES WHERE SUBSTR(ENAME, -1, 1) =
'n';
C. SELECT ENAME, LENGTH(ENAME), SUBSTR(ENAME, -1,1) FROM EMPLOYEES WHERE INSTR(ENAME, 1, 1) =
'n';
D. SELECT ENAME, LENGTH(ENAME), SUBSTR(ENAME, -1,1) FROM EMPLOYEES WHERE INSTR(ENAME, -1, 1) =
'n';
216. You would like to display the system date in the format "Monday, 01 June, 2001". Which SELECT statement
should you use?
A. SELECT TO_DATE (SYSDATE, 'FMDAY, DD Month, YYYY') FROM dual;
B. SELECT TO_CHAR (SYSDATE, 'FMDD, DY Month, YYYY') FROM dual;
C. SELECT TO_CHAR (SYSDATE, 'FMDay, DD Month, YYYY') FROM dual; D. SELECT TO_CHAR (SYSDATE,
'FMDY, DDD Month, YYYY') FROM dual;
218. Which SELECT statement should you use to extract the year from the system date and display it in the
format "1998"?
A. SELECT TO_CHAR(SYSDATE, 'yyyy') FROM dual;
USM’s Shriram Mantri Vidyanidhi Info Tech Academy
Data Collection DBMS Question Bank eDBDA Sept 21
219. Evaluate this SQL statement: SELECT ename, sal, 12*sal+100 FROM EMP; The SAL column stores the
monthly salary of the employee. Which change must be made to the above syntax to calculate the
annual compensation as "monthly salary plus a monthly bonus of $100, multiplied by 12"? A. No change
is required to achieve the desired results.
B. SELECT ename, sal, 12*(sal+100) FROM emp;
C. SELECT ename, sal, (12*sal)+100 FROM emp;
D. SELECT ename, sal+100,*12 FROM emp;
220. Which describes the default behavior when you create a table? A.
The table is accessible to all users.
B. Tables are created in the public schema.
C. Tables are created in your schema.
D. Tables are created in the DBA schema.
221. Evaluate the SQL statement: SELECT ROUND (TRUNC (MOD (1600, 10),-1), 2) FROM dual; What will be
displayed?
A. 0 B. 1 C. 0.00 D. an error statement
222. You added a PHONE-NUMBER column of NUMBER data type to an existing EMPLOYEES table. The
EMPLOYEES table already contains records of 100 employees. Now, you want to enter the phone numbers of
each of the 100 employees into the table some of the employees may not have a phone number available.
Which data manipulation operation do you perform?
A. MERGE B. INSERT C. UPDATE D. ADD
223. You define a multiple-row subquery in the WHERE clause of an SQL query with a comparison operator"="
What happens when the main query is executed?
A. the main query executes with the first value returned by the subquery
B. the main query executes with the last value returned by the subquery
C. the main query executes with all the values returned by the subquery
D. The main query fails because the multiple-row subquery cannot be used with the comparison operator.
225. You need to display the last names of those employees who have the letter "A" as the second character in
their names. Which SQL statement displays the required results?
A. SELECT last_name FROM EMP WHERE last_name LIKE'_A%;
B. SELECT last_name FROM EMP WHERE last name='*A%
C. SELECT last_name FROM EMP WHERE last name ='* _A%;
D. SELECT last_name FROM EMP WHERE last name LIKE '* a%
228. When you create a variable in PL/SQL that has not been initialized, it stores a __________ value.
A.Blank B.0 C.Null D.Garbage
230. The if elsif else end if construct is similar to __________ function of SQL.
A.Decode B. Round C.Trunc D.Sign
232. In PL/SQL, A __________ variable can store a logical true or false value.
A. Char B. Binary C. Boolean D. Logical
238. The PL SQL blocks can contain _________ & _______________ statements
A.DML,DCL B. DML,DDL C. GRANT,REVOKE D. TCL,DML
239. begin
for i in 3..1 loop dbms_output.put_line(i);
for j in 1..3 loop dbms_output.put_line(j);
end loop;
end loop;
end;
/
What is the output of the sample code above assuming SETSERVEROUTPUT is set ON?
A. 3,1,2,3,2,1,2,3,1,1,2,3
B. 1,1,2,3,2,1,2,3,3,1,2,3,
C. 1,1,2,3
D. Nothing is printed
240. Which of the following describes the concept of composite data type?
A. A composite data type is a variable that is comprised of multiple datatypes and can hold multiple rows of data.
B. A composite datatype is a type that is comprised of multiple datatypes.
C. A composite data type is a type that can hold multiple rows of data.
USM’s Shriram Mantri Vidyanidhi Info Tech Academy
Data Collection DBMS Question Bank eDBDA Sept 21
244. ___________ is used to declare a composite variable X which has as many columns as in the table EMP
A.X Emp%tabletype
B.X Emp%rowtype
C.X Emp
D. Emp X
247. ____________ loop if used properly can be used to ensure that the statements within the loop are
executed iteratively but at least once.
A. loop .. end loop;
B. While loop …….end loop;
C. for I in 1..10 loop ……… end loop;
D. All of the above
249. The attribute to declare a variable according to another previously declared variable or database column.
A.%ROWTYPE B.%TYPE C.%DATATYPE D.%VARIABLE
251. Dropping a table has the following effects on a non-unique index created for the table.
A. No effect
B. The index will be dropped
C. The index will be rendered invalid
D. The index will contain NULL values
257. Which statement most accurately describes the result of not creating an exception handler for a raised exception? A.
The program will continue without raising the exception B. There will be a memory leak
C. Control will pass to the PL/SQL block caller’s exception
handler. D. The program will return a %notfound error
258. When we combine multiple columns in a single index, it is known as a __________ index. A. Composite B.
Multiple C. Multicol D. Complicated
260. In PL/SOL if you need to deal with a group of rows, then you must place returned data into A. Select statement
B. Cursors C. into clause D. Code storage
261. In Explicit cursors the __________ attribute returns the number of rows fetched from the active set.
A. SQL %FOUND B. SQL %ROW C. SQL %ROWCOUNT D. SQL %COUNT
262. Which of the following database objects stores table column data and row reference information?
A. Tables B. Sequences C. Indexes D. Views
264. The attribute __________ indicates whether a FETCH statement returns a row from the active set .
A. %isfound B. %notpresent C. %notfound D. %isopen
SELECT id
INTO v_id
FROM box_rcpt_tab
WHERE receipt_dt = '08-JAN-98';
END;
/
Which exception will be raised by the statement above?
A. INVALID_NUMBER B. TOO_MANY_ROWS C. VALUE_ERROR D. NO_DATA_FOUND
266. What is a PRAGMA?
A. A conversion
function
B. A composite data type
C. A pre-compiler directive
D. A utility program used to extract data into flat files.
267. The __________ statement retrieves the current row and advances the cursor to the next row.
A. SET B. GET C. MOVE D. None of the above
269. ____________ is the name of the Implicit cursor created by Oracle in a PLSQL block
A. Oracle B.PLSQL C.SQL D. Cursor
270. __________ is the type of cursor used for DML statements within a PLSQL block A.IMPLICIT
B.EXPLICIT
C.both IMPLICIT and EXPLICIT
D.neither IMPLICIT and EXPLICIT
271. ___________ is the type of cursor used for SELECT statements in a PLSQL block which return more than one row
A. Explicit B. Implicit C. Both Explicit and Implicit D. Neither Explicit nor Implicit
273. The ____________ step actually executes the SELECT query associated with an Explicit cursor
A. Declare B. Open C .Fetch D. Close
277. ______________ is an explicit cursor attribute which does not return a Boolean value
A. %Open B. %Found C. %NotFound D. %rowcount
278._____________ is an explicit cursor attribute which can be used to exit from a Cursor loop after certain number of
rows in the cursor have been processed
A. %Open B. %Found C.%NotFound D.%rowcount
279. Actual values for parameterized cursors have to passed at the time of _____________ the cursor.
A.Declaring B. Opening C.Fetching (values from the cursor) D.Closing
280. To open an already opened explicit cursor, you need to first _______ the cursor
A . Redeclare B. Fetch from C. Reopen D. Close
281. __________ option can be used with the query of the cursor to obtain a lock on the rows opened by the cursor
A FOR LOCK B.FOR UPDATE C.FOR CHANGE D.FOR EXPLICIT
282. _________ clause can be used with the clause to obtain a lock to return an error in case you cannot get a lock.
A GiveError B.NOWAIT C.WAIT D. Error
283. In case a lock is requested for, in the cursor’s query, the lock is actually achieved when you _________ the cursor.
A Declare B. Open C .Fetch(from the cursor) D. Close
284. _______________ option can be used with an Update/Delete command to update/delete the row from the table
through the corresponding row in the cursor to avoid a possible table scan. A.Where Current of <cursorname>
B.Where Current of <tablename>
C.Where Current of Row
D.Where Current of Thisrow
289. The ___________________ utility tells the compiler to associate an exception name with an Oracle error number
A.PRAGMA INIT_EXCEPTION
B.PRAGMA EXCEPTION_INITIALISE
C.PRAGMA EXCEPTION_INIT
D.PRAGMA EXCEPTIONINIT
290. ____________________ returns the numeric value for the error code in PLSQL.
A.SQLERRM B.SQLERRCODE C.SQLERR D.SQLCODE
291. _____________________ returns the message associated with an error code in PLSQL.
A.SQLERRM B.SQLERRMSG C.SQLMSG D.SQLCODE
292. When an exception occurs in a PLSQL block and it is handled, the block is said to _________________
A Complete B. Terminate with success C. Terminate with failure D. Neither of the above
293. When an exception occurs in a PLSQL block and it is handled, the uncommitted DMLs in the block _________________
A.are implicitly rolled back
B.are implicitly committed
C.can be committed or rolled back as per requirement
D.Have to be committed, else they are rolled back
294. A field, or a combination of fields, that has a unique value is a __________. A. foreign key B. primary key
C. relation 4. Table
296. If you delete a row in a table, and Oracle deletes the related entries in all other tables. This is known as __________.
A.Referential Integrity B. Deleting rows C. Data Integrity D. Cascading delete
297. The RAISE_APPLICATION_ERROR( ) procedure defines errors returned in which of the following numeric ranges? A.. –
00000 and –99999
B. –01200 and –01299
C. –00030 and –00039
D. –20001 and –20999
USM’s Shriram Mantri Vidyanidhi Info Tech Academy
Data Collection DBMS Question Bank eDBDA Sept 21
301. Select * from __________ will give a listing of the source code of Stored procedures, Stored functions and Packages.
A. User_source B. All_source C. DBA_source D. All of the above
302. When a Database trigger causes a second one to fire, which in turn causes a third one to fire, the concept is known as
__________ triggers.
A. Cascading B. Mutating C. Constraining D. Waterfall
303. When we combine multiple columns in a single index, it is known as a __________ index.
A. Composite B. Multiple C. Multicol D. Complicated
304. In PL/SQL, to raise our own user-defined backend error messages, we can issu the command __________. A. Raise B.
Raise exception name C. Raise error D.
Raise_application_error
305. Entity Integrity is managed in RDBMS with the help of __________ constraint.
A. Primary key B. Not Null C. Unique D. Foreign key
307. Repeating groups are removed from table design. This is definition of which Normal Form? A. 1st Normal Form B. 2nd
Normal Form C. 3rd Normal Form D. 4th Normal Form
A. To recompile View
B. To recompile a Table
C. To define a View of one or more tables or Views
D. All of the above
311. . In which of the following SQL commands can you call a stored function?
A. SELECT B. UPDATE C. DELETE D. All of the above
312. Oracle periodically runs __________ algorithm to free the server RAM of unused packages.
A. Bubblesort B. L.R.U. C. Cache D. F.I.F.O.
317. To find information about trigger status , which of the following views are appropriate?
A. ALL_TRIGGERS B. ALL_OBJECTS C. ALL_TRIGGER_COLS D. ALL_SOURCE
USM’s Shriram Mantri Vidyanidhi Info Tech Academy
Data Collection DBMS Question Bank eDBDA Sept 21
318. A trigger is based on After insert on a table. The reference :old.column will
A. Give the previous value for that column
B. Give the current value for that column
C. Give NULL
D. Invalid statement
320. On-delete-cascade option with foreign key constraint does which one of the following?
A. Delete from the master table
B. Delete from the transaction table
C. Removes all the transaction entries along with master
D. None
---
E
nd;
/
Calling P1(2,3) will
A. Execute successfully
B. Will return an error due to second argument
USM’s Shriram Mantri Vidyanidhi Info Tech Academy
Data Collection DBMS Question Bank eDBDA Sept 21