DBMS_Quiz-1

19
DBMS Quiz-01 1--Which statement correctly describes the purpose of REFRESH COMPLETE option when used with materialized view? A.Truncate the materialized view and repopulates it with the data from the base tables in the query B.Populate the materialized view with the data from the base tables that has changed since the last refresh C.Populate the materialized view with the data from the base tables after each commit to any of the base tables D.Truncate the materialized view and populates it with the data from the base tables that has changed since the last refresh 2--There are 3 users working on the same schema in the database.The emp table in this schema does not have any indexes on it.All the 3 users execute UPDATE statements on the emp table to update different rows.When the 3rd user executes an UPDATE statement,it waits and does not update the table. Why does the UPDATE statement of the 3rd user waits? A.The INITRANS parameter is set to a lower value B.The PCTFREE parameter is set to a higher value C.All the transaction slots up to MAXTRANSE in a block are in use D.This is because the ROW_LOCKING parameter is set to INTENT. 3--Why does performance degrade when INSERT,UPDATE,or DELETE statements are issued on a table that has an assosiated Bitmap index? A.Some DML's cause recreating the Bitmap Index B.The Bitmap Index is rebuilt automatically after DML C.The smallest amount of a Bitmap that can be locked is a bitmap segment D.Additional time to remove the NULL values from the Bitmap index after DML operation. 4--You execute the following statement in session 1:

description

quiz for dbms

Transcript of DBMS_Quiz-1

Page 1: DBMS_Quiz-1

DBMS Quiz-01

1--Which statement correctly describes the purpose of REFRESH COMPLETE option when used with materialized view?

A.Truncate the materialized view and repopulates it with the data from the base tables in the query

B.Populate the materialized view with the data from the base tables that has changed since the last refresh

C.Populate the materialized view with the data from the base tables after each commit to any of the base tables

D.Truncate the materialized view and populates it with the data from the base tables that has changed since the last refresh

2--There are 3 users working on the same schema in the database.The emp table in this schema does not have any indexes on it.All the 3 users execute UPDATE statements on the emp table to update different rows.When the 3rd user executes an UPDATE statement,it waits and does not update the table.

Why does the UPDATE statement of the 3rd user waits?

A.The INITRANS parameter is set to a lower value

B.The PCTFREE parameter is set to a higher value

C.All the transaction slots up to MAXTRANSE in a block are in use

D.This is because the ROW_LOCKING parameter is set to INTENT.

3--Why does performance degrade when INSERT,UPDATE,or DELETE statements are issued on a table that has an assosiated Bitmap index?

A.Some DML's cause recreating the Bitmap Index

B.The Bitmap Index is rebuilt automatically after DML

C.The smallest amount of a Bitmap that can be locked is a bitmap segment

D.Additional time to remove the NULL values from the Bitmap index after DML operation.

4--You execute the following statement in session 1:

Page 2: DBMS_Quiz-1

SQL>SELECT ename FROM emp WHERE deptno=10 FOR UPDATE;

In session 2,you execute the following statement on the same table:

SQL>UPDATE emp SET sal=sal*1.2 WHERE deptno=30;

5--Which statement regarding UPDATE in session 2 is correct if the database is using the default locking mechanism?

A.This updates the table because the query above does not hold any locks.

B.This does not update the table because the table-level lock is held by the first session.

C.This updates the table because you are updating a different column than that selected in the first session.

D.It updates the rows in department 30 because the loked rows are the rows in department 10.As the default is row level locking the rows are updated.

6--The database was started up using a text parameter file. What will be the default scope

of changes made by using the SET clause of the ALTER SYSTEM statement?

A. Only MEMORY is updated.

B. Only SPFILE values are updated.

C. Only init<SID>.ora parameters are updated.

D. Both init<SID>.ora parameters and SPFILE values are updated.

7--The client connected to the database turns off his or her machine without exiting from a

connection to the database. Which type of failure is this?

A. media

B. instance

C. statement

D. user process

8--Examine this procedure:

Page 3: DBMS_Quiz-1

CREATE OR REPLACE PROCEDURE

INSERT_TEAM (V_ID in NUMBER, V_CITY in VARCHAR2 DEFAULT 'AUSTIN', V_NAME in

VARCHAR2)

IS

BEGIN

INSERT INTO TEAM (id, city, name) VALUES (v_id, v_city, v_name);

COMMIT;

END;

9--Which two statements will successfully invoke this procedure in SQL*Plus? (Choose

two.)

A. EXECUTE INSERT_TEAM;

B. EXECUTE INSERT_TEAM(3, V_NAME=>'LONGHORNS', V_CITY=>'AUSTIN');

C. EXECUTE INSERT_TEAM(3,'AUSTIN','LONGHORNS');

D. EXECUTE INSERT_TEAM (V_ID := 3, V_NAME := 'LONGHORNS', V_CITY := 'AUSTIN');

E. EXECUTE INSERT_TEAM (3,'LONGHORNS');

10--This statement fails when executed:

CREATE OR REPLACE TRIGGER

CALC_TEAM_AVG

AFTER INSERT ON PLAYER

BEGIN

INSERT INTO PLAYER_BAT_STAT

(PLAYER_ID, SEASON_YEAR,AT_BATS,HITS) VALUES (:NEW.ID, 1997, 0,0);

END;

Page 4: DBMS_Quiz-1

11--To which type must you convert the trigger to correct the error?

A. row

B. statement

C. ORACLE FORM trigger

D. before

12--The add_dept, upd_dept_stat , and upd_dept procedures are

grouped together in a package. A variable must be shared among only these procedures. Where should

you declare this variable?

A. in the package body

B. in a database trigger

C. in the package specification

D. in each procedure's DECLARE section, using the exact same name in each

13--Examine this code:

What type of trigger is it?

create or replace Trigger secure_emp

Before Logon on emp

Begin

If (To_char(sysdate,'Dy')in('Sat','Sun'))or(to_char(sysdate,'HH24,MI') not between '08:00' and '18:00')

Then Raise_Application_Error(-20500,'you may insert onlt during business hours.');

End if;

End;

/

Page 5: DBMS_Quiz-1

A. DML trigger

B. INSTEAD OF trigger

C. application trigger

D. system event trigger

E. This is an invalid trigger.

14--All users currently have the INSERT privilege on the PLAYER table. You

only want your users to insert into this table using the ADD_PLAYER procedure. Which two actions

must you take? (Choose two.)

A. GRANT SELECT ON ADD_PLAYER TO PUBLIC;

B. GRANT EXECUTE ON ADD_PLAYER TO PUBLIC;

C. GRANT INSERT ON PLAYER TO PUBLIC;

D. GRANT EXECUTE,INSERT ON ADD_PLAYER TO PUBLIC;

E. REVOKE INSERT ON PLAYER FROM PUBLIC;

15--Which two dictionary views track dependencies? (Choose two.)

A. USER_SOURCE

B. UTL_DEPTREE

C. USER_OBJECTS

D.IDEPTREE

E. USER_DEPENDENCIES

F. DBA_DEPENDENT_OBJECTS

16--Which two statements about the overloading feature of packages are true?

(Choose two.)

Page 6: DBMS_Quiz-1

A. Only local or packaged subprograms can be overloaded.

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

C. Overloading allows different subprograms with the same name number, type and order of parameters.

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

E. Overloading allows different subprograms with same name, but different in either number, type or order of parameters.

16--Examine this code:

Which statements accurately call the stored function CALC_SAL ? (Choose two.)

Create or Replace function cacl_sal(p_sal number)

Return Number

is

v_raise number(4,2) Default 1.08;

Begin

Return v_raise * p_sal;

End cacl_sal;

/

A. UPDATE employees (calc_sal(salary)) SET salary = salary * calc_sal(salary);

B. INSERT calc_sal(salary) INTO employees WHERE department_id = 60;

C. DELETE FROM employees(calc_sal(salary)) WHERE calc_sal(salary) > 1000;

D. SELECT salary, calc_sal(salary) FROM employees WHERE department_id = 60;

E. SELECT last_name, salary, calc_sal(salary) FROM employees ORDER BY calc_sal(salary);

17--Examine the code examples. Which one is correct?

Page 7: DBMS_Quiz-1

A. CREATE OR REPLACE TRIGGER authorize_action BEFORE INSERT ON EMPLOYEES

CALL log_execution;

/

B. CREATE OR REPLACE TRIGGER authorize_action BEFORE INSERT ON EMPLOYEES

CALL log_execution

/

C. CREATE OR REPLACE TRIGGER authorize_action BEFORE EMPLOYEES INSERT CALL

log_execution;

D. CREATE OR REPLACE TRIGGER authorize_action

CALL log_execution BEFORE INSERT ON

EMPLOYEES;

/

18--When creating a function, in which section will you typically find the

RETURN keyword?

A. HEADER only

B. DECLARATIVE

C. EXECUTABLE and HEADER

D. DECLARATIVE,EXECUTABLE and EXCEPTION HANDLING

19--Which three statements/commands would cause a transaction to end? (Choose three.)

A. COMMIT

B. SELECT

C. CREATE

D. ROLLBACK

Page 8: DBMS_Quiz-1

E. SAVEPOINT

20--Which two statements are true regarding views? (Choose two.)

A. A subquery that defines a view cannot include the GROUP BY clause

B. A view is created with the subquery having the DISTINCT keyword can be updated

C. A view that is created with the subquery having the pseudo column ROWNUM keyword cannot be updated

D. A Data Manipulation Language (DML) operation can be performed on a view that is created with the subquery having all the NOT NULL columns of a table

21--Evaluate the following INSERT SQL statement:

Insert into emp(empid,ename,deptid) values(select empid,fname||' '||lname,deptid)

from emp

where empid>111;

The INSERT statement fails when executed. What could be the reason?

A. The VALUES clause cannot be used in an INSERT with a subquery

B. Column names in the NEW_CUSTOMERS and CUSTOMERS tables do not match

C. The WHERE clause cannot be used in a subquery embedded in an INSERT statement

D. The total number of columns in the NEW_CUSTOMERS table does not match the total number

of columns in the CUSTOMERS table

22--You issue the following SQL statement:

Select custno,NVL2(NULLIF(amt_spt,credit_limit),0,1000)"Bonus"

From cust_status;

Which statement is true regarding the execution of the above query?

A. It produces an error because the AMT_SPENT column contains a null value

Page 9: DBMS_Quiz-1

B. It displays a bonus of 1000 for all customers whose AMT_SPENT is less than CREDIT_LIMIT

C. It displays a bonus of 1000 for all customers whose AMT_SPENT equals CREDIT_LIMIT or

AMT_SPENT is null

D. It produces an error because the TO_NUMBER function must be used to convert the result of

the NULLIF function before it can be used by the NVL2 function

23--Evaluate the following SQL statements:

create Table orders

(o_id number(2) constraint ord_pk PRIMARY KEY,

o_date date,cust_id number(4));

Create Table odr_item

(o_id number(2),item_no number(3),qty number(3) CHECK(qty Between 100 and 200),

expiry_date date CHECK(expiry_date>Sysdate),

constraint it_pk PRIMARY KEY (o_id,item_no),

constraint ord_fk FOREIGN KEY(o_id)REFERENCES orders(o_id));

The above command fails when executed. What could be the reason?

A. SYSDATE cannot be used with the CHECK constraint

B. The BETWEEN clause cannot be used for the CHECK constraint

C. The CHECK constraint cannot be placed on columns having the DATE data type

D. ORD_NO and ITEM_NO cannot be used as a composite primary key because ORD_NO is also

the FOREIGN KEY

24--Which statements are correct regarding indexes? (Choose all that apply.)

A. When a table is dropped, the corresponding indexes are automatically dropped

Page 10: DBMS_Quiz-1

B. A FOREIGN KEY constraint on a column in a table automatically creates a nonunique key

C. A nondeferrable PRIMARY KEY or UNIQUE KEY constraint in a table automatically creates a

unique index

D. For each data manipulation language operation performed, the corresponding indexes are

automatically updated

25--Which two SQL statements would execute successfully? (Choose two.)

A. SELECT NVL(ADD_MONTHS(END_DATE,1),SYSDATE)

FROM programs;

B. SELECT TO_DATE(NVL(SYSDATE-END_DATE,SYSDATE))

FROM programs;

C. SELECT NVL(MONTHS_BETWEEN(start_date,end_date),'Ongoing')

FROM programs;

D. SELECT NVL(TO_CHAR(MONTHS_BETWEEN(start_date,end_date)),'Ongoing')

FROM programs;

26--You have set the value of the NLS_TIMESTAMP_TZ_FORMAT

parameter in the parameter file to YYYY-MM-DD. The default format of which two data types would be

affected by this setting? (Choose two.)

A. DATE

B. TIMESTAMP

C. INTERVAL YEAR TO MONTH

D. INTERVAL DAY TO SECOND

E. TIMESTAMP WITH LOCAL TIME ZONE

Page 11: DBMS_Quiz-1

27--Evaluate the following SQL statements Choose that which apply)

select rpad( '*', 2*level, '*' ) || ename ename

from emp

start with mgr is null

connect by prior empno = (select mgr from emp)

order by mgr;

A.The CONNECT BY condition cannot contain a subquery.

B.Do not specify either ORDER BY or GROUP BY, as they will destroy the hierarchical order of the CONNECT BY results.

c.No error occurs and the statement executes successfully

D.None of the above

28--What is true about set operators?

A.The set operators are not valid on columns of type BLOB, CLOB, BFILE, VARRAY, LONGor nested table.

B.You cannot also specify the for_update_clause with the set operators.

C.You cannot specify the order_by_clause in the subquery of these operators.

D.If all queries select values of type number, then the returned values may not have datatype NUMBER.

29--SQL>SELECT D.Name AS "Department", COUNT(P.jobid) AS "job"

2 FROM Department D, Employee P

3 WHERE Empid IN

4 (SELECT empid

5 FROM jobCategory INNER JOIN Category

6 ON jobCategory.CategoryID = Category.CategoryID

Page 12: DBMS_Quiz-1

7 WHERE Category.DepartmentID = D.DepartmentID)

8 GROUP BY D.Name

9 ORDER BY D.Name;

What is correct about the above query(choose 2)

A.It is a subquery

B.It is an inline view

C.It is corelated subquery

D.Each jobid is counted categorically for each department.

E.None of the above

30--Your database operates in NOARCHIVELOG mode. What should happen before

the log writer (LGWR) can reuse a filled online redo log file?

A. The alert log file should be updated.

B. The changes recorded in the redo log file must be written to the data files.

C. All transactions with entries in the redo log file must complete.

D. The control file header should be frozen.

E. The manual checkpoint should be issued.

31--You want to create a database that uses the Oracle Managed Files (OMF) feature

for your database. You specified the following parameters in the initialization

parameter file to achieve this:

DB_CREATE_ONLINE_LOG_DEST_1 = '/u02/oradata/techdb'

DB_CREATE_ONLINE_LOG_DEST_2 = '/u03/oradata/techdb'

32--The DB_CREATE_FILE_DEST parameter is not specified. Which statement in this

scenario is correct?

Page 13: DBMS_Quiz-1

A. The OMF feature will be used, but only online redo log files are created as Oracle-managed files.

B. The OMF feature will be used and all the database files are created as Oracle-managed files.

C. The OMF feature will be used, but only online redo log files and control files are created as Oracle-managed files.

D. The OMF feature will not be used because the DB_CREATE_FILE_DEST parameter is not specified.

33--Under which condition does the Oracle server put a data block on the free list of a segment?

A. when the used space in the block falls below the value set in PCTFREE

B. when the used space in the block exceeds the value set in PCTFREE

C. when the used space in the block falls below the value set in PCTUSED

D. when the used space in the block exceeds the value set in PCTUSED

34-- Which option would you use to reduce the fragmentation without affecting the users who are currently using the index?

A. rebuild the index using ALTER INDEX..REBUILD ONLINE command

B. validate the index structure

C. deallocate the unused space in the index using ALTER INDEX..DEALLOCATE UNUSED command

D. change the block space utilization parameters using ALTER INDEX command

35--Consider the following statements:

1. ALTER SYSTEM SWITCH LOGFILE;

2. CREATE TABLE sales(bill NUMBER(3),bdt DATE,amt NUMBER(10,2));

3. ALTER SYSTEM SET CONTROL_FILES='/remorse/control02.ctl';

4. SHUTDOWN

Page 14: DBMS_Quiz-1

36--Which of the commands always modifies the control file?

A. 1, 2, and 3

B. 1 and 4

C. 3 and 4

D. 1, 2, 3, and 4

E. 1 and 2

37--You started your database instance as follows:

SQL> STARTUP NOMOUNT

ORACLE instance started.

Total System Global Area 118561572 bytes

Fixed Size 453412 bytes

Variable Size 109051904 bytes

Database Buffers 8388608 bytes

Redo Buffers 667648 bytes

SQL>

38--Which activities occur during this process? (Choose two.)

A. The alert log file is opened.

B. The redo log files are read.

C. The parameter file is read.

D. The control file is opened.

E. The trace files are opened.

39--Which option lists the correct hierarchy of storage structures, from the smallest to the largest?

Page 15: DBMS_Quiz-1

A. data block, segment, extent, and tablespace

B. data block, extent, segment, and tablespace

C. segment, tablespace, data block, and extent

D. tablespace, extent, data block, and segment

E. segment, extent, tablespace, and data block

F. tablespace, data block, extent, and segment

40--While updating the rows in a table you realize that one of the rows violates a constraint on the table, thereby causing the update to fail. Which statement is true in this scenario?

A. The undo data is moved to a temporary segment.

B. The undo data is retained and reused when the update is executed again.

C. The undo data is retained and marked as obsolete.

D. The space used by undo data is freed up to be reused by another transaction.

41--You execute the following command:

SQL> DROP USER user01;

The command fails displaying the following error:

ORA-01922: CASCADE must be specified to drop 'USER01'

What could have caused the command to fail?

A. The user's password has expired.

B. The user account is locked.

C. The user's schema has objects in the database.

D. The user is currently connected to the database.

42--The data in the EMPLOYEE_NAME column of the EMPLOYEES table is stored in

mixed case. Currently, there is no index on the column. You want to create an index

Page 16: DBMS_Quiz-1

on the column to support non-case-sensitive queries and faster retrieval of data by

using the index. Which type of index would you create on the column?

A. a bitmap, reverse key index

B. a function-based index

C. a B-Tree, reverse key index

D. a bitmap-partitioned index

43--Consider the following phases involved in the processing of a SQL statement:

- Parse

- Bind

- Execute

- Fetch

Arrange the phases involved in processing a data manipulation language (DML) statement in the correct sequence.

A. Parse, Execute, Bind, and Fetch

B. Execute, Bind, Parse, and Fetch

C. Parse, Bind, and Execute

D. Execute, Bind, and Fetch

44--In your database, you observe that a large number of rows in a table are being updated frequently, causing the rows to be migrated, thereby degrading database performance. Which option could you consider to minimize row migration in future?

A. increasing the size of the extent for the table

B. increasing PCTUSED for the table

C. increasing PCTFREE for the table

D. reducing PCTUSED for the table

Page 17: DBMS_Quiz-1

E. increasing FREELISTS for the table

F. reducing PCTFREE for the table

45--You are connected to the SCOTT schema and you execute the following query:

SQL> SELECT * FROM ALL_OBJECTS;

Which statement regarding the output of this command is true?

A. The query returns information about all the objects to which SCOTT has access.

B. The query will be successful only if the O7_DICTIONARY_ACCESSIBILITY parameter is set to TRUE.

C. The query returns information about all the objects created in the database.

D. The query fails if the SELECT ANY TABLE privilege is not granted to SCOTT.

46--A user executes an update statement. Before the user could commit the transaction, the session terminated abnormally. What would happen in this scenario? (Choose two.)

A. Checkpoint (CKPT) releases the locks held by the user session.

B. Recoverer (RECO) performs session recovery.

C. PMON releases the locks held by the user session.

D. System Monitor (SMON) rolls forward the user's transaction.

E. Process Monitor (PMON) rolls back the user's transaction.

47--A user connects to the Oracle server in dedicated server mode and executes a query to fetch rows from a table. Which are the processes that are always involved in this task? (Choose all that apply.)

A. system monitor (SMON)

B. server process

C. log writer (LGWR)

D. database writer (DBWn)

E. user process

Page 18: DBMS_Quiz-1

48--Because of poor response time on queries, you are asked to allocate more space to the component that holds SQL execution plans. To which component would you allocate more space?

A. Large Pool

B. Shared Pool

C. Row Cache

D. Java Pool

49--Which Oracle data type should you use to store data in a database that uses multiple languages to store data?

A. CHAR

B. VARCHAR

C. LONG

D. NVARCHAR2

E. VARCHAR2

50--USER01 executes the following command:

SQL> GRANT select, insert, update ON employees TO USER02 WITH GRANT OPTION;

USER02 executes the following command:

SQL> GRANT select, insert ON USER01.employees TO USER03 WITH GRANT OPTION;

USER03 executes the following command:

SQL> GRANT select ON USER01.employees TO USER04;

Then, USER01 executes the following command:

SQL> REVOKE select, insert, update ON employees FROM USER02;

How does the REVOKE affect the users USER02, USER03, and USER04?

A. The privileges are revoked from USER02, and that implicitly revokes the privileges from USER03 and USER04.

Page 19: DBMS_Quiz-1

B. The privileges are revoked from USER02, but USER03 and USER04 continue to have the privileges.

C. The privileges are revoked from USER02 and USER03, but USER04 continues to have the privileges.

D. The command fails because the privileges cannot be revoked from USER02 until USER02 revokes the privileges from the users to whom it granted.