Unit 5 - Practice Quiz

CSC203

1 Who proposed the Ethereum platform in a white paper published in late 2013?

A. Satoshi Nakamoto
B. Vitalik Buterin
C. Nick Szabo
D. Gavin Wood

2 What is the primary unit of computation cost in the Ethereum Virtual Machine (EVM)?

A. Ether
B. Wei
C. Gas
D. Gwei

3 Which of the following best describes the Turing Completeness of the Ethereum Virtual Machine?

A. It can only calculate financial transactions.
B. It can solve any computational problem given enough resources (time and memory).
C. It is restricted to stateless scripting like Bitcoin.
D. It cannot execute loops or complex logic.

4 What mechanism does Ethereum use to solve the Halting Problem associated with Turing-complete languages?

A. Time-locks
B. Gas limits
C. Proof of Work
D. Static Analysis

5 In the context of Smart Contracts vs. Legal Contracts, what does the phrase "Code is Law" imply?

A. Smart contracts are recognized by all international courts.
B. The code will execute exactly as written, regardless of the developer's original intent or external legal frameworks.
C. Lawyers must write the code for it to be valid.
D. Smart contracts can only be used for criminal justice applications.

6 Which of the following is a primary difference between Bitcoin Scripting and Ethereum Smart Contracts?

A. Bitcoin script is Turing complete; Ethereum is not.
B. Bitcoin script is stack-based and generally stateless; Ethereum is stateful.
C. Bitcoin supports loops; Ethereum does not.
D. Bitcoin uses Solidity; Ethereum uses C++.

7 What is the primary file extension used for Solidity source code?

A. .eth
B. .js
C. .sol
D. .py

8 In Solidity, what constitutes the state of a smart contract?

A. The functions defined in the contract.
B. The variables declared at the contract level (storage variables).
C. The local variables inside functions.
D. The gas price at the time of execution.

9 Which of the following correctly defines Formal Verification in the context of smart contracts?

A. Checking the code for syntax errors using a compiler.
B. Using mathematical proofs to ensure the code behaves exactly as specified.
C. Having a lawyer read the code manually.
D. Running the code on a testnet before mainnet.

10 What is the smallest denomination of Ether?

A. Finney
B. Szabo
C. Gwei
D. Wei

11 Which data location in Solidity represents persistent storage on the blockchain?

A. memory
B. calldata
C. storage
D. stack

12 How does Bitcoin's UTXO model differ from Ethereum's Account model regarding balance management?

A. Bitcoin calculates balances by summing unspent outputs; Ethereum stores balances directly in accounts.
B. Bitcoin stores balances in accounts; Ethereum sums unspent outputs.
C. Both use the UTXO model.
D. Both use the Account model.

13 What keyword is used in Solidity to allow a function to receive Ether?

A. money
B. transferable
C. payable
D. accept

14 When writing a smart contract in Solidity, what is the purpose of the pragma directive?

A. To import JavaScript libraries.
B. To define the gas limit.
C. To specify the compiler version compatibility.
D. To declare the contract owner.

15 Which global variable in Solidity contains the address of the person (or contract) calling the function?

A. tx.origin
B. msg.sender
C. this.address
D. msg.value

16 Why is verification of smart contracts significantly harder than verification of Bitcoin scripts?

A. Bitcoin scripts are longer.
B. Ethereum smart contracts can have complex loops, state changes, and external calls.
C. Solidity is an older language than Bitcoin Script.
D. Bitcoin scripts are encrypted.

17 Which JavaScript library is commonly used to interact with the Ethereum blockchain?

A. React.js
B. Web3.js
C. Node.js
D. JQuery

18 What is the ABI (Application Binary Interface) in the context of Ethereum?

A. The machine code stored on the blockchain.
B. A JSON description of the contract's functions and events needed for interaction.
C. The address of the contract.
D. The private key of the developer.

19 What happens if a Solidity function requires more gas than the transaction's gas limit?

A. The transaction pauses and waits for more gas.
B. The transaction succeeds but is slower.
C. The transaction reverts, and all changes are undone, but the gas is consumed.
D. The transaction is mined with a special flag.

20 Which Solidity data type represents a hash map or dictionary?

A. array
B. struct
C. mapping
D. enum

21 In terms of legal enforcement, a major challenge for smart contracts is:

A. They cannot handle digital assets.
B. They are too slow.
C. They lack the ability to handle subjective ambiguity or 'spirit of the law'.
D. They require a third party to execute.

22 What is the purpose of the constructor function in a Solidity contract?

A. To destroy the contract.
B. To execute code only once when the contract is deployed.
C. To allow users to pay the contract.
D. To update the contract code.

23 What is a re-entrancy attack?

A. Stealing a private key.
B. A malicious contract calling back into the calling contract before the first invocation is finished.
C. Mining a block faster than others.
D. Guessing the nonce of a transaction.

24 Which of the following is NOT a valid visibility modifier in Solidity?

A. public
B. external
C. internal
D. protected

25 What is the distinction between view and pure functions in Solidity?

A. view reads state but doesn't modify it; pure neither reads nor modifies state.
B. pure reads state; view modifies state.
C. Both modify state.
D. They are identical.

26 In the Ethereum EVM, what are Opcodes?

A. The passwords for accounts.
B. Low-level machine instructions (e.g., PUSH, POP, ADD) that Solidity compiles into.
C. The names of the miners.
D. JavaScript functions.

27 What does the require(condition, message) function do in Solidity?

A. It logs a message to the console.
B. It checks a condition; if false, it reverts the transaction and refunds remaining gas.
C. It checks a condition; if false, it consumes all gas and crashes.
D. It is used to import libraries.

28 Unlike Bitcoin, Ethereum distinguishes between two types of accounts. What are they?

A. Admin Accounts and User Accounts.
B. Externally Owned Accounts (EOA) and Contract Accounts.
C. Savings Accounts and Checking Accounts.
D. Miners and Validators.

29 Which Solidity keyword is used to create a custom error logging mechanism on the blockchain?

A. log
B. print
C. event
D. alert

30 In a JavaScript application using Web3, what is a Provider?

A. The person paying for the gas.
B. The library used to compile Solidity.
C. The connection object that allows the library to communicate with an Ethereum node.
D. The smart contract address.

31 Why creates the 'Oracle Problem' in smart contracts?

A. Smart contracts cannot natively access external data (off-chain) like weather or stock prices.
B. Oracles are too expensive.
C. Smart contracts cannot perform math.
D. Oracles slow down the blockchain.

32 Which of the following Solidity snippets defines a fixed-size array of 10 integers?

A. uint[] x = 10;
B. uint[10] x;
C. array<uint, 10> x;
D. uint x(10);

33 What is the implication of Ethereum being a 'Stateful' protocol compared to Bitcoin?

A. Ethereum transactions depend only on previous outputs.
B. Ethereum keeps a record of the current status of all accounts and contracts, updated by transactions.
C. Ethereum does not use a blockchain.
D. Ethereum state is reset every block.

34 Which function is automatically executed when a contract receives Ether without data?

A. fallback()
B. receive()
C. deposit()
D. main()

35 In Solidity, what is a Modifier?

A. A person who changes the code.
B. A reusable piece of code that can change the behavior of functions (e.g., checks preconditions).
C. A variable type.
D. A compiler setting.

36 What is the relationship between Gas Price, Gas Limit, and Transaction Fee?

A.
B.
C.
D.

37 Which of the following is true regarding Immutability and legal contracts on the blockchain?

A. If a smart contract has a legal error, a court can easily edit the code.
B. Immutability ensures that once deployed, the contract logic cannot be altered, even if it contains illegal terms.
C. Smart contracts automatically update to reflect new laws.
D. Immutability only applies to Bitcoin, not Ethereum.

38 What is Remix in the context of Ethereum development?

A. A new cryptocurrency.
B. A browser-based IDE (Integrated Development Environment) for writing and deploying Solidity.
C. A JavaScript library.
D. A layer-2 scaling solution.

39 Which Solidity type is essentially a 20-byte value?

A. uint256
B. bool
C. address
D. bytes32

40 What is the nonce in an Ethereum account used for?

A. Proof of work calculation.
B. To prevent replay attacks and order transactions from the same sender.
C. To store the account balance.
D. To encrypt the private key.

41 If you want to store a string in Solidity that you do not intend to change, which keyword optimizes gas usage?

A. static
B. constant
C. final
D. volatile

42 Bitcoin uses a Forth-like reverse polish notation scripting system. What does this mean for loops?

A. It supports infinite loops.
B. It does not support loops (is not Turing complete).
C. It supports 'while' loops but not 'for' loops.
D. It uses recursive loops.

43 How do you access the amount of Ether sent with a transaction inside a Solidity function?

A. msg.gas
B. msg.sender
C. msg.value
D. msg.data

44 Which keyword allows a Solidity contract to inherit properties and functions from another contract?

A. extends
B. implements
C. is
D. inherits

45 In Ethereum, what allows code to perform complex mathematical calculations that Bitcoin script cannot easily do?

A. Larger block size.
B. Turing-complete EVM with a rich instruction set.
C. Faster block times.
D. Proof of Stake.

46 What is the main security risk of using tx.origin for authentication in Solidity?

A. It is always zero.
B. It returns the contract address.
C. It makes the contract vulnerable to phishing (man-in-the-middle) attacks.
D. It costs too much gas.

47 Which data structure is typically used to create a custom data type with multiple properties in Solidity?

A. enum
B. struct
C. mapping
D. interface

48 What does the selfdestruct(recipient) function do?

A. It deletes the contract bytecode from the blockchain and sends remaining Ether to the recipient.
B. It pauses the contract.
C. It deletes the recipient's account.
D. It burns the Ether inside the contract.

49 When interacting with a smart contract via JavaScript, what is the difference between call and send?

A. call is for read-only operations (no gas); send is for state-changing transactions (requires gas).
B. call requires gas; send is free.
C. call is slower than send.
D. There is no difference.

50 Which standard ensures that different smart contracts (like tokens) can interact with each other predictably?

A. ISO 9001
B. ERC Standards (e.g., ERC-20, ERC-721)
C. IEEE Standards
D. W3C Standards