Oracle Mock Test

11
1. What is the maximum number of handlers processed before the PL/SQL block is exited when an exeception occurs? a) Only One b) All that apply c) all Referenced d) None 2. Which statement is valid when removing procedures? a) Use a drop procedure statement to drop a standalone procedure b) Use a drop procedure statement to drop a procedure that is part of a package. Then recompile the package specification. c) Use a drop procedure statement to drop a procedure that is part of a package. Then recompile the package body. d) For faster removal and re-creation, do not use a drop procedure statement. Instead, recompile the procedure using the alter procedure statement with the REUSE SETTINGS clause. 3. You query the database with this command SELECT name FROM employee WHERE name LIKE ‘_a%’; Which names are displayed? a) Names starting with ?a? b) Names starting with ?a? or ?A? c) Names containing ?a? as second character. d) Names containing ?a? as any letter except the first. 4. Which of these is the default character for specifying runtime variable in SELECT statement a) Ampersand b) Ellipses c) Quotation marks d) Asterisk 5. Which of the program declarations are correct for a stored program unit?(choose 2) a) CREATE OR REPLACE FUNCTION tax_amt(p_id NUMBER) RETURN NUMBER b) CREATE OR REPLACE PROCEDURE tax_amt(p_id NUMBER) RETURN NUMBER c) CREATE OR REPLACE PROCEDURE tax_amt(p_id NUMBER,p_amount OUT NUMBER)

Transcript of Oracle Mock Test

Page 1: Oracle Mock Test

1. What is the maximum number of handlers processed before the PL/SQL block is exited when an exeception occurs?

a) Only Oneb) All that applyc) all Referencedd) None

2. Which statement is valid when removing procedures?a) Use a drop procedure statement to drop a standalone procedureb) Use a drop procedure statement to drop a procedure that is part of a package. Then

recompile the package specification.c) Use a drop procedure statement to drop a procedure that is part of a package. Then

recompile the package body.d) For faster removal and re-creation, do not use a drop procedure statement. Instead,

recompile the procedure using the alter procedure statement with the REUSE SETTINGS clause.

3. You query the database with this command SELECT name FROM employee WHERE name LIKE ‘_a%’; Which names are displayed?a) Names starting with ?a?b) Names starting with ?a? or ?A?c) Names containing ?a? as second character.d) Names containing ?a? as any letter except the first.

4. Which of these is the default character for specifying runtime variable in SELECT statementa) Ampersandb) Ellipsesc) Quotation marksd) Asterisk

5. Which of the program declarations are correct for a stored program unit?(choose 2)a) CREATE OR REPLACE FUNCTION tax_amt(p_id NUMBER) RETURN NUMBERb) CREATE OR REPLACE PROCEDURE tax_amt(p_id NUMBER) RETURN NUMBERc) CREATE OR REPLACE PROCEDURE tax_amt(p_id NUMBER,p_amount OUT NUMBER)d) CREATE OR REPLACE FUNCTION tax_amt(p_id NUMBER) RETURN NUMBER(10,2)e) CREATE OR REPLACE PROCEDURE tax_amt(p_id NUMBER, p_amount OUT NUMBER(10,2))

6. Which procedure can be used to create a customized error message?a) RAISE_ERRORb) SQLERRMc) RAISE_APPLICATION_ERRORd) RAISE_SERVER_ERROR

Page 2: Oracle Mock Test

7. Which Oracle supplied package can you use to output values and messages from database triggers, stored procedures and functions within SQL*Plusa) DBMS_DISPLAYb) DBMS_OUTPUTc) DBMS_LISTd) DBMS_DESCRIBE

8. You want to execute a procedure from SQL plus. However you are not given the argument list for the procedure. Which command will display to show the argument list?a) DESCRIBEb) SHOWLISTc) SHOW ARG_LISTd) SHOW PROCEDURE

9. Which data dictionary views gives you the names and the source code of the procedure that you have created?a) USER_SOURCEb) USER_OBJECTSc) USER_PROCEDURESd) USER_SUBPROGRAMS

10. What should you do after each fetch statement in PL/SQL block?a) Open the cursorb) Close the cursorc) Initialize the loopd) Test for the rows using the cursor attribute.

11. Can you use a commit statement within a database trigger?a) TRUEb) FALSE

12. SQL%ISOPEN for implicit cursor is always evaluate to false.a) TRUEb) FALSE

13. You want to display the details of employess whose lastname is smith. But you are not sure in which case last names are stored. Which statement will list all the employees whose last name is smith?a) Select last_name, first_name from emp where last_name=’smith’;b) Select last_name, first_name from emp where upper(last_name)=’smith’;c) Select last_name, first_name from emp where last_name=upper(‘smith’);d) Select last_name, first_name from emp where lower(last_name)=’smith’;

Page 3: Oracle Mock Test

14. Evaluate this SQL statement:SELECT ename,sal,12*sal+100 from emp;The SAL column stores the monthy 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, multiplies by 12’?a) No change is required to achieve the desired resultsb) 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;

15. Creating a foreign key constraint between columns of two tables defined with two different datatypes will procedure an error.a) Trueb) False

16. Select product_id “Product_ID”,sum(price) “Price”a) From productsb) Where price>60.00c) Group by “Product ID”;d) Order by sum(price);

Which clause will cause an error?

17. How to specify a column alias?a) Place the alias at the beginning of the statement to describe tableb) Place the alias after each column, separated by white space, describe the column.c) Place the alias after each column, separated by a comma, to describe the column.d) Place the alias at the end of the statement to describe the table.

18. What is an Index?a) An index is a database table attribute, which speeds up data search within a table.b) An index is the same as alias.c) An index is a special way to join 2 or more tables.d) An index is a database row attribute, which speeds up data search within a table.

19. Which of the following SQL statements is correct?a) TRUNCATE Sales TABLE;b) TRUNCATE * FROM TABLE Salesc) TRUNCATE TABLE Sales;d) TRUNCATE * FROM COLUMN Sales

20. The IN SQL keyworda) Is used with the DISTINCT SQL keyword only.

Page 4: Oracle Mock Test

b) Is used with the INSERT SQL keyword only.c) Determines if a value matches any of the values in a list or a sub query.d) Defines the tables we are selecting or deleting data from.

21. The LIKE SQL keyword is used along witha) WHERE clauseb) ORDER BY clausec) JOIN claused) GROUP BY clause

22. You have decided to permanently remove all the data from the STUDENT table and you need the table structure in the future. Which single command will perform this?a) DROP table student;b) Truncate table student;c) Delete * from student;d) Truncate table student KEEP STRUCTURE.e) Delete * from student KEEP STRUCTURE.

23. Which statement describes the use of a group function?a) A group function produces a group of results from one row.b) A group function produces a one results from each row in the table.c) A group function produces a one results from many d) A group function produces many of results from many rows.

24. In this PL/SQL statement, Which of the following lines will produce an error?a) Create or replace function vat (vat_rate IN NUMBER, price IN NUMBER)b) Declarec) L_vat NUMBER;d) Begine) No Error

25. Functions for error trapping are contained in which section of a PL/SQL block?a) HEADERb) DECLARATIVEc) EXECUTABLEd) EXCEPTION

26. Which three definitions are associated with implicit cursors?a) %rowtype,%toomanyrows,%foundb) %found,%notfound,%rowcountc) %rowtype,%rowcount,%notfoundd) None of the Above

Page 5: Oracle Mock Test

e) All of the above

27. What does the SQL FROM clause do?a) Specifies a search condition.b) Specifies the tables to retrieve rows from.c) Specifies the columns we are retrieving.d) Specifies the attributes to retrieve rows from.

28. We refer to a join as a self join when…a) We are using left and right join together.b) We are joining two tables onlyc) We are joining more than 2 tablesd) We are joining table to itself.

29. Which SQL statement selects all rows from table called contest, which column contestDate having Values greater or equal to MAY 25,2006?a) Select * from Contest HAVING ContestDate>=’05/25/2006’b) Select * from Contest WHERE ContestDate<’05/25/2006’c) Select * from Contest GROUP BY ContestDate>=’05/25/2006’d) Select * from Contest WHERE ContestDate>=’05/25/2006’

30. If you don’t specify ASC or DESC after a SQL ORDER BY clause following is used by default:a) There is no default value.b) DESC.c) ASC.d) Random

31. What is a Trigger?a) A Trigger is a special kind of procedures excuted when certain event occursb) A trigger defines relations between tables.c) A trigger is part of data extraction process

32. What output is the following statement produce ? Select NVL2(NULL, ‘NOT NULL’, NULL) from dual;a) NULLb) NOT NULLc) Function NVL2 is not definedd) 0None of the above

33. PL/SQL raises an exception, in which TWO of the following cases:a) When SELECT statement returns no rowsb) When SELECT statement returns more than one row

Page 6: Oracle Mock Test

c) When the datatypes of SELECT clause and INTO clause do not matchd) When INTO statement is missing in the SELECT statement

34. What is the database cursor?a) A blinking vertical line that indicates the location of the next input on the display screen.b) A cursor is SQL keyword specifying a retrieved data order.c) Cursor is acronym for current Set Of Records and is a database object pointing to ad) Currently selected set of records.

35. What does the term ‘locking’ refer to?a) locking is a process, which logs database usage.b) Locking is a process of database authentication.c) Locking is a process preventing users from reading data being changed by other users, and

prevents concurrent users from changing the same data at the same time.

36. Which section of a PL/SQL block would most likely contain a RAISE statement?a) Header b) Declarativec) Executabled) Exception

37. Which of the following statements about an SQL statement are not correct?a) SQL statements can be on one or more lines.b) Keywords cannot be split across lines.c) SQL statements are ot case-sensitiv, unless indicated.d) Keywords can be abbreviated.

38. The table rows are also known as…a) Recordsb) Fieldsc) Attributes

39. What is the ABS SQL function used for?a) To return the maximum value of a numeric expression. b) To return the absolute, positive value of a numeric expression.c) To return the average value of a numeric expression.d) To return the minimum value of a numeric expression.

40. Can you use both HAVING and WHERE SQL clauses in one SQL statement?a) TRUEb) FALSE

Page 7: Oracle Mock Test

41. Normalization is…a) The process of arranging information stored in a database in a way, which removes

redundancy and ambiguity.b) A special way of selecting data.c) The process of adding primary key to a table.

42. When there is failure in fetching the rows from a cursor….a) %isopenb) %notfoundc) %foundd) %rowcount

43. Which of the following statements does count the rows in the ‘Sales’ table?a) SELECT COUNT (*) FROM Salesb) SELECT COUNTER (*) FROM Salesc) SELECT NUM () FROM Salesd) SELECT COUNT(*) IN Sales

44. How many columns are presented after excuting this query:SELECT address1||’,’||address2||’,’|| address2 “Address” FROM employea) 1b) 2c) 3d) 0e) 4

45. What best describes the relationship between indexes and SQL performance?a) Indexes are only used in special casesb) Indexes are used to make table storage more efficientc) Indexes rarely make a difference in SQL performanced) Indexes exist solely to improve query speed.

46. Which of the following can be a valid column name ?a) Columnb) 1966_Invoicesc) Catch_#22d) #Invoicese) None of the above

Page 8: Oracle Mock Test

47. Which of the following SQL statements is correct?a) SELECT CustomerName, COUNT(CustomerName) FROM Orders Order BY CustomerNameb) SELECT CustomerName, COUNT(CustomerName) FROM Orders.c) SELECT CustomerName, COUNT(CustomerName) FROM Orders Group BY CustomerName.

48. Consider the following SELECT statement:SELECT ename,emp_number,salary FROM employee WHERE dept_number FROM department WHERE location in (‘CHICAGO’,’NEWYORK’))Why does this statement return an error?a) A multiple row subquery returns an error?b) A single row subquery returns more than one rowc) A multiple column subquery returns one columnd) A multiple row query uses a single row subquery

49. Which character function can be used to return a specified portion of a character string?a) INSTRb) SUBSTRINGc) SUBSTRd) POS

50. To produce a meaningful result set without any Cartesian products, which is the minimum number of conditions that should appear in the WHERE clause of a four-table join?a) 8b) 2c) 3d) 4