Skip to content

Commit 7ce0bb3

Browse files
authored
Merge pull request #208 from Developer-DAO/quiz-lesson-4
Lesson 4. Enhance intro; add mini-quizzes; final quiz
2 parents 68db246 + 14f4b9f commit 7ce0bb3

File tree

27 files changed

+881
-164
lines changed

27 files changed

+881
-164
lines changed

pages/lessons/projects/4.mdx

Lines changed: 222 additions & 164 deletions
Large diffs are not rendered by default.
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"question": "Choose the reasons for using automated tests:",
3+
"options": [
4+
{
5+
"answer": "Warns of regressions if we upgrade code later",
6+
"correct": true
7+
},
8+
{
9+
"answer": "So we don’t have to use manual tests"
10+
},
11+
{
12+
"answer": "Build confidence in each component of our code",
13+
"correct": true
14+
},
15+
{
16+
"answer": "All of the above"
17+
}
18+
]
19+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"question": "What is the role of a testnet in smart contract development?",
3+
"options": [
4+
{
5+
"answer": "It helps to deploy smart contracts to the Ethereum mainnet."
6+
},
7+
{
8+
"answer": "To airdrop free Ether to devs, because testing gives the ecosystem a good name."
9+
},
10+
{
11+
"answer": "It's used to interact with smart contracts using real Ether."
12+
},
13+
{
14+
"answer": "It's a network that is used for testing smart contracts.",
15+
"correct": true
16+
}
17+
]
18+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"question": "What is the purpose of the 'require' statement in Solidity?",
3+
"options": [
4+
{
5+
"answer": "For specifying the visibility of a variable or function."
6+
},
7+
{
8+
"answer": "To be able to easily define a new modifier in the contract whenever we need it."
9+
},
10+
{
11+
"answer": "For declaring a new function in the contract."
12+
},
13+
{
14+
"answer": "To perform a conditional check, and revert the transaction if it fails.",
15+
"correct": true
16+
}
17+
]
18+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"question": "When writing unit tests for a smart contract, what should we be testing?",
3+
"options": [
4+
{
5+
"answer": "Functionality that only involves external contracts"
6+
},
7+
{
8+
"answer": "Only private functions that aren't externally accessible"
9+
},
10+
{
11+
"answer": "All functions and possible edge cases that the contract may encounter",
12+
"correct": true
13+
},
14+
{
15+
"answer": "Just the constructor function to ensure the contract gets deployed properly"
16+
}
17+
]
18+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"question": "What do you imagine one of the first steps is in this lesson?",
3+
"options": [
4+
{
5+
"answer": "To add your private key to the .gitignore file"
6+
},
7+
{
8+
"answer": "To harmonise Solidity versions across the project",
9+
"correct": true
10+
},
11+
{
12+
"answer": "To make sure to add an extra line of code to the contract to signal to Hardhat that we can test it"
13+
},
14+
{
15+
"answer": "To create a console.log line to the contract code so we can see the output of the tests"
16+
}
17+
]
18+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"question": "Which of the following can we achieve with automated testing?",
3+
"options": [
4+
{
5+
"answer": "Prove code actually works"
6+
},
7+
{
8+
"answer": "Help write more modular code"
9+
},
10+
{
11+
"answer": "Ensure a fixed bug stays fixed"
12+
},
13+
{
14+
"answer": "All of the above",
15+
"correct": true
16+
},
17+
{
18+
"answer": "Only a) and c)"
19+
}
20+
]
21+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"question": "How does the tokenURI function generate the token metadata?",
3+
"options": [
4+
{
5+
"answer": "By reading from an external file"
6+
},
7+
{
8+
"answer": "By using a predefined JSON template"
9+
},
10+
{
11+
"answer": "By dynamically generating SVG image and JSON data",
12+
"correct": true
13+
},
14+
{
15+
"answer": "By querying an off-chain API"
16+
}
17+
]
18+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"question": "What should be added to the scripts section of package.json to run tests using Hardhat?",
3+
"options": [
4+
{
5+
"answer": "\"scripts\": { \"test\": \"hardhat test\" }"
6+
},
7+
{
8+
"answer": "\"scripts\": { \"runTests\": \"hardhat test\" }"
9+
},
10+
{
11+
"answer": " \"scripts\": { \"test\": \"hardhat test --network hardhat\" }",
12+
"correct": true
13+
},
14+
{
15+
"answer": "\"scripts\": { \"runTests\": \"hardhat test --network hardhat\" }"
16+
}
17+
]
18+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"question": "Why should we verify the Solidity version in the hardhat.config.js file?",
3+
"options": [
4+
{
5+
"answer": "So it can check for any updates to the Solidity version"
6+
},
7+
{
8+
"answer": "To ensure compatibility with the contract being tested.",
9+
"correct": true
10+
},
11+
{
12+
"answer": "a) and b)"
13+
},
14+
{
15+
"answer": "neither a) nor b)"
16+
}
17+
]
18+
}

0 commit comments

Comments
 (0)