Unit 5 - Practice Quiz

CSC203 60 Questions
0 Correct 0 Wrong 60 Left
0/60

1 What is Ethereum primarily known for being?

Ethereum and smart contracts Easy
A. A decentralized platform for running smart contracts
B. A centralized database for financial records
C. A digital currency for peer-to-peer payments only
D. A social media network on the blockchain

2 A 'smart contract' on Ethereum is best described as:

Ethereum and smart contracts Easy
A. A physical contract that is scanned and uploaded to a server
B. A computer program that automatically executes when certain conditions are met
C. A user's crypto wallet address and private key
D. A legal document written by lawyers and stored on the blockchain

3 What is the native cryptocurrency of the Ethereum network used to pay for transactions?

Ethereum and smart contracts Easy
A. Ether (ETH)
B. Ripple (XRP)
C. Litecoin (LTC)
D. Bitcoin (BTC)

4 In the context of Ethereum, what is the primary purpose of 'gas'?

Ethereum and smart contracts Easy
A. A unit to measure the computational effort required to execute an operation
B. A type of cryptocurrency token separate from Ether
C. To power the physical computers of miners
D. A password required to access a smart contract

5 What does it mean for a programming language like Solidity to be 'Turing-complete'?

The Turing completeness of smart contract languages and verification challenges Easy
A. It can be used to solve any computational problem, given enough resources
B. It can only perform a very limited set of operations
C. It was designed by the famous computer scientist Alan Turing
D. It is completely secure and free of bugs by design

6 A major security challenge arising from the Turing completeness of smart contracts is the possibility of:

The Turing completeness of smart contract languages and verification challenges Easy
A. Incompatibility with traditional legal systems
B. Contracts being too simple to be useful
C. Faster than expected transaction speeds
D. Infinite loops that could potentially consume all allocated gas

7 The 'Halting Problem' is a fundamental concept in computer science that proves it's impossible to:

The Turing completeness of smart contract languages and verification challenges Easy
A. Verify that a contract has enough gas to run
B. Create a program that can determine if any other program will finish or run forever
C. Build a computer that never crashes
D. Stop a smart contract once it has been deployed

8 What is the goal of 'formal verification' in smart contract development?

The Turing completeness of smart contract languages and verification challenges Easy
A. To automatically translate the code into multiple programming languages
B. To get legal approval for the smart contract's deployment
C. To make the code run faster on the EVM
D. To mathematically prove that the contract's code behaves as specified and is free of certain bugs

9 What does the principle 'code is law' mean in the context of smart contracts?

Using smart contracts to enforce legal contracts Easy
A. Developers can be sued for writing code with bugs
B. Smart contract code is legally binding in all jurisdictions worldwide
C. The execution of a smart contract is determined strictly by its code, without human interpretation
D. All software code must be reviewed by a lawyer before deployment

10 In the blockchain world, what is an 'oracle'?

Using smart contracts to enforce legal contracts Easy
A. A trusted service that provides external, real-world data to a smart contract
B. The original, genesis block of a blockchain
C. A special type of smart contract that can predict future cryptocurrency prices
D. A person who audits smart contract code for security flaws

11 What is a primary benefit of using a smart contract for an agreement like an escrow?

Using smart contracts to enforce legal contracts Easy
A. It requires a team of expensive lawyers to operate
B. It is easy to change the terms of the agreement after deployment
C. It eliminates the need for a trusted third-party intermediary, reducing costs
D. It allows for flexible, subjective interpretation of the agreement terms

12 What is a major challenge when trying to represent a traditional legal contract as a smart contract?

Using smart contracts to enforce legal contracts Easy
A. There is no way to store text in a smart contract
B. Most legal contracts are too short to be coded
C. Legal language often contains ambiguity and subjectivity, which is hard to translate into deterministic code
D. Smart contract programming languages are not powerful enough

13 A key difference between Bitcoin's scripting language and Ethereum's smart contract languages is that Bitcoin's script is intentionally:

Comparing Bitcoin scripting vs. Ethereum smart contracts Easy
A. Non-Turing-complete
B. Object-oriented
C. Encrypted
D. Turing-complete

14 Which of the following can be easily implemented with an Ethereum smart contract but is very difficult or impossible with Bitcoin's native script?

Comparing Bitcoin scripting vs. Ethereum smart contracts Easy
A. A decentralized autonomous organization (DAO)
B. A multi-signature wallet
C. A simple peer-to-peer payment
D. A time-locked transaction

15 What is the name of the sandboxed runtime environment where smart contracts are executed on the Ethereum network?

Comparing Bitcoin scripting vs. Ethereum smart contracts Easy
A. Docker Container
B. The Ethereum Virtual Machine (EVM)
C. The Java Virtual Machine (JVM)
D. Bitcoin Core

16 Compared to Ethereum's account-based model, Bitcoin's model is based on:

Comparing Bitcoin scripting vs. Ethereum smart contracts Easy
A. Unspent Transaction Outputs (UTXOs)
B. Smart contracts
C. Centralized ledgers
D. User profiles

17 What is the most popular, high-level programming language for writing smart contracts on Ethereum?

Writing smart contracts using Solidity & JavaScript Easy
A. Python
B. JavaScript
C. C#
D. Solidity

18 In a Solidity smart contract, what does the public visibility keyword for a state variable do?

Writing smart contracts using Solidity & JavaScript Easy
A. It ensures only the contract owner can modify the variable
B. It makes the variable a constant that cannot be changed
C. It encrypts the variable's data on the blockchain
D. It automatically creates a 'getter' function so its value can be read from outside the contract

19 Which of the following are popular JavaScript libraries used to interact with the Ethereum blockchain from a web application?

Writing smart contracts using Solidity & JavaScript Easy
A. Ethers.js and Web3.js
B. React and Vue
C. jQuery and Lodash
D. Node.js and Express

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

Writing smart contracts using Solidity & JavaScript Easy
A. It is a function that must be called in every transaction to the contract
B. To receive payments of Ether from users
C. It is a special function that is executed only once when the contract is first deployed
D. To destroy the contract and return funds

21 A smart contract deployed on Ethereum needs to be updated to fix a critical bug. What is the most common and accepted method to achieve this, considering the immutability of the blockchain?

Ethereum and smart contracts Medium
A. Deploy a new version of the contract and have users/other contracts migrate to the new address.
B. Submit a network-wide vote to overwrite the specific block containing the contract.
C. Use the selfdestruct function on the old contract, which automatically transfers its logic to a new address.
D. Directly edit the code of the deployed contract using a special transaction.

22 In Solidity, what is the key difference between functions marked with view and pure?

Writing smart contracts using Solidity & JavaScript Medium
A. view functions are for external calls only, while pure functions can only be called internally.
B. view functions consume gas when called externally, while pure functions do not.
C. view functions can read from the blockchain state but not modify it, while pure functions cannot even read from the state.
D. pure functions can read from state but not from memory, while view functions can read from both.

23 Which of the following functionalities is easily achievable with an Ethereum smart contract but is practically impossible with Bitcoin's native Script language?

Comparing Bitcoin scripting vs. Ethereum smart contracts Medium
A. Creating a decentralized autonomous organization (DAO) where members vote on proposals and funds are managed based on voting outcomes.
B. Creating a multi-signature wallet that requires 2-of-3 signatures to spend funds.
C. Executing a transaction that is only valid after a certain block height (timelock).
D. Verifying a cryptographic signature against a public key.

24 The concept of 'gas' in Ethereum is a direct solution to which problem introduced by Turing-complete smart contract languages?

The Turing completeness of smart contract languages and verification challenges Medium
A. The Halting Problem, by ensuring that any computation, including infinite loops, will eventually stop due to depleted resources.
B. The Byzantine Generals' Problem, by ensuring all nodes agree on the transaction fee.
C. The challenge of formal verification, by simplifying the contract's bytecode.
D. The problem of data privacy, by making expensive computations publicly visible.

25 What is the primary role of an 'oracle' when using a smart contract to execute the terms of a real-world agreement, such as a crop insurance policy?

Using smart contracts to enforce legal contracts Medium
A. To formally verify the smart contract code for bugs before deployment.
B. To provide reliable, off-chain data (e.g., weather reports) to the smart contract, triggering its execution.
C. To act as a legal arbitrator in case of a dispute between the parties.
D. To translate the legal prose of the contract into Solidity code.

26 A developer wants to notify a JavaScript frontend every time a new item is created in their smart contract. What is the most gas-efficient and standard way to achieve this in Solidity?

Writing smart contracts using Solidity & JavaScript Medium
A. Have the Solidity function return a special string value that the JavaScript frontend can parse.
B. Use the emit keyword to trigger a declared event, which the frontend can listen for.
C. Store a boolean flag in storage and have the JavaScript app poll this flag continuously.
D. Write a new transaction to the blockchain containing the notification message.

27 How does the state management in Ethereum's account-based model differ from Bitcoin's UTXO model?

Comparing Bitcoin scripting vs. Ethereum smart contracts Medium
A. Ethereum maintains a global state that maps addresses to account balances and storage, while Bitcoin's state is the set of all unspent transaction outputs (UTXOs).
B. Ethereum uses a 'first-in, first-out' queue for transactions, whereas Bitcoin uses a UTXO-based stack.
C. Bitcoin's UTXO model is stateful, tracking account history, while Ethereum's model is stateless, recalculating balances with each block.
D. Both systems use an identical account-based model, but Ethereum's is written in a more complex language.

28 A common vulnerability in early smart contracts was 're-entrancy'. This type of attack is a direct consequence of which feature of smart contract execution?

The Turing completeness of smart contract languages and verification challenges Medium
A. The ability of one contract to call another contract's public functions, combined with the execution order of state updates.
B. The use of assembly language within Solidity, which is inherently unsafe.
C. The immutability of contract code, which prevents patching the vulnerability.
D. The fixed gas limit for all transactions, which forces developers to write inefficient code.

29 What is the primary function of the Ethereum Virtual Machine (EVM)?

Ethereum and smart contracts Medium
A. To reach consensus on the order of blocks using a Proof-of-Work algorithm.
B. To manage the peer-to-peer network connections between Ethereum nodes.
C. To provide a sandboxed runtime environment for executing smart contract bytecode in a deterministic way across all nodes.
D. To compile Solidity and other high-level languages into machine code for a specific operating system.

30 A key challenge in mapping legal contracts to smart contracts is handling ambiguity. Which of the following legal clauses would be the most difficult to implement directly in a smart contract without an external arbitrator?

Using smart contracts to enforce legal contracts Medium
A. "Party A shall pay Party B 10 ETH on or before December 31st, 2024."
B. "Party A shall pay Party B if the goods are delivered in a 'satisfactory condition'."
C. "A penalty of 1 ETH per day shall be applied for each day the payment is late after the due date."
D. "The escrow shall release funds if signatures from both Party A and Party B are provided."

31 What happens to a transaction if it is submitted with a gas limit that is too low to complete its required computations?

Ethereum and smart contracts Medium
A. The transaction is partially executed, and the state changes made before the gas ran out are permanently saved to the blockchain.
B. The transaction executes as many steps as it can, then fails and reverts all state changes, but the gas fee is still consumed by the miner.
C. The miner who includes the transaction pays the remaining gas cost out of their block reward.
D. The transaction is rejected by the network and never included in a block, and the sender is refunded the gas fee.

32 Consider the following Solidity code snippet: uint256[] public data;. What is a potential risk associated with making an array of dynamic size public?

Writing smart contracts using Solidity & JavaScript Medium
A. Solidity automatically creates a getter function for it. If the array becomes very large, calling this getter function from an external contract could lead to an out-of-gas error.
B. The public visibility keyword is deprecated for arrays and will cause a compilation error.
C. Public arrays cannot store more than 256 elements, leading to unexpected data loss.
D. Making an array public allows anyone on the network to delete its elements without restriction.

33 What is the primary goal of 'formal verification' in the context of smart contract security?

The Turing completeness of smart contract languages and verification challenges Medium
A. To automatically generate unit tests that cover every possible execution path of the contract.
B. To run the smart contract on a test network with simulated attack scenarios.
C. To translate the smart contract's bytecode back into a high-level language for manual review.
D. To mathematically prove that the smart contract's code behaves exactly as intended and adheres to certain properties, eliminating entire classes of bugs.

34 Which statement best describes the difference in how transaction fees are calculated in Bitcoin versus Ethereum?

Comparing Bitcoin scripting vs. Ethereum smart contracts Medium
A. Ethereum fees are paid to a central entity, while Bitcoin fees are paid to miners.
B. Bitcoin transactions are free, while Ethereum transactions require a fee.
C. Ethereum fees are based on computational complexity (gas), while Bitcoin fees are primarily based on transaction size in bytes.
D. Bitcoin fees are a fixed percentage of the transaction amount, while Ethereum fees are dynamic based on network congestion.

35 The principle of 'Code is Law' suggests that the execution of a smart contract is the final and binding outcome. What is a significant practical and philosophical challenge to this principle?

Using smart contracts to enforce legal contracts Medium
A. It does not account for bugs or exploits in the code, which can lead to unintended outcomes that conflict with the original intent of the agreement.
B. It requires all parties to have advanced knowledge of cryptography.
C. It is incompatible with most modern programming languages like JavaScript and Python.
D. It cannot be implemented on public blockchains due to privacy concerns.

36 What is the difference between an Externally Owned Account (EOA) and a Contract Account on Ethereum?

Ethereum and smart contracts Medium
A. An EOA has an associated code hash, while a Contract Account does not.
B. Only Contract Accounts can send transactions, which are then signed by EOAs.
C. An EOA is controlled by a private key, while a Contract Account is controlled by its own code; only EOAs can initiate transactions.
D. A Contract Account can hold more ETH than an EOA.

37 A developer writes a Solidity function: function _doSomething() internal pure returns(uint) { ... }. What are the implications of the internal visibility modifier?

Writing smart contracts using Solidity & JavaScript Medium
A. The function is part of the contract's public ABI and can be called via a transaction, but only if the caller is another contract.
B. The function can only be called by the contract's owner.
C. The function is automatically inlined by the compiler to save gas.
D. The function can only be called from within the same contract or by contracts that inherit from it.

38 Why is Bitcoin's scripting language intentionally designed to be non-Turing-complete?

Comparing Bitcoin scripting vs. Ethereum smart contracts Medium
A. Because the creators lacked the technical ability to create a Turing-complete language at the time.
B. To ensure that all Bitcoin scripts could run on low-power hardware like mobile phones.
C. To make the language compatible with financial regulations that prohibit complex derivatives.
D. To enhance security by making transaction outcomes more predictable and preventing complex, potentially harmful programs like infinite loops.

39 Integer overflow and underflow vulnerabilities were common in early Solidity contracts. This problem arises because...

The Turing completeness of smart contract languages and verification challenges Medium
A. The EVM does not support floating-point arithmetic, forcing all calculations to use integers.
B. The Turing-complete nature of Solidity allows for recursive functions that can quickly exhaust the integer range.
C. EVM integers are of a fixed size (e.g., uint256), and operations that exceed the maximum or go below the minimum value wrap around without throwing an error.
D. Solidity's compiler automatically converts all integer types to uint8 to save gas, increasing the risk of overflow.

40 When a JavaScript DApp uses a library like web3.js to call a view function on a smart contract, how is this operation typically handled by an Ethereum node like Geth or Infura?

Writing smart contracts using Solidity & JavaScript Medium
A. The call is broadcast to the network as a zero-gas transaction for miners to execute and confirm.
B. A read-only block is temporarily created to simulate the function call.
C. The node executes the function on its local EVM instance using the current blockchain state and returns the result directly, without creating a transaction.
D. The JavaScript library simulates the EVM locally within the browser to get the result without contacting a node.

41 A proxy contract at address 0xP uses delegatecall to forward calls to an implementation contract V1. V1 has a single state variable: uint256 public value;. Later, the proxy is upgraded to a new implementation V2, which introduces a new variable at the first storage slot: address public owner;. An administrator calls a function on V2 via the proxy that is meant to set the owner variable. What is the most likely consequence of this operation on the proxy contract's state?

Writing smart contracts using Solidity & JavaScript Hard
A. The owner variable is set correctly in the proxy's storage context, and the original value variable is shifted to a new storage slot.
B. A new storage slot is allocated for the owner variable in the proxy, leaving the value variable untouched.
C. The value variable in the proxy's storage is overwritten with the new owner's address, likely leading to data corruption.
D. The transaction reverts because the storage layouts of the proxy and the V2 implementation are incompatible.

42 Given the Turing completeness of the EVM, the Halting Problem states that it's impossible to create a general algorithm that can determine if any arbitrary smart contract will finish running or loop forever. How does the Ethereum protocol pragmatically address this undecidable problem to prevent network-wide freezes?

The Turing completeness of smart contract languages and verification challenges Hard
A. By requiring all smart contracts to be formally verified and certified by a trusted committee before they can be deployed to the mainnet.
B. By implementing a 'gas' mechanism, where every computational step has a cost, and execution halts with an exception if the transaction runs out of its prepaid gas.
C. By using a sandboxed WebAssembly (WASM) environment that can formally prove termination for most contracts.
D. By enforcing a strict wall-clock time limit (e.g., 30 seconds) on transaction execution, after which the node terminates the process.

43 A key architectural difference between Bitcoin and Ethereum is their state model. Bitcoin uses the UTXO (Unspent Transaction Output) model, while Ethereum uses an account-based model. How does this difference fundamentally impact the ability to create complex, multi-party stateful applications like a decentralized exchange (DEX)?

Comparing Bitcoin scripting vs. Ethereum smart contracts Hard
A. There is no fundamental difference; building a DEX is equally complex on both platforms, but Ethereum has better developer tooling.
B. The UTXO model makes it extremely difficult to represent and update shared global state. A DEX requires a common state (liquidity pools, order books) that multiple agents interact with, which is natural in Ethereum's contract accounts but creates massive contention and complexity in the UTXO model.
C. Bitcoin's UTXO model is better for a DEX because it prevents the double-spending of assets more effectively than Ethereum's account model.
D. Ethereum's account model is less secure for a DEX because a single contract bug can compromise all user funds, whereas in the UTXO model, funds are segregated in individual outputs.

44 A smart contract is designed to automate payments for a supply chain agreement. A clause in the corresponding legal document states that payment is released upon "successful delivery of goods in satisfactory condition." What is the most profound challenge in encoding this clause into the deterministic logic of a smart contract?

Using smart contracts to enforce legal contracts Hard
A. The inability of Solidity to handle complex data types required to represent shipping manifests.
B. The risk of a 51% attack on the Ethereum network, which could revert the payment transaction after it has been confirmed.
C. The high gas cost associated with storing and verifying delivery confirmation data on the blockchain.
D. The 'Oracle Problem,' compounded by the subjectivity of 'satisfactory condition.' The contract cannot intrinsically know about real-world events or interpret ambiguous, subjective criteria, requiring a trusted external data source or a decentralized dispute resolution mechanism.

45 What is the primary function of the CREATE2 opcode (EIP-1014), and which of the following use-cases does it uniquely enable compared to the original CREATE opcode?

Ethereum and smart contracts Hard
A. CREATE2 reduces the gas cost of deployment by pre-calculating the contract address off-chain.
B. CREATE2 allows contracts to be deployed by other contracts, a feature not available with CREATE.
C. CREATE2 allows for the creation of upgradeable contracts by making it easier to change a contract's code after deployment.
D. CREATE2 enables 'counterfactual instantiation,' allowing users to send funds to a pre-determined address before any contract code is actually deployed there, with the guarantee that only specific code can ever exist at that address.

46 In Solidity, the tx.origin global variable provides the address of the Externally Owned Account (EOA) that originally started the transaction chain. Using require(tx.origin == owner) for authorization in a wallet contract is a known anti-pattern. Why is this check a severe security vulnerability?

Writing smart contracts using Solidity & JavaScript Hard
A. tx.origin is not guaranteed to be consistent across different Ethereum clients, leading to unpredictable behavior.
B. It is significantly more gas-expensive than checking msg.sender, leading to potential out-of-gas errors.
C. Future EIPs related to account abstraction are expected to deprecate tx.origin, making the contract obsolete.
D. It makes the wallet vulnerable to a phishing attack where the owner is tricked into calling a malicious intermediary contract, which then calls the wallet. The tx.origin check will pass, granting the malicious contract control.

47 Rice's Theorem, a fundamental result in computability theory, states that any non-trivial semantic property of programs is undecidable. How does this theorem directly apply to the automated security analysis of Ethereum smart contracts?

The Turing completeness of smart contract languages and verification challenges Hard
A. It guarantees that the EVM's state space is infinite, making full formal verification impractical.
B. It proves that no Solidity compiler can be completely free of bugs.
C. It implies that creating a universal tool that can definitively prove the absence or presence of a complex vulnerability (e.g., 'can this contract ever be re-entered?') for any possible smart contract is theoretically impossible.
D. It mandates that all smart contracts must include a gas limit to ensure termination.

48 When Contract A makes an external call to Contract B with a value transfer using address(B).call{value: v}(""), the EVM forwards a limited gas stipend of 2300 gas if a specific gas amount isn't provided. What is the primary security rationale behind this specific, low gas stipend?

Ethereum and smart contracts Hard
A. To minimize the overall gas cost of simple ether transfers between contracts, making the network more efficient.
B. To provide just enough gas for the recipient to emit a single event log, but not enough to perform a state-changing external call, thus mitigating most common reentrancy attacks.
C. To create a standardized gas cost for value transfers that simplifies the calculations for gas estimation tools.
D. To prevent the recipient contract from consuming all the gas of the parent call, which would cause the entire transaction to revert unnecessarily.

49 Bitcoin's OP_CHECKSIG opcode verifies a signature against a public key provided in the script. Ethereum has a similar capability via the ecrecover precompiled contract. What is a critical functional difference that allows ecrecover to enable complex mechanisms like meta-transactions, which are not natively possible with OP_CHECKSIG?

Comparing Bitcoin scripting vs. Ethereum smart contracts Hard
A. OP_CHECKSIG can only verify one signature per script, while ecrecover can be called multiple times within a single transaction to verify many signatures.
B. ecrecover is a precompiled contract, making its execution significantly faster and cheaper than the OP_CHECKSIG opcode.
C. ecrecover recovers the signer's public address directly from the signature hash and the message, whereas OP_CHECKSIG only verifies a signature against a known public key.
D. ecrecover supports more modern and efficient cryptographic signature schemes than OP_CHECKSIG.

50 A Solidity contract uses inline assembly (Yul) to directly manipulate memory. The code is as follows: function assemble() public pure returns (bytes memory) { bytes memory b = new bytes(64); assembly { mstore(add(b, 0x20), 0xFF) mstore(add(b, 0x40), 0xEE) } return b; }. What will be the hex value of the returned byte array?

Writing smart contracts using Solidity & JavaScript Hard
A. 0xFF0000...00EE (64 bytes long)
B. 0x0000...00FF0000...00EE (64 bytes long)
C. The function will revert because memory outside the allocated length is accessed.
D. 0x0000...00FF followed by 31 zero bytes, then 0x0000...00EE followed by 31 zero bytes.

51 What is the defining characteristic of a Ricardian Contract that distinguishes it from a standard Ethereum smart contract coupled with an off-chain legal agreement?

Using smart contracts to enforce legal contracts Hard
A. Ricardian Contracts are written in a legally-enforceable programming language like DAML.
B. Ricardian Contracts are mutable and can be amended by a court order, whereas smart contracts are immutable.
C. A Ricardian Contract is a single, integrated object that is both a human-readable legal document and machine-readable code, cryptographically binding the two together, often by hashing the legal text and including it in the code.
D. Ricardian Contracts can only be executed on permissioned blockchains that have a built-in legal framework and identity layer.

52 A developer writes a function process(uint256[] calldata items) that iterates through the items array to perform a calculation. While this loop is not infinite, it introduces a significant Denial of Service (DoS) vulnerability. Why is this pattern, often called a 'gas griefing' or 'unbounded loop' vulnerability, so dangerous?

The Turing completeness of smart contract languages and verification challenges Hard
A. The EVM charges extra gas for processing arrays larger than 1024 elements, making the transaction uneconomical for legitimate users.
B. An attacker can call the function with an extremely large array, causing the transaction to consume the entire block gas limit and fail. If this function is required for other critical contract operations, the attacker can effectively halt the contract.
C. The calldata keyword makes the array elements immutable, preventing the function from correctly processing them.
D. If the array is too large, it can cause a stack overflow error in the EVM, which is unrecoverable.

53 An EOA submits two transactions. The first has nonce: 42, gasPrice: 20 Gwei. The second, submitted moments later, has nonce: 42, gasPrice: 30 Gwei. Both transactions enter the mempool. Assuming both are valid, what will be the outcome?

Ethereum and smart contracts Hard
A. Which transaction gets mined is random and depends on which one a miner's node sees first.
B. Miners will prioritize the transaction with the 30 Gwei gas price. Once it is included in a block, the 20 Gwei transaction becomes invalid and is dropped from the mempool by all nodes.
C. The transaction with the 20 Gwei gas price will be mined because it was submitted first, and the second transaction will be rejected as a duplicate.
D. Both transactions will be mined, leading to a double execution of the intended action.

54 What is the primary purpose of the EIP-712 standard for typed structured data hashing and signing, and what specific class of vulnerability does it mitigate compared to the older eth_sign method?

Writing smart contracts using Solidity & JavaScript Hard
A. It prevents signature replay attacks across different blockchains (e.g., Ethereum and Polygon) by mandating the inclusion of the chainId in the signed data.
B. It enables signing transactions with hardware wallets, a feature that was not supported by eth_sign.
C. It mitigates phishing and replay attacks across different DApps by creating a domain-separated, human-readable context for the data being signed, ensuring a signature for one application cannot be used in another.
D. It standardizes a more gas-efficient signature verification algorithm, reducing the on-chain cost of ecrecover.

55 Bitcoin Script is a stack-based, non-Turing-complete language. Which of the following features, fundamental to general-purpose programming and present in Solidity, is explicitly forbidden in Bitcoin Script to prevent infinite loops and ensure termination?

Comparing Bitcoin scripting vs. Ethereum smart contracts Hard
A. Arithmetic operations such as OP_ADD and OP_SUB.
B. Access to transaction-specific data like output values or lock times.
C. Backward jumps or loops (e.g., GOTO or for/while constructs).
D. Conditional flow control using opcodes like OP_IF and OP_ELSE.

56 The EVM storage model works with 32-byte slots. Solidity packs multiple variables into a single storage slot if they fit. Consider the contract: contract C { uint128 a; uint128 b; }. A user calls a function that executes a = type(uint128).max; b = 1;. What will be the raw hex value stored in storage slot 0?

Ethereum and smart contracts Hard
A. 0x0000...01 in slot 0 and 0xFFFF...FF in slot 1.
B. 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000000000000000000000000001
C. 0x00000000000000000000000000000001FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
D. The operation will fail because two variables cannot be written to the same slot in one transaction.

57 A smart contract for a decentralized autonomous organization (DAO) is designed to be governed by its token holders. A legal challenge arises from a real-world event not anticipated in the code. The principle of "code is law" is invoked by one party, while another seeks external legal recourse. What architectural pattern could have been implemented in the DAO to bridge this gap between rigid code and the need for external, human-centric dispute resolution?

Using smart contracts to enforce legal contracts Hard
A. Making the entire contract mutable so that a judge can order direct changes to the code.
B. Integrating with a decentralized court system (e.g., Kleros, Aragon Court) and including a function that allows an EOA controlled by that system's resolution protocol to trigger a specific, pre-defined action (like an emergency pause or the reversal of a specific transaction).
C. A centralized 'admin key' held by a law firm that can override any DAO decision.
D. Writing the smart contract in a natural language processing language so it can interpret legal documents directly.

58 When interacting with a smart contract from a JavaScript application using a library like ethers.js, a function returns a uint256 value representing an ERC20 token balance with 18 decimals. The value is 100000000000000000000. If a developer attempts to process this value directly as a standard JavaScript Number (e.g., let balance = await contract.balanceOf(address); let newBalance = balance / 2;), what will happen?

Writing smart contracts using Solidity & JavaScript Hard
A. The code will throw a TypeError because the returned value is not a primitive number.
B. ethers.js automatically converts all uint256 values into strings to prevent precision loss, so the division operation will fail.
C. The calculation will work correctly, and newBalance will be 50000000000000000000.
D. The developer will experience a loss of precision. The returned BigNumber object will be coerced into a JavaScript Number, exceeding Number.MAX_SAFE_INTEGER and resulting in an incorrect value for newBalance.

59 An often-cited difference is that Bitcoin is 'stateless' while Ethereum is 'stateful'. What does this mean in the context of how their respective virtual machines operate on data?

Comparing Bitcoin scripting vs. Ethereum smart contracts Hard
A. Bitcoin's state is reset after every block, whereas Ethereum's state persists indefinitely.
B. Bitcoin scripts are purely functional: they execute with data from the spending transaction and cannot access or modify any state outside of that transaction. Ethereum contracts can read and write to persistent storage associated with their address.
C. Bitcoin nodes do not store the entire blockchain history, whereas Ethereum nodes do.
D. Ethereum transactions can fail and revert, effectively being stateless, while all valid Bitcoin transactions are final and change the state of the UTXO set.

60 What is the key difference in gas consumption and execution context between call, delegatecall, and staticcall in the EVM?

Ethereum and smart contracts Hard
A. call creates a new execution context (storage, msg.sender are new), delegatecall uses the storage and context of the calling contract, and staticcall is a variant of call that forbids any state-modifying operations.
B. delegatecall is the most gas-efficient, followed by staticcall, and then call.
C. call preserves msg.sender and storage context, delegatecall changes them, and staticcall is for read-only calls.
D. All three execute in the same context, but staticcall prevents writes, and delegatecall allows for library-like code reuse.