InterviewSolution
This section includes InterviewSolutions, each offering curated multiple-choice questions to sharpen your knowledge and support exam preparation. Choose a topic below to get started.
| 1. |
Say True or False. If False, explain why.The %ROWCOUNT attribute returns the total number of rows returned by the FETCH command. |
|
Answer» True. |
|
| 2. |
Say True or False. If False, explain why.The %NOTFOUND attribute returns true when the cursor is not created explicitly. |
|
Answer» False. The %NOTFOUND attribute returns true when the last row of the cursor is processed and no other row is available. |
|
| 3. |
What is the difference between implicit and explicit cursors? |
|
Answer» Oracle implicitly declares a cursor to all the DDL and DML commands that return only one row. For queries returning multiple rows, an explicit cursor is created. |
|
| 4. |
Which command is used to delete a package? |
|
Answer» The DROP PACKAGE command. |
|
| 5. |
Say True or False. If False, explain why.PL/SQL allows subprogram overloading feature within a package. |
|
Answer» True. |
|
| 6. |
How do you refer to the types, objects and subprograms declared within a package? |
|
Answer» The types, objects, and subprograms declared within a package are referred to using the dot notation as − package_name.type_name package_name.object_name package_name.subprogram_name |
|
| 7. |
Which command(s) are used for creating PL/SQL packages? |
|
Answer» CREATE PACKAGE command is used for creating the specification part. CREATE PACKAGE BODY command is used for creating the body part. |
|
| 8. |
PL/SQL packages usually have two parts. What are these two parts? |
|
Answer» PL/SQL packages have two parts −
|
|
| 9. |
What are the steps that need to be performed to use an explicit cursor? Discuss briefly. |
|
Answer» The steps that need to be performed on explicit cursor are −
|
|
| 10. |
What do you understand by explicit cursors? |
|
Answer» Explicit cursors are defined explicitly using the CURSOR statement, with a general syntax − CURSOR cursor_name [(parameters)] IS query_expression; It allows processing queries that return multiple rows. |
|
| 11. |
How do you declare a user-defined exception? |
|
Answer» User defined exceptions are declared under the DECLARE section, with the keyword EXCEPTION. Syntax − <exception_name> EXCEPTION; |
|
| 12. |
What is the difference between a function and a stored procedure? |
|
Answer» A function returns a value and a stored procedure doesn’t return a value. |
|
| 13. |
Which command is used to delete a procedure? |
|
Answer» DROP PROCEDURE command. |
|
| 14. |
Which command is used to delete a trigger? |
|
Answer» DROP TRIGGER command. |
|
| 15. |
Write a statement to disable a trigger named update_marks. |
|
Answer» ALTER TRIGGER update_marks DISABLE; |
|
| 16. |
Say True or False. If False, explain why.INSTEAD OF is a valid option only for triggers in a table. |
|
Answer» False. INSTEAD OF is a valid option only for views. INSTEAD OF trigger cannot be specified in a table. |
|
| 17. |
What is the purpose of the optional argument [OR REPLACE] in a CREATE TRIGGER command? |
|
Answer» The optional argument [OR REPLACE] in a CREATE TRIGGER command re-creates an existing trigger. Using this option allows changing the definition of an existing trigger without having to delete it first. |
|
| 18. |
Say True or False. If False, explain why.Statement level triggers are triggered only once. |
|
Answer» True. |
|
| 19. |
What is the use of a WHEN clause in a trigger? |
|
Answer» A WHEN clause specifies the condition that must be true for the trigger to be triggered. |
|
| 20. |
Say True or False. If False, explain why.A trigger can execute the COMMIT, ROLLBACK, or SAVEPOINT commands. |
|
Answer» A trigger cannot execute the COMMIT, ROLLBACK, or SAVEPOINT commands. |
|
| 21. |
Say True or False. If False, explain why.A trigger can perform the role of a constraint, forcing an integrity rule. |
|
Answer» True. |
|
| 22. |
Say True or False. If False, explain why.When a trigger is associated to a view, the base table triggers are normally disabled. |
|
Answer» False. When a trigger is associated to a view, the base table triggers are normally enabled. |
|
| 23. |
Say True or False. If False, explain why.Triggers can be associated to a view. |
|
Answer» True. |
|
| 24. |
What are the uses of triggers? |
|
Answer» Basically triggers are used to create consistencies, access restriction and implement securities to the database. Triggers are also used for −
|
|
| 25. |
What is the difference in execution of triggers and stored procedures? |
|
Answer» A trigger is automatically executed without any action required by the user, whereas, a stored procedure needs to be explicitly invoked. |
|
| 26. |
Which command/commands allow iteration a use of loops in a PL/SQL block? |
|
Answer» LOOP command, FOR.. LOOP command, WHILE command. |
|
| 27. |
What is returned by the cursor attribute SQL%NOTFOUND? |
|
Answer» It returns the Boolean value TRUE if no rows were processed. |
|
| 28. |
What is returned by the cursor attribute SQL%FOUND? |
|
Answer» It returns the Boolean value TRUE if at least one row was processed. |
|
| 29. |
What is returned by the cursor attribute SQL%ROWCOUNT? |
|
Answer» It returns the number of rows that are processed by a SQL statement. |
|
| 30. |
Say True or False. If False, explain why.PL/SQL supports the CREATE command. |
|
Answer» False. PL/SQL doesn’t support the data definition commands like CREATE. |
|
| 31. |
Say True or False. If False, explain why.The PL/SQL engine executes the procedural commands and passes the SQL commands for the Oracle server to process. |
|
Answer» True. |
|
| 32. |
Say True or False. If False, explain why.The BEGIN declaration starts the variable declaration sections of a PL/SQL block. |
|
Answer» False. The BEGIN declaration starts the execution section. |
|
| 33. |
Say True or False. If False, explain why.PL/SQL engine is part of Oracle Server. |
|
Answer» True. |
|
| 34. |
What are the PL/SQL cursors? |
|
Answer» Oracle uses workspaces to execute the SQL commands. In other words, when Oracle processes a SQL command, it opens an area in the memory called Private SQL Area. A cursor is an identifier for this area. It allows programmers to name this area and access it’s information. |
|
| 35. |
What is a trigger? |
|
Answer» A trigger is a PL/SQL program that is stored in the database and executed immediately before or after the INSERT, UPDATE, and DELETE commands. |
|
| 36. |
What is a PL/SQL package? |
|
Answer» A package is a file that groups functions, cursors, stored procedures, and variables in one place. |
|
| 37. |
What is the purpose of %rowtype data type? Explain with example. |
|
Answer» It declares a composed variable that is equivalent to the row of a table. After the variable is created, the fields of the table can be accessed, using the name of this variable. For exampleemptype := emp%rowtype; name := emptype.empname; |
|
| 38. |
What is the purpose of %type data type? Explain with example. |
|
Answer» It assigns a variable the same data type used by the column, for which the variable is created. For example, dcode := dept.detpno%type; The variable dcode is created with the same data type as that of the deptno column of the dept table. |
|
| 39. |
What does the colon sign (: ) implies in the following statement?:deficit := balance – loan; |
|
Answer» The colon (: )sign implies that the variable :deficit is an external variable. |
|
| 40. |
Which of the following operator has the lowest precedence among the following −**, OR, NULL ? |
|
Answer» OR |
|
| 41. |
Which operator has the highest precedence among the following − AND, NOT, OR? |
|
Answer» NOT |
|
| 42. |
Write a single statement that concatenates the words ‘Hello’ and ‘World’ and assign it in a variable named greeting. |
|
Answer» greeting := ‘Hello’ || ‘World’; |
|
| 43. |
What is wrong in the following assignment statement?balance = balance + 2000; |
|
Answer» Use of wrong assignment operator. The correct syntax is: balance := balance + 2000; |
|
| 44. |
What are the three basic sections of a PL/SQL block? |
Answer»
|
|
| 45. |
State some features or programming constructs supported by PL/SQL. |
Answer»
|
|
| 46. |
Name few schema objects that can be created using PL/SQL? |
Answer»
|
|
| 47. |
State few notable characteristics of PL/SQL. |
Answer»
|
|
| 48. |
Say True or False. If False, explain why.PL/SQL does not have data types or variables. |
|
Answer» False. PL/SQL has all features of a structured programming language including data types, variables, subroutines, modules and procedural constructs. |
|
| 49. |
Say True or False. If False, explain why.Routines written in PL/SQL can be called in Oracle call interface, Java, Pro*C/C++, COBOL etc. |
|
Answer» True. |
|
| 50. |
What is the purpose of the PL/SQL language? |
|
Answer» PL/SQL is an extension of SQL. SQL is non-procedural. PL/SQL is a procedural language designed by oracle to overcome the limitations that exist in SQL. |
|