Week 3 practice test Flashcards

1
Q

What is the result of the following database transaction if the initial values of both A and B is 100?

BEGIN

A=A+100

B=A+100

END

1) A=200, B=200
2) A=200, B=300
3) A=100, B=200
4) A=200, B=100

A

2) A=200, B=300

NOT: 1) A=200, B=200
This is not correct; the new value of B is 300.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

How does a database achieve concurrency?

1) By interleaving transactions.
2) By processing transactions at the same time.
3) By processing transactions as they come in.
4) By putting transactions in a queue.

A

1) By interleaving transactions.

NOT: 4) By putting transactions in a queue.
This is not correct; a queue can process only one transaction at a given time.
3) By processing transactions as they come in.
This is not correct; no mechanism is suggested if two transactions come at the same time.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Which of the following describes the atomicity principle of database transactions?

1) A database can only process one query at a time.
2) All of the components of a transaction run in their entirety, or none of them run at all.
3) A database can only process one transaction at a time.
4) A database can only serve one user at a time.

A

2) All of the components of a transaction run in their entirety, or none of them run at all.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What kind of lock must a transaction acquire in order to read from a database?

1) Concurrency lock
2) Exclusive lock
3) Read lock
4) Shared lock

A

4) Shared lock

Not:
1) Concurrency lock
This is not correct; there is no such lock.
3) Read lock
This is not correct; there is no such lock.
2) Exclusive lock

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Database transactions are processed according to a principle that all of the components of a transaction run in their entirety or none of them run at all. What is the name of this principle?

1) Isolation
2) Concurrency
3) Durability
4) Atomicity

A

4) Atomicity

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Which of the following database operations does not require a transaction to obtain an exclusive lock?

1) Delete data
2) Read data
3) Write data
4) Update data

A

2) Read data

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Why do database management systems implement transaction interleaving?

1) To achieve isolation
2) To achieve consistency
3) To achieve atomicity
4) To achieve concurrency

A

4) To achieve concurrency

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Which of the following describes the isolation principle of database transactions?

1) A database management system can only process one query at a time.
2) All of the components of a database transaction run in their entirety, or none of them run at all.
3) A database management system can only process one transaction at a time.
4) Each transaction runs as if there is no other transaction running in the database system simultaneously.

A

4) Each transaction runs as if there is no other transaction running in the database system simultaneously.

NOT: 3) A database management system can only process one transaction at a time.

This is not correct; a database management system can process multiple transactions simultaneously.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Which of the following statements about the ACID properties (Atomicity, Consistency, Isolation, Durability) is correct?

1) Atomicity implies Serializability
2) Isolation implies Serializability
3) Durability implies Serializability
4) Consistency implies Serializability

A

2) Isolation implies Serializability

Not: 1) Atomicity implies Serializability
3) Durability implies Serializability

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Which of the following describes the durability property of database transactions?

1) If several transactions are executed concurrently, the results must be the same as if they were executed one after another.
2) Each transaction runs as if there are no other transactions running in the database system simultaneously.
3) All of the components of a transaction run in their entirety, or none of them run at all.
4) Once a transaction commits, the system guarantees the results will never be lost, in spite of subsequent failures.

A

4) Once a transaction commits, the system guarantees the results will never be lost, in spite of subsequent failures.

Not:
3) All of the components of a transaction run in their entirety, or none of them run at all.

3) All of the components of a transaction run in their entirety, or none of them run at all.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Consider the following pairs of queries:

a=b+100b=a+ca = b + 100 \hspace{35pt} b = a + ca=b+100b=a+c

A scheduler proposes two schedule options:

  1. R(b), W(a), R(a), R(c), W(b)
  2. R(b), R(a), R(c), W(a), W(b)

1) Are these two schedulers equivalent?
2) Yes
3) No
4) There is not enough information to determine.

A

3) No

The two schedulers do not result in the same outcome.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Strict two-phase locking gets its name from:

1) The two phases, lock acquisition and lock release
2) The two phases, locking/unlocking and cleanup
3) The two phases, lock acquisition and data write
4) The two types of locks used

A

1) The two phases, lock acquisition and lock release

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Databases enter a recovery state when:

1) There is a failure due to loss of power.
2) There is a failure of any kind.
3) There is a failure during a transaction.
4) Deleted data needs to be restored.

A

2) There is a failure of any kind.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly