0% found this document useful (0 votes)
3 views

MCQ's 07

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

MCQ's 07

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Topic 07: Asynchronous Apex

Q 01: What is the main characteristic of Synchronous Apex?


a) It runs in the background and the user does not wait for the result.
b) It executes immediately and returns results to the user in the same transaction.
c) It cannot handle DML operations.
d) It is used only for batch processing.
Answer: b) It executes immediately and returns results to the user in the same
transaction.

Q 02: What happens if a transaction fails in Synchronous Apex?


a) Only the failed operation is rolled back.
b) The entire transaction is rolled back.
c) The transaction continues with the next operation.
d) The transaction is paused until the issue is resolved.
Answer: b) The entire transaction is rolled back.

Q 03: Which of the following is a governor limit in Synchronous Apex?


a) 100 SOQL queries per transaction.
b) 200 DML statements per transaction.
c) 20,000 lines of code per method.
d) 50 triggers per object.
Answer: a) 100 SOQL queries per transaction.

Q 04: What is the maximum CPU time allowed for Synchronous Apex?
a) 10,000 milliseconds.
b) 1,000 milliseconds.
c) 15,000 milliseconds.
d) 5,000 milliseconds.
Answer: a) 10,000 milliseconds.
Q 05: How can you prevent hitting governor limits in Synchronous Apex?
a) By using DML operations inside loops.
b) By bulkifying the code to handle multiple records.
c) By executing multiple transactions simultaneously.
d) By ignoring SOQL query limits.
Answer: b) By bulkifying the code to handle multiple records.

Q 06: Which statement is true about SOQL queries in Synchronous Apex?


a) You can execute unlimited SOQL queries in a single transaction.
b) SOQL queries must always return a single record.
c) SOQL queries are limited to 100 per transaction.
d) SOQL queries do not count towards governor limits.
Answer: c) SOQL queries are limited to 100 per transaction.

Q 07: What is the purpose of the Limits class in Apex?


a) To ignore governor limits during execution.
b) To set new governor limits for a transaction.
c) To monitor and manage governor limits during code execution.
d) To increase the heap size limit.
Answer: c) To monitor and manage governor limits during code execution.

Q 08: Which of the following DML operations can be performed in Synchronous Apex?
a) Insert.
b) Update.
c) Delete.
d) All of the above.
Answer: d) All of the above.

Q 09: What is the correct approach to handle exceptions in Synchronous Apex?


a) Allow the transaction to fail without handling exceptions.
b) Implement proper exception handling to manage errors and rollback transactions if
necessary.
c) Ignore exceptions to maintain transaction flow.
d) Write exceptions directly in the trigger.
Answer: b) Implement proper exception handling to manage errors and rollback
transactions if necessary.
Q 10: What is the consequence of exceeding governor limits in Synchronous Apex?
a) The transaction is paused until limits are reset.
b) The transaction is completed but with reduced performance.
c) The transaction fails and all operations are rolled back.
d) The transaction continues but without completing all operations.
Answer: c) The transaction fails and all operations are rolled back.

Q 11: How can you optimize SOQL queries in Synchronous Apex to avoid limits?
a) Use SELECT * to retrieve all fields.
b) Use specific field names in SELECT statements to retrieve only necessary data.
c) Execute multiple SOQL queries in a loop.
d) Perform SOQL queries after all DML operations.
Answer: b) Use specific field names in SELECT statements to retrieve only necessary
data.

Q 12: Which of the following should be avoided in Synchronous Apex to prevent


hitting limits?
a) Bulkification.
b) DML operations inside loops.
c) SOQL query optimization.
d) Using the Limits class.
Answer: b) DML operations inside loops.

Q 13: What is the maximum heap size allowed in Synchronous Apex?


a) 12 MB.
b) 3 MB.
c) 6 MB.
d) 10 MB.
Answer: c) 6 MB.
Q 14: What is the correct way to handle multiple records in Synchronous Apex?
a) Use loops with DML operations inside them.
b) Bulkify the code by processing all records in a single DML statement.
c) Use multiple transactions for different records.
d) Execute each record individually in separate transactions.
Answer: b) Bulkify the code by processing all records in a single DML statement.

Q 15: Why is it important to manage transaction boundaries in Synchronous Apex?


a) To allow for partial transactions.
b) To ensure that all operations succeed or fail together, maintaining data integrity.
c) To split transactions across multiple triggers.
d) To increase execution time.
Answer: b) To ensure that all operations succeed or fail together, maintaining data
integrity.

____Thank You____

You might also like