# Quiz

{% embed url="https://ventral.digital/posts/2021/10/17/secureum-bootcamp-ethereum-101-quiz" %}

**Q1 Ethereum Virtual Machine is a**

* [ ] A) Register-based virtual machine
* [x] B) Stack-based virtual machine
* [ ] C) Heap-based virtual machine
* [ ] D) Stackless virtual machine

**Q2 The length of addresses on Ethereum is**

* [ ] A) 256 bits
* [x] B) 20 bytes
* [ ] C) Depends on Externally-Owned-Account or Contract address
* [ ] D) Configurable

**Q3 The types of accounts on Ethereum are**

* [ ] A) All Accounts are the same
* [ ] B) Permissioned Accounts and Permissionless Accounts
* [x] C) Externally-Owned-Accounts and Contract Accounts
* [ ] D) User Accounts and Admin Accounts

**Q4 The difference(s) between Bitcoin and Ethereum is/are**

* [x] A) The underlying tokens: Bitcoin vs Ether
* [x] B) Smart contract support
* [x] C) UTXO vs Accounts
* [ ] D) Nakamoto Consensus

**Q5 Ethereum smart contracts do not run into halting problem because**

* [ ] A) EVM is not Turing Complete
* [ ] B) EVM is Turing Complete
* [x] C) EVM is Turing Complete but is bounded by gas sent in transaction
* [ ] D) EVM is Turing Complete but is bounded by the stack depth

**Q6 Ethereum nodes talk to each other via**

* [x] A) Peer-to-Peer network
* [ ] B) Client-Server network
* [ ] C) Satellite network
* [ ] D) None of the above

**Q7 A nonce is present in**

* [ ] A) Ethereum transaction
* [ ] B) Ethereum account
* [x] C) Both A & B
* [ ] D) Neither A nor B

**Q8 The gas tracking website** [**https://etherscan.io/gastracker**](https://etherscan.io/gastracker) **says that Low gas cost is 40 wei This affects**

* [x] A) The transaction gasPrice
* [ ] B) The transaction gasLimit
* [ ] C) The transaction value
* [ ] D) Both B & C

**Q9 The number of transactions in a Ethereum block depend on**

* [ ] A) Nothing. It is a constant.
* [x] B) Gas used by transactions
* [x] C) Block gas limit
* [ ] D) Block difficulty

**Q10 Miners are responsible for setting**

* [ ] A) Transaction gas price
* [x] B) Block gas limit
* [ ] C) Both A & B
* [ ] D) Neither A nor B

**Q11 User A sends transaction T1 from address A1 with gasPrice G1 and later transaction T2 from address A2 with gasPrice G2**

* [ ] A) T1 will be always included in an earlier block than T2
* [ ] B) Inclusion/Ordering of these transactions depends only on gas prices G1 and G2
* [ ] C) Inclusion/Ordering of these transactions depends only on network congestion
* [x] D) Inclusion/Ordering of these transactions depends on miners

**Q12 Which of the following statements is/are true about gas?**

* [ ] A) Unused gas is returned to the transaction destination account -> returned to the sender's address
* [x] B) Gas used by the transaction is credited to the beneficiary address in block header
* [ ] C) Unused gas is credited to the beneficiary address in block header
* [ ] D) Both A & B

**Q13 Which of the following EVM components is/are non-volatile across transactions?**

* [ ] A) Stack
* [ ] B) Memory
* [x] C) Storage
* [ ] D) Calldata

**Q14 Which of the following operation(s) touch(es) storage?**

* [ ] A) SWAP -> stack
* [x] B) SLOAD
* [ ] C) DUP -> stack
* [ ] D) PUSH -> stack

<mark style="color:red;">**Q15 Which of the following statement(s) is/are false?**</mark>

* [ ] A) EVM can get the block number only of the current block
* [x] B) EVM can get the block hash only of the current block
* [x] C) EVM can get the account balance only of the current account
* [x] D) EVM can get the code hash only of the current account

**Comment:**

> `0x31` BALANCE 1 1 Get balance of the given account\
> `0x3f` EXTCODEHASH 1 1 Get hash of an account’s code\
> `0x40` BLOCKHASH 1 1 Get the hash of one of the **256 most recent complete blocks**\
> `0x43` NUMBER 0 1 Get the block’s number

from points 70, 71 of [Ethereum 101 - by Secureum](https://secureum.substack.com/p/ethereum-101)

<mark style="color:red;">**Q16 Which of the following information cannot be obtained in the EVM?**</mark>

* [ ] A) Block difficulty
* [x] B) Transaction logs
* [ ] C) Balance of an account
* [x] D) Block hash of any block

**Comment:**

> `0x31` BALANCE 1 1 Get balance of the given account\
> `0x40` BLOCKHASH 1 1 Get the hash of one of the **256 most recent complete blocks**\
> `0x44` DIFFICULTY 0 1 Get the block’s difficulty

(there's no operation to access transaction logs)

from points 70, 71 of [Ethereum 101 - by Secureum](https://secureum.substack.com/p/ethereum-101)

<mark style="color:red;">**Q17 Which call instruction could be used to allow modifying the caller account’s state?**</mark>

* [ ] A) CALL
* [x] B) CALLCODE
* [ ] C) DELEGATECALL
* [x] D) STATICALL

**Comment:**

> `0xf1` CALL 7 1 Message-call into an account\
> `0xf2` CALLCODE 7 1 Message-call into this account with an alternative account’s code\
> `0xf4` DELEGATECALL 6 1 Message-call into this account with an alternative account’s code, but persisting the current values for sender and value\
> `0xfa` STATICCALL 6 1 Static message-call into an account

from point 77 of [Ethereum 101 - by Secureum](https://secureum.substack.com/p/ethereum-101)

> Another variant of call is delegatecall, which replaced the more dangerous callcode. \[...] Essentially, delegatecall runs the code of another contract inside the context of the execution of the current contract.

from "Calling Other Contracts (send, call, callcode, delegatecall)" of [Mastering Ethereum](https://github.com/ethereumbook/ethereumbook/blob/17750561f706f50c9719d0ea495c0822e3843a41/07smart-contracts-solidity.asciidoc#calling-other-contracts-send-call-callcode-delegatecall)

> Permits non-state-changing calls to itself or other contracts while disallowing any modifications to state during the call (and its subcalls, if present) to increase smart contract security and assure developers that re-entrancy bugs cannot arise from the call.

from "Appendix A: Ethereum Standards" of [Mastering Ethereum](https://github.com/ethereumbook/ethereumbook/blob/05f0dfe6c41635ac85527a60c06ac5389d8006e7/appdx-standards-eip-erc.asciidoc)

**Q18 The most gas-expensive operation is**

* [ ] A) SLOAD
* [ ] B) SSTORE
* [x] C) CREATE
* [ ] D) SELFDESTRUCT

**Q19 Transaction T1 attempts to write to storage values S1 and S2 of contract C. Transaction T2 attempts to read the same storage values S1 and S2. However, T1 reverts due an exception after writing S1 but before writing S2. Which of the following is/are true?**

* [ ] A) T2 reads the value of S1 updated by T1
* [x] B) T2 reads the value of S1 prior to T1’s attempted update
* [ ] C) T2 also reverts because of the dependency on T1
* [ ] D) This scenario is not possible

**Q20 Ethereum’s threat model is characterised by**

* [ ] A) Trusted miners and users
* [ ] B) Trusted users, untrusted miners
* [ ] C) Trusted miners, untrusted users
* [x] D) Everyone is untrusted

<mark style="color:red;">**Q21 The number of modified Merkle-Patricia trees in an Ethereum block is**</mark>

* [ ] A) One
* [ ] B) Three
* [x] C) Three plus number of contract accounts -> stateRoot, transactionsRoot and receiptsRoot, plus one for each contract account
* [ ] D) Three plus number of transactions included in the block

**Comment:**

> Blocks contain block header, transactions and ommers’ block headers. Block header contains \[...] \`stateRoot\`, \`transactionsRoot\` and \`receiptsRoot\` are 256-bit hashes of the root nodes of modified Merkle-Patricia trees.

from points 53, 54 of [Ethereum 101 - by Secureum](https://secureum.substack.com/p/ethereum-101)

**Q22 EVM is not a von Neumann architecture because**

* [ ] A) It was co-founded by Vitalik Buterin, not John von Neumann
* [x] B) Program instructions are stored separately from data
* [ ] C) Program instructions are stored in a ROM not RAM
* [ ] D) It is quasi Turing complete

**Q23 EVM stores**

* [x] A) Most significant byte in the smallest memory address
* [ ] B) Most significant byte in the largest memory address
* [x] C) In Big-endian order
* [ ] D) In Little-endian order

**Q24 Miners are incentivized to validate and create new blocks by**

* [x] A) Block rewards
* [ ] B) Altruism
* [x] C) Transaction fees
* [ ] D) Their belief in decentralization

**Q25 Hardfork on Ethereum**

* [ ] A) Has never happened
* [ ] B) Happened only once after the DAO attack
* [x] C) Happens with backwards-incompatible protocol changes
* [ ] D) Happens when developers and miners disagree on changes

**Q26 Gas for EVM opcodes**

* [ ] A) Is constant and the same for all opcodes
* [x] B) May be changed over time to prevent DoS attacks
* [ ] C) Depend on the gas price
* [ ] D) Depend on the miners

**Q27 Smart contracts on Ethereum**

* [x] A) May be deployed by anyone
* [ ] B) May be deployed only through the DApp store
* [x] C) May have some form of access control
* [ ] D) Are guaranteed to be secure

**Q28 EVM opcodes**

* [ ] A) Are multi-byte instructions
* [x] B) Are single byte instructions
* [ ] C) Take operands in registers
* [x] D) Take operands on stack

**Q29 Security of Ethereum DApps depend on**

* [x] A) Security of their smart contracts
* [x] B) Security of their off-chain components
* [x] C) Security of Ethereum
* [ ] D) None of the above

**Q30 Security Audits for smart contracts are performed because**

* [ ] A) They are required for listing DApp on the DApp store
* [ ] B) They are required for deployment on Ethereum
* [x] C) They help remove vulnerabilities and reduce risk
* [ ] D) They are required by exchanges to list tokens

**Q31 The high-level languages typically used for writing Ethereum smart contracts are**

* [ ] A) Go
* [ ] B) C++
* [x] C) Vyper
* [x] D) Solidity

**Q32 The number of decimals in Ether is**

* [ ] A) 0
* [ ] B) 1
* [x] C) 18
* [ ] D) Configurable
