|
1 | 1 | {
|
2 | 2 | "title": "Quiz: Lesson 4",
|
3 | 3 | "questions": [
|
| 4 | + { |
| 5 | + "question": "Choose those which automated testing of smart contracts can help achieve?", |
| 6 | + "options": [ |
| 7 | + { |
| 8 | + "answer": "Faster development and deployment process." |
| 9 | + }, |
| 10 | + { |
| 11 | + "answer": "Finding every possible bug and vulnerability." |
| 12 | + }, |
| 13 | + { |
| 14 | + "answer": "Improving the overall code quality.", |
| 15 | + "correct": true |
| 16 | + }, |
| 17 | + { |
| 18 | + "answer": "Ensuring the smart contract is free of errors.", |
| 19 | + "correct": true |
| 20 | + } |
| 21 | + ] |
| 22 | + }, |
4 | 23 | {
|
5 | 24 | "question": "Which testing approach is recommended for ensuring a secure smart contract?",
|
6 | 25 | "options": [
|
|
20 | 39 | ]
|
21 | 40 | },
|
22 | 41 | {
|
23 |
| - "question": "What can automated testing of smart contracts help achieve?", |
| 42 | + "question": "Which three variables did we define with the 'let' keyword to use in our test suite?", |
24 | 43 | "options": [
|
25 | 44 | {
|
26 |
| - "answer": "Faster development and deployment process." |
| 45 | + "answer": "tokenTier, tierID, onlyOwner." |
27 | 46 | },
|
28 | 47 | {
|
29 |
| - "answer": "Finding every possible bug and vulnerability." |
| 48 | + "answer": "symbol, collection, provider." |
30 | 49 | },
|
31 | 50 | {
|
32 |
| - "answer": "Improving the overall code quality.", |
| 51 | + "answer": "otherUser, contract, owner.", |
33 | 52 | "correct": true
|
| 53 | + } |
| 54 | + ] |
| 55 | + }, |
| 56 | + { |
| 57 | + "question": "During testing, which role does the 'beforeEach' function serve in the test suite?", |
| 58 | + "options": [ |
| 59 | + { |
| 60 | + "answer": "It deploys a new instance of the contract before executing each test case." |
34 | 61 | },
|
35 | 62 | {
|
36 |
| - "answer": "Ensuring the smart contract is free of errors.", |
| 63 | + "answer": "It sets up the testing environment, and initializes contract variables once before all test cases.", |
| 64 | + "correct": true |
| 65 | + }, |
| 66 | + { |
| 67 | + "answer": "It performs cleanup tasks after each test case is executed." |
| 68 | + }, |
| 69 | + { |
| 70 | + "answer": "It executes the contract's constructor function before running any tests." |
| 71 | + } |
| 72 | + ] |
| 73 | + }, |
| 74 | + { |
| 75 | + "question": "In the context of our testing, what role does 'describe' play?", |
| 76 | + "options": [ |
| 77 | + { |
| 78 | + "answer": "It describes the purpose of the smart contract." |
| 79 | + }, |
| 80 | + { |
| 81 | + "answer": "It organises and groups related tests together.", |
| 82 | + "correct": true |
| 83 | + }, |
| 84 | + { |
| 85 | + "answer": "It handles asynchronous operations in the test suite." |
| 86 | + } |
| 87 | + ] |
| 88 | + }, |
| 89 | + { |
| 90 | + "question": "The role of the 'it' function in a test suite is to:", |
| 91 | + "options": [ |
| 92 | + { |
| 93 | + "answer": "organise and group related tests together." |
| 94 | + }, |
| 95 | + { |
| 96 | + "answer": "irritate the knights formerly known as The Knights of Ni" |
| 97 | + }, |
| 98 | + { |
| 99 | + "answer": "define an individual test case or scenario.", |
37 | 100 | "correct": true
|
| 101 | + }, |
| 102 | + { |
| 103 | + "answer": "handle asynchronous operations in the test suite." |
38 | 104 | }
|
39 | 105 | ]
|
40 | 106 | },
|
41 | 107 | {
|
42 |
| - "question": "Which best describes 'gas' in the context of smart contracts?", |
| 108 | + "question": "How is 'expect' used to verify test results?", |
43 | 109 | "options": [
|
44 | 110 | {
|
45 |
| - "answer": "The cost of deploying a smart contract on the blockchain." |
| 111 | + "answer": "It waits for the test cases for the entire suite of tests." |
46 | 112 | },
|
47 | 113 | {
|
48 |
| - "answer": "The unit of currency used in smart contract transactions." |
| 114 | + "answer": "It groups multiple tests together under one description." |
49 | 115 | },
|
50 | 116 | {
|
51 |
| - "answer": "A measure of the computational effort required to execute a transaction or contract.", |
| 117 | + "answer": "It waits for an asynchronous call to complete, and returns the result." |
| 118 | + }, |
| 119 | + { |
| 120 | + "answer": "It compares the actual result with the anticipated outcome to check if they match.", |
| 121 | + "correct": true |
| 122 | + } |
| 123 | + ] |
| 124 | + }, |
| 125 | + { |
| 126 | + "question": "In the 'withdraw()' tests, what do the 'await contract.mint()' calls before each test ensure?", |
| 127 | + "options": [ |
| 128 | + { |
| 129 | + "answer": "The contract owner's wallet balance is increased.", |
52 | 130 | "correct": true
|
53 | 131 | },
|
54 | 132 | {
|
55 |
| - "answer": "The reward given to validators for running a validator node." |
| 133 | + "answer": "The 'withdraw()' function can be executed successfully." |
| 134 | + }, |
| 135 | + { |
| 136 | + "answer": "The contract has enough Ether to allow withdrawal." |
| 137 | + }, |
| 138 | + { |
| 139 | + "answer": "The contract has at least one minted TierNFT.", |
| 140 | + "correct": true |
56 | 141 | }
|
57 | 142 | ]
|
58 | 143 | },
|
59 | 144 | {
|
60 |
| - "question": "What are some potential risks of deploying a smart contract without proper testing?", |
| 145 | + "question": "What is the purpose of refactoring the original 'tokenURI()' method into helper functions?", |
61 | 146 | "options": [
|
62 | 147 | {
|
63 |
| - "answer": "Loss of funds", |
| 148 | + "answer": "To optimize contract performance." |
| 149 | + }, |
| 150 | + { |
| 151 | + "answer": "To maintain backward compatibility." |
| 152 | + }, |
| 153 | + { |
| 154 | + "answer": "To make the tokenURI() method more testable and maintainable.", |
64 | 155 | "correct": true
|
| 156 | + } |
| 157 | + ] |
| 158 | + }, |
| 159 | + { |
| 160 | + "question": "Why is it beneficial to have tests for the helper functions?", |
| 161 | + "options": [ |
| 162 | + { |
| 163 | + "answer": "To receive gas refunds" |
| 164 | + }, |
| 165 | + { |
| 166 | + "answer": "To decrease the number of transactions" |
| 167 | + }, |
| 168 | + { |
| 169 | + "answer": "To ensure the correctness and reliability of the smart contract's behavior.", |
| 170 | + "correct": true |
| 171 | + }, |
| 172 | + { |
| 173 | + "answer": "To optimize the contract deployment process" |
| 174 | + } |
| 175 | + ] |
| 176 | + }, |
| 177 | + { |
| 178 | + "question": "Why is it essential to test the original 'tokenURI()' method before and after refactoring?", |
| 179 | + "options": [ |
| 180 | + { |
| 181 | + "answer": "To verify that the helper functions are working correctly" |
| 182 | + }, |
| 183 | + { |
| 184 | + "answer": "To ensure that the refactoring did not introduce bugs or alter functionality", |
| 185 | + "correct": true |
| 186 | + }, |
| 187 | + { |
| 188 | + "answer": "To test cross-browser compatibility" |
| 189 | + }, |
| 190 | + { |
| 191 | + "answer": "To measure performance improvements" |
| 192 | + } |
| 193 | + ] |
| 194 | + }, |
| 195 | + { |
| 196 | + "question": "Why is it essential to ensure that tests fail before they pass?", |
| 197 | + "options": [ |
| 198 | + { |
| 199 | + "answer": "To verify that the test environment is set up correctly." |
65 | 200 | },
|
66 | 201 | {
|
67 |
| - "answer": "Security vulnerabilities", |
| 202 | + "answer": "To identify potential bugs in the smart contract code.", |
68 | 203 | "correct": true
|
69 | 204 | },
|
70 | 205 | {
|
71 |
| - "answer": "Lengthy deployment process" |
| 206 | + "answer": "To make the process of writing tests faster and more efficient." |
72 | 207 | },
|
73 | 208 | {
|
74 |
| - "answer": "Inefficient gas usage" |
| 209 | + "answer": "To confirm that the contract owner can withdraw funds." |
75 | 210 | }
|
76 | 211 | ]
|
77 | 212 | }
|
|
0 commit comments