0
0
Blockchain / Solidityprogramming~10 mins

Solidity compiler optimization in Blockchain / Solidity - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to enable compiler optimization in Solidity.

Blockchain / Solidity
pragma solidity ^0.8.0;

contract OptimizedContract {
    // Enable optimization with [1]
}
Drag options to blanks, or click blank then click option'
Aoptimizer: true
Boptimizer = true
Coptimization = true
Doptimize = true
Attempts:
3 left
💡 Hint
Common Mistakes
Using '=' instead of ':' in the optimizer setting.
Using incorrect keywords like 'optimization' or 'optimize'.
2fill in blank
medium

Complete the code to set the optimizer runs to 200.

Blockchain / Solidity
pragma solidity ^0.8.0;

contract OptimizedContract {
    // Set optimizer runs to [1]
}
Drag options to blanks, or click blank then click option'
Aruns = 100
Bruns: 100
Cruns = 200
Druns: 200
Attempts:
3 left
💡 Hint
Common Mistakes
Using '=' instead of ':' for runs.
Setting runs to 100 instead of 200.
3fill in blank
hard

Fix the error in the optimizer configuration line.

Blockchain / Solidity
optimizer: [1] true, runs: 200
Drag options to blanks, or click blank then click option'
A==
B:
C=
D=>
Attempts:
3 left
💡 Hint
Common Mistakes
Using '=' or '==' instead of ':'.
Using '=>' which is not valid here.
4fill in blank
hard

Fill both blanks to complete the optimizer configuration object.

Blockchain / Solidity
{ optimizer: [1], runs: [2] }
Drag options to blanks, or click blank then click option'
Atrue
Bfalse
C200
D100
Attempts:
3 left
💡 Hint
Common Mistakes
Disabling optimizer by setting false.
Setting runs to 100 instead of 200.
5fill in blank
hard

Fill all three blanks to complete the Solidity compiler optimization settings.

Blockchain / Solidity
settings = { optimizer: [1], runs: [2], details: { [3]: true } }
Drag options to blanks, or click blank then click option'
Afalse
B300
Cyul
Dtrue
Attempts:
3 left
💡 Hint
Common Mistakes
Setting optimizer to false disables optimization.
Using runs less than 300 for this example.
Missing 'yul' detail option.