Thursday, May 24, 2018

Database Programming with SQL-Section 18 Quiz


Test: Section 18 Quiz
Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer.

 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
   
 
 24000

 
 48000 (*)

 
 30000

 
 78000

   
  
Incorrect  Incorrect. Refer to Section 18 Lesson 1.

   
  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 (*)

   
  
Incorrect  Incorrect. Refer to Section 18 Lesson 1.

   
  3.  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; (*)

   
  
Incorrect  Incorrect. Refer to Section 18 Lesson 1.

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

 
 False (*)

   
  
Incorrect  Incorrect. Refer to Section 18 Lesson 1.

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

 
 False (*)

   
  
Incorrect  Incorrect. Refer to Section 18 Lesson 1.

   
Page 1 of 3 Next Summary


Test: Section 18 Quiz
Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer.

 Section 18 Quiz
 (Answer all questions in this section)
   
  6.  Which SQL statement is used to remove all the changes made by an uncommitted transaction? Mark for Review
(1) Points
   
 
 UNDO;

 
 ROLLBACK TO SAVEPOINT;

 
 REVOKE;

 
 ROLLBACK; (*)

   
  
Incorrect  Incorrect. Refer to Section 18 Lesson 1.

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

 
 False

   
  
Correct  Correct

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

 
 False

   
  
Correct  Correct

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

 
 False

   
  
Correct  Correct

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

 
 2

 
 JANE will receive an error message because she is not allowed to query the table while BOB is updating it.

 
 20 (*)

   
  
Incorrect  Incorrect. Refer to Section 18 Lesson 1.

   
Previous Page 2 of 3 Next Summary


Test: Section 18 Quiz
Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer.

 Section 18 Quiz
 (Answer all questions in this section)
   
  11.  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.

   
  
Incorrect  Incorrect. Refer to Section 18 Lesson 1.

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

   
  
Incorrect  Incorrect. Refer to Section 18 Lesson 1.

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

   
  
Incorrect  Incorrect. Refer to Section 18 Lesson 1.

   
  14.  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
   
 
 A database link

 
 An object privilege

 
 A savepoint (*)

 
 A sequence

 
 An update statement

   
  
Incorrect  Incorrect. Refer to Section 18 Lesson 1.

   
  15.  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 seeing changes to a table until those changes have been committed (*)

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

 
 It ensures that all changes to a table are automatically committed

   
  
Incorrect  Incorrect. Refer to Section 18 Lesson 1.

   
Previous Page 3 of 3 Summary


Test: Section 18 Quiz
Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer.

 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
   
 
 30000

 
 24000

 
 78000

 
 48000 (*)

   
  
Incorrect  Incorrect. Refer to Section 18 Lesson 1.

   
  2.  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
   
 
 A sequence

 
 A database link

 
 An object privilege

 
 An update statement

 
 A savepoint (*)

   
  
Incorrect  Incorrect. Refer to Section 18 Lesson 1.

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

   
  
Incorrect  Incorrect. Refer to Section 18 Lesson 1.

   
  4.  Which SQL statement is used to remove all the changes made by an uncommitted transaction? Mark for Review
(1) Points
   
 
 UNDO;

 
 ROLLBACK TO SAVEPOINT;

 
 ROLLBACK; (*)

 
 REVOKE;

   
  
Incorrect  Incorrect. Refer to Section 18 Lesson 1.

   
  5.  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
   
 
 2

 
 22

 
 JANE will receive an error message because she is not allowed to query the table while BOB is updating it.

 
 20 (*)

   
  
Incorrect  Incorrect. Refer to Section 18 Lesson 1.

   
Page 1 of 3 Next Summary


Test: Section 18 Quiz
Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer.

 Section 18 Quiz
 (Answer all questions in this section)
   
  6.  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.

   
  
Correct  Correct

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

 
 False

   
  
Correct  Correct

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

   
  
Correct  Correct

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

 
 False

   
  
Correct  Correct

   
  10.  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;

 
 ROLLBACK to SAVEPOINT Del_Done; (*)

 
 COMMIT Del_Done;

 
 There is nothing you can do.

   
  
Correct  Correct

   
Previous Page 2 of 3 Next Summary


Test: Section 18 Quiz
Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer.

 Section 18 Quiz
 (Answer all questions in this section)
   
  11.  Which of the following best describes the term "read consistency"?  Mark for Review
(1) Points
   
 
 It ensures that all changes to a table are automatically committed

 
 It prevents users from querying tables on which they have not been granted SELECT privilege

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

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

   
  
Incorrect  Incorrect. Refer to Section 18 Lesson 1.

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

 
 False

   
  
Correct  Correct

   
  13.  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 (*)

   
  
Incorrect  Incorrect. Refer to Section 18 Lesson 1.

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

 
 False (*)

   
  
Incorrect  Incorrect. Refer to Section 18 Lesson 1.

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

 
 False (*)

   
  
Incorrect  Incorrect. Refer to Section 18 Lesson 1.

   
Previous Page 3 of 3 Summary


Test: Section 18 Quiz
Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer.

 Section 18 Quiz
 (Answer all questions in this section)
   
  1.  Which of the following best describes the term "read consistency"?  Mark for Review
(1) Points
   
 
 It ensures that all changes to a table are automatically committed

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

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

 
 It prevents users from querying tables on which they have not been granted SELECT privilege

   
  
Correct  Correct

   
  2.  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
   
 
 20 (*)

 
 JANE will receive an error message because she is not allowed to query the table while BOB is updating it.

 
 22

 
 2

   
  
Incorrect  Incorrect. Refer to Section 18 Lesson 1.

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

 
 False (*)

   
  
Incorrect  Incorrect. Refer to Section 18 Lesson 1.

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

 
 False

   
  
Correct  Correct

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

 
 False

   
  
Correct  Correct

   
Page 1 of 3 Next Summary


Test: Section 18 Quiz
Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer.

 Section 18 Quiz
 (Answer all questions in this section)
   
  6.  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.

   
  
Incorrect  Incorrect. Refer to Section 18 Lesson 1.

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

   
  
Incorrect  Incorrect. Refer to Section 18 Lesson 1.

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

 
 ROLLBACK; (*)

 
 REVOKE;

 
 UNDO;

   
  
Incorrect  Incorrect. Refer to Section 18 Lesson 1.

   
  9.  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; (*)

   
  
Correct  Correct

   
  10.  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
   
 
 48000 (*)

 
 30000

 
 24000

 
 78000

   
  
Incorrect  Incorrect. Refer to Section 18 Lesson 1.

   
Previous Page 2 of 3 Next Summary


Test: Section 18 Quiz
Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer.

 Section 18 Quiz
 (Answer all questions in this section)
   
  11.  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.

   
  
Correct  Correct

   
  12.  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 (*)

   
  
Incorrect  Incorrect. Refer to Section 18 Lesson 1.

   
  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 update statement

 
 A savepoint (*)

 
 A sequence

 
 A database link

 
 An object privilege

   
  
Incorrect  Incorrect. Refer to Section 18 Lesson 1.

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

 
 False

   
  
Correct  Correct

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

 
 False (*)

No comments:

Post a Comment