CS Security & Databases 3 — Questions and Answers
Question 1: Which SQL command removes all rows from a table but keeps its structure and is typically not logged row-by-row?
- TRUNCATE (Correct answer)
- DELETE
- DROP
- REVOKE
Correct answer: TRUNCATE
TRUNCATE quickly removes all rows while preserving the table definition, unlike DROP which removes the table.
Question 2: An attacker intercepts and secretly relays communication between two parties who believe they are talking directly. What is this attack called?
- Man-in-the-middle attack (Correct answer)
- Denial-of-service attack
- Phishing attack
- Brute-force attack
Correct answer: Man-in-the-middle attack
A man-in-the-middle attack places the attacker between two communicating parties to eavesdrop or alter traffic.
Question 3: In the CIA triad, which property is violated when an attacker modifies records in a database without authorization?
- Integrity (Correct answer)
- Confidentiality
- Availability
- Non-repudiation
Correct answer: Integrity
Unauthorized modification of data is a violation of integrity.
Question 4: Two transactions each hold a lock the other needs, and neither can proceed. What is this situation called?
- Deadlock (Correct answer)
- Race condition
- Livelock
- Dirty read
Correct answer: Deadlock
A deadlock occurs when transactions wait on each other's locks in a cycle, so none can proceed.
Question 5: Which of the following best describes a database index?
- A data structure that speeds up lookups at the cost of extra storage and slower writes (Correct answer)
- A backup copy of the table
- A constraint that prevents duplicate rows
- A log of all executed transactions
Correct answer: A data structure that speeds up lookups at the cost of extra storage and slower writes
An index (often a B-tree) accelerates reads but must be updated on writes and consumes storage.
Question 6: Which authentication factor category does a fingerprint belong to?
- Something you are (Correct answer)
- Something you know
- Something you have
- Somewhere you are
Correct answer: Something you are
Biometrics such as fingerprints are inherence factors, i.e., something you are.
Question 7: A transaction reads a row that another uncommitted transaction has modified. If the second transaction rolls back, what anomaly occurred?
- Dirty read (Correct answer)
- Phantom read
- Non-repeatable read
- Lost update
Correct answer: Dirty read
Reading uncommitted data that may later be rolled back is called a dirty read.
Which SQL command removes all rows from a table but keeps its structure and is typically not logged row-by-row?