0

databases Online Quiz - 34

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

Transaction ends

  1. Only when it is Committed

  2. Only when it is Rolledback

  3. When it is Committed or Rolledback

  4. None of the above


Correct Option: C

What SYSTEM VARIABLE is used to refer DATABASE TIME ?

  1. $$dbtime$$

  2. $$time$$

  3. $$datetime$$

  4. None of the above


Correct Option: A
  1. To protect some of the columns of a table from other users

  2. Ocuupies data storage space

  3. To hide complexity of a query

  4. To hide complexity of a calculations


Correct Option: B

CREATE OR REPLACE FUNCTION CALC_PLAYER_AVG (V_ID in PLAYER_BAT_STAT.PLAYER_ID%TYPE) RETURN NUMBER IS V_AVG NUMBER; BEGIN SELECT HITS / AT_BATS INTO V_AVG FROM PLAYER_BAT_STAT WHERE PLAYER_ID = V_ID; RETURN (V_AVG); END; Which statement will successfully invoke this function in SQL *Plus

  1. SELECT CALC_PLAYER_AVG(PLAYER_ID) FROM PLAYER_BAT_STAT;

  2. EXECUTE CALC_PLAYER_AVG(31);

  3. CALC_PLAYER(‘RUTH’);

  4. CALC_PLAYER_AVG(31);


Correct Option: A

AI Explanation

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

Option A) SELECT CALC_PLAYER_AVG(PLAYER_ID) FROM PLAYER_BAT_STAT; This option is correct because it correctly invokes the function CALC_PLAYER_AVG by passing the PLAYER_ID column from the PLAYER_BAT_STAT table as the argument.

Option B) EXECUTE CALC_PLAYER_AVG(31); This option is incorrect because the EXECUTE statement is not supported in SQL *Plus. Instead, you should use a SELECT statement to invoke the function.

Option C) CALC_PLAYER('RUTH'); This option is incorrect because it does not match the function name. The correct function name is CALC_PLAYER_AVG.

Option D) CALC_PLAYER_AVG(31); This option is incorrect because it does not include the necessary SELECT statement to invoke the function. The correct syntax is to use a SELECT statement as shown in option A.

The correct answer is A. This option is correct because it uses the correct function name and syntax to invoke the function CALC_PLAYER_AVG.

Which is the true statements about dependent objects?

  1. An object with status of invalid cannot be a referenced object.

  2. The Oracle server automatically records dependencies among objects.

  3. All schema objects have a status that is recorded in the data dictionary.

  4. You can view whether an object is valid or invalid in the USER_STATUS data dictionary view.


Correct Option: B

You have created a stored procedure DELETE_TEMP_TABLE that uses dynamic SQL to remove a table in your schema. You have granted the EXECUTE privilege to user A on this procedure. When user A executes the DELETE_TEMP_TABLE procedure, under whose privileges are the operations performed by default?

  1. SYS privileges

  2. Your privileges

  3. Public privileges

  4. User A’s privileges


Correct Option: B

CREATE OR REPLACE PRODECURE add_dept (p_dept_name VARCHAR2 DEFAULT ‘placeholder’, p_location VARCHAR2 DEFAULT ‘Boston’) IS BEGIN INSERT INTO departments VALUES (dept_id_seq.NEXTVAL, p_dept_name, p_location); END add_dept; / Which is invalid call to the add_dep procedure? (Choose three

  1. add_dept;

  2. add_dept(‘Accounting’);

  3. add_dept(, ‘New York’);

  4. add_dept(p_location=>’New York’);


Correct Option: C
  1. It persists across transactions within a session.

  2. It persists from session to session for the same user.

  3. It does not persist across transaction within a session.

  4. It persists from user to user when the package is invoked.


Correct Option: A
Explanation:

To answer this question, the user needs to understand the concept of package variables in PL/SQL.

Package variables are variables that are declared in the package specification and can be accessed by any subprogram or procedure defined in the package. The state of a package variable after executing the package depends on its type.

Option A is correct. Package variables persist across transactions within a session. This means that the value of a package variable remains the same during the lifetime of the session, even if multiple transactions are executed. The value of the variable can be changed by any subprogram or procedure defined in the package.

Option B is incorrect. Package variables do not persist from session to session for the same user. When a user logs out of the session and logs back in, the package variable is reinitialized with its default value.

Option C is incorrect. Package variables persist across transactions within a session. The value of a package variable remains the same during the lifetime of the session, even if multiple transactions are executed.

Option D is incorrect. Package variables do not persist from user to user when the package is invoked. When a different user invokes the package, the package variable is reinitialized with its default value.

Therefore, the correct answer is:

The Answer is: A

  1. Use a drop procedure statement to drop a standalone procedure.

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

  3. Use a drop procedure statement to drop a procedure that is part of a package. Then recompile the package body.

  4. 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.


Correct Option: A
  1. If errors occur during the compilation of a trigger, the trigger is still created.

  2. If errors occur during the compilation of a trigger you can go into SQL *Plus and query the USER_TRIGGERS data dictionary view to see the compilation errors.

  3. If errors occur during the compilation of a trigger you can use the SHOW ERRORS command within iSQL *Plus to see the compilation errors.

  4. If errors occur during the compilation of a trigger you can go into SQL *Plus and query the USER_ERRORS data dictionary view to see compilation errors.


Correct Option: B
  1. USER_SOURCE

  2. UTL_DEPTREE

  3. USER_OBJECTS

  4. DEPTREE_TEMPTAB


Correct Option: D
  1. The rows are selected and ordered.

  2. The validity of the SQL statement is established.

  3. An area of memory is established to process the SQL statement.

  4. The SQL statement is run and the number of rows processed is returned.


Correct Option: D

What part of a database trigger determines the number of times the trigger body executes?

  1. Trigger type

  2. Trigger body

  3. Trigger event

  4. Trigger timing


Correct Option: A

AI Explanation

To answer this question, you need to understand the different components of a database trigger.

A database trigger is a stored program that automatically executes in response to an event, such as a data modification operation (insert, update, delete) performed on a specified table. The trigger consists of three main parts: the trigger event, the trigger timing, and the trigger body.

The trigger event (option C) determines when the trigger should execute, such as before or after an insert, update, or delete operation on a table.

The trigger timing (option D) determines whether the trigger executes before or after the triggering event occurs.

The trigger body (option B) contains the code or instructions that are executed when the trigger is fired.

The part of a database trigger that determines the number of times the trigger body executes is the trigger type (option A). The trigger type specifies whether the trigger is a row-level trigger or a statement-level trigger.

  • A row-level trigger executes once for each row affected by the triggering event.
  • A statement-level trigger executes once for each triggering event, regardless of the number of rows affected.

Therefore, the correct answer is option A) Trigger type. This option is correct because the trigger type determines the number of times the trigger body executes.

  1. USER_PROCEDURES

  2. USER_PROCS

  3. USER_OBJECTS

  4. USER_PLSQL_UNITS


Correct Option: C
  1. a record

  2. a field

  3. a table

  4. an entity


Correct Option: B
  1. Visio

  2. ERwin

  3. ER/Studio

  4. Data Builder

  5. empowER


Correct Option: D
  1. Design logical data systems

  2. Design physical storage system

  3. Define data entities relevant to the enterprise

  4. All of the above


Correct Option: C
  1. Business Data Model

  2. Logical Data Model

  3. Data Management Process Model

  4. Data entity/business function Matrix

  5. Data Interface requirements


Correct Option: E
- Hide questions