MySQL Questions and Answers – Performing Transactions

This set of MySQL Database Multiple Choice Questions & Answers (MCQs) focuses on “Performing Transactions”.

1. What is known as the set of SQL statements that either executes successfully or none of them have an effect?
a) joins
b) transactions
c) filters
d) deletions
View Answer

Answer: b
Explanation: In MySQL, a transaction is a set of SQL statements that are run as a single unit. They can be canceled when required, but they can either execute successfully or neither of them executes.

2. What is generally done after the transactions are executed successfully?
a) delete
b) rollback
c) commit
d) update
View Answer

Answer: c
Explanation: In a transaction, either all the statements are executed successfully or neither of them are successful. This is facilitated by the commit and rollback capabilities. Commit is made after a transaction.

3. What is generally done if an error occurs during the transaction?
a) delete
b) rollback
c) commit
d) update
View Answer

Answer: b
Explanation: Whenever an error occurs during a transaction, it is generally taken to the state prior to the beginning of transaction execution. This is known as rollback. It is a set of undo operations.
advertisement
advertisement

4. What does ‘A’ stand for in the ACID property of transactions?
a) Availability
b) Accuracy
c) Adjustability
d) Atomicity
View Answer

Answer: d
Explanation: All the transaction systems have an important set of characteristics in common. This is known as the ‘ACID’ property of the transaction. It refers to the four elementary characteristics of a transaction.

5. What does ‘C’ stand for in the ACID property of transactions?
a) Compound
b) Concrete
c) Collision
d) Consistency
View Answer

Answer: d
Explanation: The elementary characteristics of a transaction are known as the ‘ACID’ properties. ‘ACID’ is the acronym for the four basic characteristics that a transaction must have for smooth processing.

5. What is the isolation property of transactions?
a) statements form a logic unit
b) database remains consistent
c) one transaction does not affect the other
d) transaction effects are recorded permanently
View Answer

Answer: c
Explanation: The ‘isolation’ property of a transaction is one of the four elementary characteristics that are expected for a database transaction to maintain throughout. The others are Atomicity, Consistency and Durability.

6. What is the command to disable autocommit and launch a transaction?
a) INITIATE TRANSACTION
b) START TRANSACTION
c) DISABLE AUTOCOMMIT
d) TRANSACTION
View Answer

Answer: b
Explanation: By default, MySQL runs in the autocommit mode. This means that the changes performed by individual statements or operations on tables are automatically committed to the database immediately.
advertisement

7. Transactional processing provides strong guarantees about the outcome of operations.
a) True
b) False
View Answer

Answer: a
Explanation: A transaction can either execute successfully or it can be rolled back to the point of initiation. Once a transaction completes, changes are recorded with commit. If it fails, changes are rolled back.

8. Transactional processing requires lesser overhead due to CPU cycles and memory.
a) True
b) False
View Answer

Answer: b
Explanation: Transactional processing is a Compound process. The statements and the state of the database need to be kept track of during the execution of the transaction. This means CPU cycles need to be reserved.
advertisement

9. What is the durability property of transactions?
a) statements form a logic unit
b) database remains consistent
c) one transaction does not affect the other
d) transaction effects are recorded permanently
View Answer

Answer: d
Explanation: The ‘durability’ property of a transaction is one of the four elementary characteristics that are expected for a database transaction to maintain throughout. The others are Isolation, Atomicity and Consistency.

10. How many storage engines among the following are transaction-safe?

InnoDB, Falcon, MyISAM, MEMORY

a) 1
b) 2
c) 3
d) 4
View Answer

Answer: b
Explanation: For some applications, transactional properties are essential. For example, financial operations usually require transaction processing. InnoDB and Falcon are transaction-safe while the other two are not.

Sanfoundry Global Education & Learning Series – MySQL Database.

To practice all areas of MySQL Database, here is complete set of 1000+ Multiple Choice Questions and Answers.

If you find a mistake in question / option / answer, kindly take a screenshot and email to [email protected]

advertisement
advertisement
Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.