BSCCS2001: Practice Assignment with Solutions
Week 11
{Write general instructions here}
1. Which of the following statements is/are true? [MSQ:2 points]
If a crash/rollback occurs before the operation completes, then the logical undo
is performed and the physical undo information for the operation is ignored.
If a crash/rollback occurs after the operation completes, then the physical
undo information is used to undo the operation.
√
If a crash/rollback occurs after the operation completes, then the operation-
end log record is found.
√
If a crash/rollback occurs before operation completes, then the operation-end
log record is not found.
Solution:
• If crash/rollback occurs before the operation completes, then the physical undo
information is used to undo the operation.
• If crash/rollback occurs after the operation completes, then the logical undo is
performed and the physical undo information for the operation is ignored.
• If crash/rollback occurs after the operation completes, then the operation-end
log record is found.
• If crash/rollback occurs before the operation completes, then the operation-end
log record is not found.
Page 2
2. Which of the following statements is/are true regarding checkpoints in the transaction?
[MSQ: 2 points]
√
Any transactions committed before the last checkpoint should be ignored.
Any transactions committed since the last checkpoint should be ignored.
√
It scans backwards from the end of the log to find the most recent < checkpointL >
record.
Any transaction that was running at the time of failure needs to be redone.
Solution:
• It scans backwards from end of log to find the most recent < checkpointL >
record.
• Any transactions that committed before the last checkpoint should be ignored.
• Any transactions that committed since the last checkpoint need to be redone.
• Any transaction that was running at the time of failure needs to be undone
and restarted.
So, options 1 and 3 are correct.
Page 3
3. Consider the following log records of transactions, where immediate database modifica-
tion scheme is used. [ MSQ: 2 points]
step Details of log
1 < T0 , start >
2 < T0 , A, 1200, 900 >
3 < T0 , B, 1000, 800 >
4 < T1 , start >
5 < T1 , D, 200, 50 >
6 < T0 , commit >
7 < T2 , start >
8 < T2 , P, 700, 300 >
9 < T2 , Q, 1150, 670 >
10 < checkpointL >
11 < T1 , E, 400, 320 >
12 < T1 , commit >
13 < T2 , R, 300, 100 >
Suppose the transactions failed after step 13, then which of the following is/are correct?
Transaction T1 needs no recovery
√
Transaction T2 needs to be undone
Transaction T0 and T1 need no recovery
√
Transaction T1 needs to be redone
Solution:
Any transactions that committed before the last checkpoint should be ignored. So
T0 can be ignored.
Any transactions that committed since the last checkpoint need to be redone. So,
T1 need to be redone.
Any transaction that was running at the time of failure needs to be undone and
restarted. So, T2 need to be undone and restarted.
Page 4
4. Consider the following statements: [MCQ:2Points]
1. Hot backup refers to keeping a database up and running while the backup is being
performed concurrently.
2. Hot backup is mainly used for Transaction Log Backup.
3. Transactional Logging is used in circumstances where a possibly inconsistent backup
is taken.
Choose the correct option.
Statements 1 & 2 are correct
Statements 1 & 3 are correct
√
All the statements are correct
Only Statement 1 is correct
Solution: Refer to slide No. 51.25
Page 5
5. Figure 1 shows the timeline of four transactions T1, T2, T3 and T4 respectively.
Figure 1: State of transactions
Which of the following action(s) will be taken by the recovery manager? [MSQ: 2
points]
Transaction T1 is ignored.
Transaction undo is performed for T2.
√
Transaction redo is performed for T1 and T2.
√
Transaction undo is performed for T3 and T4.
Solution:
1. Transaction T1 starts before the checkpoint and commits before system crash,
so T1 needs to be redone.
2. Transaction T2 starts after the checkpoint and commits before system crash,
so T2 needs to be redone.
6. Consider the following log involving three transactions T1, T2, T3: -
Page 6
Which of the following will happen after the crash occurs? [MSQ: 2 points]
√
T1 is committed before the checkpoint, it will be ignored.
T2 is committed but after the checkpoint, so it should be ignored.
T3 did not commit, so redo all its updates.
√
T2 is committed but after the checkpoint, so redo all its updates.
Solution:
• Transaction T1 started before the checkpoint and committed before the check-
point as well, so T1 will be ignored.
• Transaction T2 started after the last checkpoint and committed before the
system crash, so the changes made to T2 needs to be redone.
• Since T3 did not commit before the system failure, so any changes made to T3
needs to be undone.
7. Consider the following statements:-
• Since B+ tree insertions and deletions release lock early, they can be restored by
physical undo logging.
• Redoing the previous updates should be logged physically as they do not conflict
with the early lock release.
Page 7
Choose the correct option. [MCQ: 2 points]
Statement 1 is correct & Statement 2 is wrong.
Both the statements are correct.
√
Statement 1 is wrong & Statement 2 is correct.
All the statements are wrong.
Solution: Please refer to slide 54.8 & 54.9.
8. What happens if a crash occurs after the operation in the logging process is completed?
[MSQ: 2 points]
Physical undo operation is used to undo the operation.
√
A logical undo operation is performed using the operation identifier.
√
Physical undo operation is ignored.
None of the above
Solution: Please refer to slide 54.12.
Page 8
9. Consider the following statements.
[NAT: points]
1. It is mandatory to perform a full backup at least once.
2. Recovery from a full backup is the easiest.
3. There is very little to no dependency between consecutive full backups.
How many among the given statements are true regarding Full Backup?
Ans: 3
Solution: Statement 1 is true because we must have one full backup initially.
Statement 2 is true because, while recovering directly from a full backup one consol-
idated read would restore everything in the database.
It’s the least complex recovery process.
Statement 3 is true. Since full backup backs up everything there will not be any
dependency on multiple versions of backup.
Page 9
10. Consider the given backup schedule, and answer the question.
Figure 2: .
You can have at most one differential backup in a week and all other backups shall be
incremental (except the one full backup given).
On which day will you do the differential backup so as to minimise the number of backup
sets required for recovery on any arbitrary day?
[MCQ: points]
Friday
Sunday
√
Wednesday
Number of sets required for recovery is independent of the day of differential
backup.
Solution: If we keep the differential backup on Wednesday then irrespective of the
day of failure we will not require more than 4 backup sets, which is the minimum
considering all other scenarios.
Page 10
Answer questions 11 and 12 on the basis of the given data.
A RAID-5 storage system with similar arrangement of parity blocks as described in
slide 55.16 is used for storing the following data:
Figure 3: RAID-5 data
11. According to the figure disk-2 has crashed. What data is present in the two blocks of
disk-2?
Note: Assume block size is 4 bits
[2 points:MCQ]
√
block 1: 0100, block 2: 0100
block 1: 0101, block 2: 0100
block 1: 0001, block 2: 0100
block 1: 0001, block 2: 0001
Solution:
RAID-5 uses XOR recovery facility for lost data.So the data stored in a block of
disk-2 can be obtained by performing bitwise XOR of all blocks of other disks in the
same row.
So block 1 of disk-2 stores = 0100 XOR 0100 XOR 0001 XOR 0101= 0100
block 2 of disk-2 stores = 0101 XOR 0100 XOR 0100 XOR 0001= 0100
Hence option 1 is correct.
Page 11
12. Assume that the binary values represent 8 bit ASCII code. What is the data word
present inside this RAID-5 storage system?
[2 points:MCQ]
IITM
IITB
√
DATA
DBMS
Solution:
ASCII is 8 bit code so we will group every successive 8 bits from the RAID-5 storage,
except the parity bits.
Disk-5 block-1, Disk-4 block-2 are parity blocks hence these will not be added into
the data part.
So the data is :01000100 (68 =‘D’), 01000001 (65 =‘A’),01010100(84 =‘T’), 01000001
(65 =‘A’).
So the word is ‘DATA’. Option 3 is correct.
Page 12
13. For the given set of statements below:
• RAID-1 can allow parallel read of two different disk blocks always
• RAID-4 cannot allow parallel read of different disk blocks always
• RAID-5 allows parallel processing of multiple write requests
• In a system where small write operations occur frequently RAID-5 is better than
RAID-1
How many statement(s) is/are FALSE ? [2 points:NAT]
Answer: 1
Solution:
statement 1: is true. Since data in RAID-1 is stored in two redundant copies, at
any time it can allow two different reads of disk blocks.
statement 2: is true. Since RAID4 uses block interleaved parity, a single data
instance may be distributed among all the disk’s blocks. When a read of such a data
is going on it will operate on all the disks at the same time and hence no disk would
be free to service a different read request.
statement 3: is true, since RAID5 does not use a reserved disk for parity. Hence,
all disks can separately maintain their own parity information. Two or more simul-
taneous write operation on different disks can work because there is no bottleneck
for updating one parity disk for an ongoing write, like in case of RAID 3, 4.
statement 4: is false. A system where the frequency of small write is higher RAID
5 is not a good choice. As every write in RAID 5 requires read-modify-write cycle
which is time consuming and therefore performing frequent writes is bad for RAID5.
RAID 1 is a better choice in this scenario.
14. Consider the following statements regarding RAID 3. [MCQ:2points]
1. RAID 3 consists of byte-level striping with dedicated parity.
2. RAID 3 uses multiple designated drives for parity.
3. RAID 3 cannot service multiple requests simultaneously.
Choose the correct option.
Statement 1 & 2 are correct
Only statement 1 is correct
√
Only statements 1 & 3 are correct
Page 13
All the statements are correct
Solution:
• RAID 3 consists of byte-level striping with dedicated parity.
• RAID 3 has a single check disk with parity information.
• RAID-3 cannot service multiple requests simultaneously: This is so because any
single block of data will be spread across all members of the set and will reside
in the same physical location on each disk. Thus, every single I/O request has
to be addressed by working on every disk in the array.
Page 14