Recall & Review
beginner
What is an abstract contract in blockchain programming?
An abstract contract is a contract that cannot be deployed on its own because it has at least one function without implementation. It serves as a base for other contracts to inherit and implement missing functions.
Click to reveal answer
beginner
Why do we use abstract contracts?
We use abstract contracts to define common interfaces and shared behavior for multiple contracts. They help organize code and enforce that child contracts implement required functions.
Click to reveal answer
beginner
How do you declare an abstract contract in Solidity?
You declare an abstract contract by using the keyword <code>abstract</code> before <code>contract</code>. For example: <pre>abstract contract MyBase { function doSomething() public virtual; }</pre>Click to reveal answer
intermediate
What happens if a contract inherits an abstract contract but does not implement all its functions?
The inheriting contract also becomes abstract and cannot be deployed until it implements all the abstract functions from its base contracts.
Click to reveal answer
intermediate
Can abstract contracts have implemented functions?
Yes, abstract contracts can have both implemented and unimplemented (abstract) functions. The unimplemented functions must be implemented by child contracts.
Click to reveal answer
What keyword is used to declare an abstract contract in Solidity?
✗ Incorrect
The keyword
abstract is used before contract to declare an abstract contract.Can you deploy an abstract contract directly?
✗ Incorrect
Abstract contracts cannot be deployed directly because they have unimplemented functions.
If a contract inherits an abstract contract but does not implement all abstract functions, what happens?
✗ Incorrect
The contract remains abstract and cannot be deployed until all abstract functions are implemented.
Which of these is true about abstract contracts?
✗ Incorrect
Abstract contracts can have implemented functions and also declare abstract functions without implementation.
Why use abstract contracts instead of interfaces?
✗ Incorrect
Abstract contracts allow sharing implemented code, while interfaces only declare function signatures.
Explain what an abstract contract is and why it is useful in blockchain programming.
Think about contracts that set rules but don’t do everything themselves.
You got /4 concepts.
Describe how inheritance works with abstract contracts and what happens if child contracts don’t implement all abstract functions.
Consider what happens if you inherit a contract with missing pieces.
You got /4 concepts.