You are on page 1of 10

SQL/PL-SQL Objective questions

1.Which of the following is not correct about User_Defined Exceptions ?


a. Must be declared
b. Must be raised explicitly
c. Raised automatically in response to an Oracle error
d. None of the above
2. A Stored Procedure is a
a. Sequence of SQL or PL/SQL statements to perform specific function
b. Stored in compiled form in the database
c. Can be called from all client environments
d. All of the above
3. Select REPLACE('JACK AND JUE','J','BL') from dual; - will return
a. JACK AND BLUE
b. BLACK AND JACK
c. BLACK AND BLUE
d. None of the above
4. Which of the following is not correct about a View ?
a. To protect some of the columns of a table from other users
b. Occupies data storage space
c. To hide complexity of a query
d. To hide complexity of a calculations
5. Which is not part of the Data Definition Language ?
a. CREATE
b. ALTER
c. ALTER SESSION
d. Drop
6. The Data Manipulation Language statements are
a. INSERT
b. UPDATE
c. SELECT
d. All of the above
7.
EMPNO
A822
A812
A973
A500

ENAME
RAMASWAMY
NARAYAN
UMESH
BALAJI

Using the above data Select count(sal) from Emp will retrieve

SAL
3500
5000
5750

a. 1
b. 4
c. 3
d. None of the above
8. What are the different events in Triggers ?
a. Define, Create
b. Drop, Comment
c. Insert, Update, Delete
d. All of the above
9. What are cursor attributes?
a. %ROWCOUNT
b. %NOTFOUND
c. %FOUND
d. All of the above
10. Which of the following is not correct about Cursor ?
a. Cursor is a named Private SQL area
b. Cursor holds temporary results
c. Cursor is used for retrieving multiple rows
d. SQL uses implicit Cursors to retrieve rows
11. Which of the following is NOT VALID in PL/SQL block?
a Select ... into
b. Update
c. Create
d. Delete
12. 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 ...

13. What type of join is needed when you wish to return rows that do have matching
values?
a. Equi-join
b. Natural join
c. Outer join

d. All of the above.

14. Which of the following is true about a view?


a. A virtual table that can be accessed via SQL commands
b. A virtual table that cannot be accessed via SQL commands
c. A base table that can be accessed via SQL commands
d. A base table that cannot be accessed via SQL commands

15. Which of the following is valid SQL for an Index?


a. CREATE INDEX ID;
b. CHANGE INDEX ID;
c. ADD INDEX ID;
d. REMOVE INDEX ID;

16. The HAVING clause does which of the following?


a. Acts like a WHERE clause but is used for groups rather than rows.
b. Acts like a WHERE clause but is used for rows rather than columns.
c. Acts like a WHERE clause but is used for columns rather than groups.
d. Acts EXACTLY like a WHERE clause.

17. To remove duplicate rows from the results of an SQL SELECT statement, the ________
qualifier specified must be included.
a. ONLY
b. Distinct
c. Single
d. Unique
18. 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');

19. Which of the following is the legal expression in SQL?


a. Select NULL from emp
b. Select name from emp where salary = NULL;
c. None of these
d. Both of these
20. An entity set that does not have sufficient attributes to form a primary key is a
a. strong entity set.
b. weak entity set.
C. simple entity set.
d. primary entity set.
21. Count function in SQL returns the number of
a. values.
b. distinct values.
c. groups.
d. columns.

22. The statement in SQL which allows to change the definition of a table is
a. Alter.
b. Update.
c. Create.
d. select.
23. Which of the following is correct:
a. a SQL query automatically eliminates duplicates.
b. SQL permits attribute names to be repeated in the same relation.
c. a SQL query will not work if there are no indexes on the relations
d. None of these

24. Which of the following operations need the participating relations to be union
compatible?
a. UNION
b. INTERSECTION
c. DIFFERENCE
d. All of the above

25. Which of the following is a comparison operator in SQL?


a. =
b. LIKE
c. BETWEEN
d. All of the above

26. Which of the following database object does not physically exist?
a.base table
b.index
c.view
d.none of the above

27. NULL is
a.the same as 0 for integer
b.the same as blank for character
c.the same as 0 for integer and blank for character
d.not a value

28. Consider the join of a relation R with relation S. If R has m tuples and S has n tuples,
then the maximum size of join is:
a. mn
b. m+n

c. (m+n)/2
d. 2(m+n)

29. Consider the following relation schema pertaining to a students database:


Student (rollno, name, address)
Enroll (rollno, courseno., coursename)
Where the primary keys are shown underlined. The number of tuples in the Student and
Enroll tables 120 and 8 respectively. What are the maximum and minimum number of tuples
that can be present in (Student * Enroll), where * denotes natural join?
a.8, 8
b.120, 8
c.960, 8
d.960, 120

30. _____________ function divides one numeric expression by another and returns the
remainder.
a. POWER
b. MOD
c. ROUND
d. REMAINDER

31. A table joined with itself is called


a. Join
b. Self Join
c. Outer Join
d. Equi Join

32. _________ data type can store unstructured data


a. RAW
b. CHAR
c. NUMERIC

d. VARCHAR

33. SELECT SUBSTR (chemistry,1, 5) FROM dual; will returna. chemis


b. chemi
c. chemistry
d. chemi

34. Which of the following STATEMENT is true?


a. select title, BOOK_ID, sum(price) from book group by title, BOOK_ID having
sum(price)>555;
b. select title, BOOK_ID, sum(price) from book group by title, BOOK_ID having price >
555;
c. Both of these
d. None of these

35. Which of the following statement about JOIN is false ?


a. The join of two tables returning only matched rows is called an inner join.
b. A join between two tables that returns the results of the inner join as well as the
unmatched rows from the left (or right) tables is called a left (or right) outer join.
c. A join between two tables that returns the results of an inner join as well as the results of
a left and right join is a full outer join.
d. None of these

36. INSERTION through VIEW in the base table is prohibited if the view containsa.GROUP Functions
b.Any NOT NULL columns of base table are not selected in the view
c.DISTINCT Clause
d.All of above

37. Which of the following statement about PL/SQL block structure is false?

a. The DECLARE section is Compulsory and used to define PL/ SQL objects.
b. The BEGIN and END elements are main sections and body of the actions to be performed,
is enclosed in between BEGIN and END.
c. The EXCEPTION section is also optional and is placed immediately before the END.
d. None of these

38. In PL/SQL, SELECTINTO Statement ____________:


a.should not return more than one row.
b.Can return multiple rows
c.Can return only one record
d.Both a. and c.

39. Which of the following represents the steps while controlling Explicit Cursor?
a. Declare, Open, Fetch, Close
b. Declare, Fetch, Open, Close
c. Open, Fetch, Close
d. None of These

40. Which of the following statement about Cursor is false?


a. Opening a cursor means to defines the cursor area.
b. More than one cursor can be opened at a time
c. Closing a cursor will free all the resources associated with it
d. More than one cursor cannot be opened at a time.

41. Which of the following mode is not used to pass the value to procedure?
a. IN
b. OUT
c. INOUT
d. OUTIN

42. Which of the following statement about Cursor declaration is TRUE?


a. CURSOR is SELECT Empno FROM EMP WHERE Deptno=10;
b. CURSOR is SELECT Empno into eno FROM EMP WHERE Deptno=10;
c. CURSOR c1 is SELECT Empno FROM EMP WHERE Deptno=10;
d. None of these.

43. Which of the following bind variables is NOT used to access the values of currently
processed row by the trigger?
a. :old
b. :new
c. :current
d. None of these

44.Which of the following types of triggers is used to validate the UPDATE, INSERT and
DELETE operations after they have taken place and allow rollback on exceptions raised?
a.Before Trigger
b.After Trigger
c.Row Trigger
d.Statement Trigger

45 A ________ is a stored program that is attached to a table or a view.


a.
b.
c.
d.

Pseudofile
embedded SELECT statement
trigger
None of the above is correct.

46 The DROP TABLE statement:


a.
b.
c.
d.

deletes the table structure only.


deletes the table structure along with the table data.
works whether or not referential integrity constraints would be violated.
is not an SQL statement.

47. The following SQL is which type of join:

SELECT CUSTOMER_T. CUSTOMER_ID, ORDER_T. CUSTOMER_ID, NAME, ORDER_ID FROM


CUSTOMER_T, ORDER_T WHERE CUSTOMER_T. CUSTOMER_ID = ORDER_T. CUSTOMER_ID
a.
b.
c.
d.

Equi-join
Natural join
Outer join
Cartesian join

48. What is not an advantage of stored procedures?


a. Greater security
b. SQL can be optimized
c. Code sharing
d. Increased network traffic

49. Which of the following is an SQL trigger supported by Oracle for VIEWS ?
a. BEFORE
b. INSTEAD OF
c. AFTER
d. ROW

50. AS clause is used in SQL for


a. Selection operation.
b. Rename operation.
c. Join operation.
d. Projection operation.