Skip to main content

Section 18 Quiz Database Programming With SQL

Section 18 Quiz
            (Answer all questions in this section)

1.         Steven King's row in the EMPLOYEES table has EMPLOYEE_ID = 100 and SALARY = 24000. A user issues the following statements in the order shown:
UPDATE employees
SET salary = salary * 2
WHERE employee_id = 100;
COMMIT;

UPDATE employees
SET salary = 30000
WHERE employee_id = 100;

The user's database session now ends abnormally. What is now King's salary in the table?

 Mark for Review
(1) Points
            78000
            30000
            24000
            48000 (*)

2.         Table MYTAB contains only one column of datatype CHAR(1). A user executes the following statements in the order shown.
INSERT INTO mytab VALUES ('A');
INSERT INTO mytab VALUES ('B');
COMMIT;
INSERT INTO mytab VALUES ('C');
ROLLBACK;

Which rows does the table now contain?

 Mark for Review
(1) Points
            A, B, and C
            A and B (*)
            C
            None of the above

3.         If Oracle crashes, your changes are automatically rolled back. True or False? Mark for Review
(1) Points
            True (*)
            False

4.         Examine the following statements:
UPDATE employees SET salary = 15000;
SAVEPOINT upd1_done;
UPDATE employees SET salary = 22000;
SAVEPOINT upd2_done;
DELETE FROM employees;

You want to retain all the employees with a salary of 15000; What statement would you execute next?

 Mark for Review
(1) Points
            ROLLBACK;
            ROLLBACK TO SAVEPOINT upd1_done; (*)
            ROLLBACK TO SAVEPOINT upd2_done;
            ROLLBACK TO SAVE upd1_done;
            There is nothing you can do; either all changes must be rolled back, or none of them can be rolled back.

5.         COMMIT saves all outstanding data changes? True or False?  Mark for Review
(1) Points
            True (*)
            False

6.         Examine the following statements:
INSERT INTO emps SELECT * FROM employees; -- 107 rows inserted.
SAVEPOINT Ins_Done;
DELETE employees; -- 107 rows deleted
SAVEPOINT Del_Done;
UPDATE emps SET last_name = 'Smith';

How would you undo the last Update only?

 Mark for Review
(1) Points
            ROLLBACK to SAVEPOINT Del_Done; (*)
            COMMIT Del_Done;
            There is nothing you can do.
            ROLLBACK UPDATE;

7.         Examine the following statements:
INSERT INTO emps SELECT * FROM employees; -- 107 rows inserted.
SAVEPOINT Ins_Done;
CREATE INDEX emp_lname_idx ON employees(last_name);
UPDATE emps SET last_name = 'Smith';

What happens if you issue a Rollback statement?

 Mark for Review
(1) Points

            The update of last_name is undone, but the insert was committed by the CREATE INDEX statement. (*)

            Both the UPDATE and the INSERT will be rolled back.
            The INSERT is undone but the UPDATE is committed.
            Nothing happens.

8.         Which SQL statement is used to remove all the changes made by an uncommitted transaction?         Mark for Review
(1) Points
            REVOKE;
            ROLLBACK TO SAVEPOINT;
            ROLLBACK; (*)
            UNDO;

9.         You need not worry about controlling your transactions. Oracle does it all for you. True or False?    Mark for Review
(1) Points
            True
            False (*)

10.       When you logout of Oracle, your data changes are automatically rolled back. True or False? Mark for Review
(1) Points
            True
            False (*)

11.       User BOB's CUSTOMERS table contains 20 rows. BOB inserts two more rows into the table but does not COMMIT his changes. User JANE now executes:
SELECT COUNT(*) FROM bob.customers;

What result will JANE see?

 Mark for Review
(1) Points
            22
            20 (*)
            JANE will receive an error message because she is not allowed to query the table while BOB is updating it.
            2

12.       Which of the following best describes the term "read consistency"?   Mark for Review
(1) Points
            It prevents other users from querying a table while updates are being executed on it

            It prevents other users from seeing changes to a table until those changes have been committed (*)

            It prevents users from querying tables on which they have not been granted SELECT privilege
            It ensures that all changes to a table are automatically committed

13.       A transaction makes several successive changes to a table. If required, you want to be able to rollback the later changes while keeping the earlier changes. What must you include in your code to do this?       Mark for Review
(1) Points
            An object privilege
            An update statement
            A savepoint (*)
            A sequence
            A database link

14.       If a database crashes, all uncommitted changes are automatically rolled back. True or False? Mark for Review
(1) Points
            True (*)
            False

15.       If UserB has privileges to see the data in a table, as soon as UserA has entered data into that table, UserB can see that data. True or False?          Mark for Review
(1) Points
            True
            False (*)

1.         Table MYTAB contains only one column of datatype CHAR(1). A user executes the following statements in the order shown.
INSERT INTO mytab VALUES ('A');
INSERT INTO mytab VALUES ('B');
COMMIT;
INSERT INTO mytab VALUES ('C');
ROLLBACK;

Which rows does the table now contain?

 Mark for Review
(1) Points
            A, B, and C
            A and B (*)
            C
            None of the above

2.         If UserB has privileges to see the data in a table, as soon as UserA has entered data into that table, UserB can see that data. True or False?          Mark for Review
(1) Points
            True
            False (*)

3.         User BOB's CUSTOMERS table contains 20 rows. BOB inserts two more rows into the table but does not COMMIT his changes. User JANE now executes:
SELECT COUNT(*) FROM bob.customers;

What result will JANE see?

 Mark for Review
(1) Points
            JANE will receive an error message because she is not allowed to query the table while BOB is updating it.
            2
            20 (*)
            22

4.         Examine the following statements:
INSERT INTO emps SELECT * FROM employees; -- 107 rows inserted.
SAVEPOINT Ins_Done;
CREATE INDEX emp_lname_idx ON employees(last_name);
UPDATE emps SET last_name = 'Smith';

What happens if you issue a Rollback statement?

 Mark for Review
(1) Points

            The update of last_name is undone, but the insert was committed by the CREATE INDEX
statement. (*)
            Both the UPDATE and the INSERT will be rolled back.
            The INSERT is undone but the UPDATE is committed.
            Nothing happens.

5.         Steven King's row in the EMPLOYEES table has EMPLOYEE_ID = 100 and SALARY = 24000. A user issues the following statements in the order shown:
UPDATE employees
SET salary = salary * 2
WHERE employee_id = 100;
COMMIT;

UPDATE employees
SET salary = 30000
WHERE employee_id = 100;

The user's database session now ends abnormally. What is now King's salary in the table?

 Mark for Review
(1) Points
            24000
            30000
            48000 (*)
            78000

6.         When you logout of Oracle, your data changes are automatically rolled back. True or False? Mark for Review
(1) Points
            True
            False (*)

7.         Which of the following best describes the term "read consistency"?   Mark for Review
(1) Points
                                   
            It prevents users from querying tables on which they have not been granted SELECT privilege

            It prevents other users from querying a table while updates are being executed on it

            It prevents other users from seeing changes to a table until those changes have been committed (*)
            It ensures that all changes to a table are automatically committed

8.         Examine the following statements:
INSERT INTO emps SELECT * FROM employees; -- 107 rows inserted.
SAVEPOINT Ins_Done;
DELETE employees; -- 107 rows deleted
SAVEPOINT Del_Done;
UPDATE emps SET last_name = 'Smith';

How would you undo the last Update only?

 Mark for Review
(1) Points
            ROLLBACK UPDATE;
            There is nothing you can do.
            COMMIT Del_Done;
            ROLLBACK to SAVEPOINT Del_Done; (*)

9.         If a database crashes, all uncommitted changes are automatically rolled back. True or False? Mark for Review
(1) Points
            True (*)
            False

10.       A transaction makes several successive changes to a table. If required, you want to be able to rollback the later changes while keeping the earlier changes. What must you include in your code to do this?       Mark for Review
(1) Points
            An update statement
            A savepoint (*)
            A database link
            An object privilege
            A sequence

11.       You need not worry about controlling your transactions. Oracle does it all for you. True or False?    Mark for Review
(1) Points
            True
            False (*)

12.       If Oracle crashes, your changes are automatically rolled back. True or False? Mark for Review
(1) Points
            True (*)
            False

13.       Which SQL statement is used to remove all the changes made by an uncommitted transaction?         Mark for Review
(1) Points
            ROLLBACK; (*)
            UNDO;
            REVOKE;
            ROLLBACK TO SAVEPOINT;

14.       COMMIT saves all outstanding data changes? True or False?  Mark for Review
(1) Points
            True (*)
            False

15.       Examine the following statements:
UPDATE employees SET salary = 15000;
SAVEPOINT upd1_done;
UPDATE employees SET salary = 22000;
SAVEPOINT upd2_done;
DELETE FROM employees;

You want to retain all the employees with a salary of 15000; What statement would you execute next?

 Mark for Review
(1) Points
            ROLLBACK;
            ROLLBACK TO SAVEPOINT upd1_done; (*)
            ROLLBACK TO SAVEPOINT upd2_done;
            ROLLBACK TO SAVE upd1_done;

            There is nothing you can do; either all changes must be rolled back, or none of them can be rolled back.

Comments

Popular posts from this blog

Section 6 Quiz Oracle Database Programming with SQL

Section 6 Quiz             (Answer all questions in this section)                                                             1.         Given the following descriptions of the employees and jobs tables, which of the following scripts will display each employee ï¾’ s possible minimum and maximum salaries based on their job title? EMPLOYEES Table: Name   Null?    Type EMPLOYEE_ID          NOT NULL     NUMBER (6) FIRST_NAME             VARCHAR2 (20) LAST_NAME  NOT NULL     VARCHAR2 (25) EMAIL NOT NULL     VARCHAR2 (25) PHONE_NUMBER                  VARCHAR2 (20) HIRE_DATE   NOT NULL     DATE JOB_ID           NOT NULL     VARCHAR2 (10) SALARY                     NUMBER (8,2) COMMISSION_PCT                NUMBER (2,2) MANAGER_ID                       NUMBER (6) DEPARTMENT_ID                 NUMBER (4) JOBS Table: Name   Null?    Type JOB_ID           NOT NULL     VARCHAR2 (10) JOB_TITLE     NOT NULL     VARCHAR2 (35) MIN_SALARY                      

Section 10 Quiz Database Programming With SQL

Section 10 Quiz             (Answer all questions in this section) 1.         A multiple-row operator expects how many values?   Mark for Review (1) Points             One or more (*)             Only one             Two or more             None 2.         The salary column of the f_staffs table contains the following values: 4000 5050 6000 11000 23000 Which of the following statements will return the last_name and first_name of those employees who earn more than 5000?  Mark for Review (1) Points             SELECT last_name, first_name FROM f_staffs WHERE salary IN (SELECT last_name, first_name FROM f_staffs WHERE salary <5000 o:p="">             SELECT last_name, first_name FROM f_staffs WHERE salary = (SELECT salary FROM f_staffs WHERE salary < 5000);             SELECT last_name, first_name FROM f_staffs WHERE salary IN (SELECT salary FROM f_staffs WHERE salary > 5000); (*)             SELEC

Section 2 Quiz Database Design Oracle

Section 2 Quiz             (Answer all questions in this section) 1.         An Entity Relationship model is independent of the hardware or software used for implementation. True or False?  Mark for Review (1) Points             True (*)             False 2.         A well structured ERD will show only some parts of the finished data model. You should never try to model the entire system in one diagram, no matter how small the diagram might be. True or False?           Mark for Review (1) Points             True             False (*) 3.         The purpose of an ERD is to document the proposed system and facilitate discussion and understanding of the requirements captured by the developer. True or False?          Mark for Review (1) Points             True (*)             False 4. Documenting Business Requirements helps developers control the scope of the system and prevents users from claiming that the new system does not meet their business req