What does the transfer function do when sending Ether in Solidity?
The transfer function sends a fixed amount of Ether to an address and throws an error if the transfer fails, reverting the transaction.
Click to reveal answer
beginner
How does send differ from transfer when sending Ether?
send sends Ether but returns a boolean indicating success or failure instead of throwing an error. It requires manual error handling.
Click to reveal answer
intermediate
What is the main advantage of using call to send Ether?
call is more flexible and forwards all available gas, allowing interaction with contracts that require more gas. It also returns success status and data.
Click to reveal answer
advanced
Why should you be careful when using call to send Ether?
Because call forwards all gas by default, it can lead to reentrancy attacks if not handled properly. Always use checks-effects-interactions pattern.
Click to reveal answer
beginner
What happens if transfer or send fails to send Ether?
transfer throws an error and reverts the transaction, while send returns false and requires manual error handling.
Click to reveal answer
Which function automatically reverts the transaction if sending Ether fails?
Atransfer
Bsend
Ccall
Dapprove
✗ Incorrect
transfer throws an error and reverts the transaction on failure.
Which function returns a boolean indicating success or failure when sending Ether?
Asend
Btransfer
Ccall
Dmint
✗ Incorrect
send returns true or false depending on success.
Which method is recommended for sending Ether when you need to forward all gas and handle complex interactions?
Atransfer
Bsend
Cdelegatecall
Dcall
✗ Incorrect
call forwards all gas and allows complex interactions.
What is a major security risk when using call to send Ether?
AGas limit exceeded
BReentrancy attack
CInteger overflow
DStack overflow
✗ Incorrect
Using call can open the door to reentrancy attacks if not handled carefully.
If you want to send Ether and handle failure manually without reverting, which function should you use?
Acall
Btransfer
Csend
Dselfdestruct
✗ Incorrect
send returns false on failure, allowing manual handling.
Explain the differences between transfer, send, and call when sending Ether in Solidity.
Think about error handling and gas forwarding.
You got /4 concepts.
Describe a safe pattern to send Ether using call to avoid security risks.
Focus on security best practices.
You got /4 concepts.
Practice
(1/5)
1.
Which Solidity function automatically reverts the transaction if sending Ether fails?
easy
A. approve
B. send
C. call
D. transfer
Solution
Step 1: Understand transfer behavior
transfer sends Ether and automatically reverts if the transfer fails.
Step 2: Compare with other methods
send returns false on failure without reverting; call requires manual check; approve is unrelated to sending Ether.
Final Answer:
transfer -> Option D
Quick Check:
Automatic revert on failure = transfer [OK]
Hint: transfer always reverts on failure, no manual check needed [OK]
Common Mistakes:
Confusing send with transfer behavior
Thinking call auto-reverts on failure
Mixing approve with Ether sending
2.
Which of the following is the correct syntax to send 1 Ether using send in Solidity?
recipient.?{value: 1 ether}();
easy
A. send
B. transfer
C. call
D. approve
Solution
Step 1: Recall send syntax
send is called as recipient.send{value: amount}() in Solidity 0.6+.
Step 2: Match syntax with options
Only send matches send method usage for sending Ether.