0

databases Online Quiz - 65

Description: databases Online Quiz - 65
Number of Questions: 20
Created by:
Tags: databases
Attempted 0/20 Correct 0 Score 0

Raw types are used to store _________ data.

  1. Binary

  2. Character

  3. ASCII

  4. All of the above


Correct Option: A

SQL has facility for programmed handling of errors that arise during the manipulation of data.

  1. True

  2. False


Correct Option: B

AI Explanation

To answer this question, you need to understand the concept of error handling in SQL.

Option A) True - This option is incorrect. SQL does have error handling mechanisms in place to handle errors that occur during data manipulation.

Option B) False - This option is correct. SQL does not have a built-in facility for programmed handling of errors that arise during the manipulation of data. However, SQL does provide some error handling features such as TRY-CATCH blocks in certain implementations like Microsoft SQL Server.

The correct answer is B) False. This option is correct because SQL does not have a facility for programmed handling of errors that arise during the manipulation of data.

In a PL/SQL block structure, which parts are optional?

  1. DELCARE and BEGIN

  2. DECALRE and EXCEPTION

  3. EXCEPTION and END

  4. BEGIN and END


Correct Option: B

If the Oracle Engine for its internal processing has opened a cursor they are known as _________

  1. Explicit Cursor

  2. Implicit Cursor

  3. Active Data Set

  4. None of the above


Correct Option: B

You want to create a PL/SQL block of code that calculates discounts on customer orders. This code will be invoked from several places, but only within the program unit ORDERTOTAL. What is the most appropriate location to store the code that calculates the discounts?

  1. A stored procedure on the server.

  2. A block of code in a PL/SQL library.

  3. A standalone procedure on the client machine.

  4. A block of code in the body of the program unit ORDERTOTAL.

  5. A local subprogram defined within the program unit ORDERTOTAL.


Correct Option: E

Implicit cursors are declared for

  1. Some DML,PL/SQL statements

  2. All DML,PL/SQL statements

  3. Only PL/SQL statements

  4. None of the Above


Correct Option: B

Which is the procedure used to issue User-Defined error messages from stored Sub-Programs?

  1. Raise Application procedure

  2. Raise Application Error procedure

  3. Application Error procedure

  4. None of the Above


Correct Option: B

How do you handle an Exception?

  1. Trap it with a Handler

  2. Propagate it to the Calling Environment

  3. A & Then B

  4. B & Then A


Correct Option: C

Under which two circumstances do you design database triggers? (Choose two)

  1. To duplicate the functionality of other triggers.

  2. To replicate built-in constraints in the Oracle server such as primary key and foreign key.

  3. To guarantee that when a specific operation is performed, related actions are performed.

  4. For centralized, global operations that should be fired for the triggering statement, regardless of which user or application issues the statement.


Correct Option: C,D

AI Explanation

To answer this question, you need to understand the purpose and use cases of database triggers. Let's go through each option to understand why it is correct or incorrect:

Option A) To duplicate the functionality of other triggers - This option is incorrect. Triggers are not designed to duplicate the functionality of other triggers. Instead, triggers are used to perform specific actions when certain events occur in the database.

Option B) To replicate built-in constraints in the Oracle server such as primary key and foreign key - This option is incorrect. Built-in constraints like primary key and foreign key are not replicated using triggers. Constraints are used to enforce data integrity rules, while triggers are used to perform actions based on specific events.

Option C) To guarantee that when a specific operation is performed, related actions are performed - This option is correct. One of the main purposes of database triggers is to ensure that when a specific operation (such as an insert, update, or delete) is performed on a table, related actions or operations are also performed. Triggers can be used to automatically update other tables, perform calculations, or enforce business rules.

Option D) For centralized, global operations that should be fired for the triggering statement, regardless of which user or application issues the statement - This option is correct. Triggers can be designed to perform centralized, global operations that should be triggered regardless of the user or application issuing the statement. This allows for consistent and standardized actions to be performed for specific events.

Therefore, the correct answers are C) To guarantee that when a specific operation is performed, related actions are performed and D) For centralized, global operations that should be fired for the triggering statement, regardless of which user or application issues the statement.

  1. Only local or packaged sub programs can be overloaded.

  2. Overloading allows different functions with the same name that differ only in their return types.

  3. Overloading allows different subprograms with the same number, type and order of the parameter.

  4. Overloading allows different subprograms with the same name and same number or type of the parameters.

  5. Overloading allows different subprograms with the same name but different in either number or type or order of parameter.


Correct Option: A,E

What does “REPLACE” indicate in creating procedures?

  1. An existing will be dropped and it will be replaced by the new version.

  2. An existing will be dropped and it will not be replaced by the new version.

  3. No change will occur

  4. There is no such option available in creating procedures.


Correct Option: A

Which two statements about packages are true? (Choose two)

  1. Packages can be nested.

  2. You can pass parameters to packages.

  3. A package is loaded into memory each time it is invoked.

  4. The contents of packages can be shared by many applications.

  5. You can achieve information hiding by making package constructs private.


Correct Option: D,E

AI Explanation

To answer this question, let's go through each option to understand why it is correct or incorrect:

Option A) Packages can be nested - This option is correct. In many programming languages, packages can be organized hierarchically, allowing for nested packages. This helps in organizing and structuring code into logical units.

Option B) You can pass parameters to packages - This option is incorrect. Packages are typically used to group related code and resources, but they are not designed to accept parameters directly. Parameters are usually passed to functions or methods within a package.

Option C) A package is loaded into memory each time it is invoked - This option is incorrect. Once a package is loaded into memory, it remains in memory until the program terminates or the package is explicitly unloaded. Packages are not loaded into memory each time they are invoked.

Option D) The contents of packages can be shared by many applications - This option is correct. Packages are designed to provide a way to organize and share code and resources. Many applications can use the same package, allowing them to access and utilize the contents of the package.

Option E) You can achieve information hiding by making package constructs private - This option is correct. Packages often provide mechanisms for encapsulating code and resources. By making certain constructs within a package private, you can control the visibility and accessibility of those constructs, achieving information hiding.

The correct answers are D and E. These options are correct because packages can be shared by many applications, and information hiding can be achieved by making package constructs private.

A function must return zero or more values to its calling environment, whereas a procedure returns a value to the calling environment.

  1. True

  2. False


Correct Option: B
  1. The package itself cannot be called, parameterized, or nested.

  2. The format of a package is similar to that of a subprogram.

  3. The contents can be shared by many applications once written.

  4. None of the above.


Correct Option: D

Identifiers defined only in the package body are public constructs. These are visible outside the package body

  1. True

  2. False


Correct Option: B

Which two program declarations are correct for a stored program unit? (Choose two)

  1. CREATE OR REPLACE FUNCTION tax_amt (p_id NUMBER) RETURN NUMBER

  2. CREATE OR REPLACE PROCEDURE tax_amt (p_id NUMBER) RETURN NUMBER

  3. CREATE OR REPLACE PROCEDURE tax_amt (p_id NUMBER, p_amount OUT NUMBER)

  4. CREATE OR REPLACE FUNCTION tax_amt (p_id NUMBER) RETURN NUMBER(10,2)

  5. CREATE OR REPLACE PROCEDURE tax_amt (p_id NUMBER, p_amount OUT NUMBER(10, 2))


Correct Option: A,C

What is true about stored procedures?

  1. A stored procedure uses the DELCLARE keyword in the procedure specification to declare formal parameters.

  2. A stored procedure is named PL/SQL block with at least one parameter declaration in the procedure specification.

  3. A stored procedure must have at least one executable statement in the procedure body.

  4. A stored procedure uses the DECLARE keyword in the procedure body to declare formal parameters.


Correct Option: C

AI Explanation

To answer this question, let's go through each option to understand why it is correct or incorrect:

Option A) A stored procedure uses the DECLARE keyword in the procedure specification to declare formal parameters. - This option is incorrect. The DECLARE keyword is used in PL/SQL to declare local variables, not formal parameters for a stored procedure.

Option B) A stored procedure is named PL/SQL block with at least one parameter declaration in the procedure specification. - This option is incorrect. While a stored procedure can have parameters, it is not necessary for it to have at least one parameter declaration.

Option C) A stored procedure must have at least one executable statement in the procedure body. - This option is correct. A stored procedure is a named PL/SQL block that contains a series of executable statements. It must have at least one executable statement in its body to perform a specific task or operation.

Option D) A stored procedure uses the DECLARE keyword in the procedure body to declare formal parameters. - This option is incorrect. The DECLARE keyword is used to declare local variables within a PL/SQL block, not formal parameters for a stored procedure.

The correct answer is Option C. This option is correct because a stored procedure must have at least one executable statement in its body to perform a specific task or operation.

Which three are valid ways to minimize dependency failure? (Choose three)

  1. Querying with the SELECT * notification.

  2. Declaring variables with the %TYPE attribute.

  3. Specifying schema names when referencing objects.

  4. Declaring records by using the %ROWTYPE attribute.

  5. Specifying package.procedure notation while executing procedures.


Correct Option: A,B,E
- Hide questions