โ† All Ethereum Developer Flashcard Decks

Test Flashcards

11 cards from real Ethereum Developer practice questions. Tap to flip, then mark Knew It or Still Learning โ€” missed cards come back until you master them.

Read the first 11 Test flashcards as text
  1. Which is TRUE about Events?

    Answer: Cannot be accessible by contracts because they are stored in a side-chain or similar structure.

    Events in Solidity are a way to log information to the blockchain, making it accessible to external applications and block explorers. While events are stored on the blockchain as part of transaction receipts, they cannot be directly accessed or read by other smart contracts. They serve as a communication mechanism for off-chain entities rather than on-chain contract interaction.

  2. Which network node is not PoW?

    Answer: Rinkeby

    Rinkeby is an Ethereum testnet that utilizes a Proof-of-Authority (PoA) consensus mechanism, where a set of authorized signers validate transactions and create new blocks. In contrast, Ropsten, Morden (deprecated), and Olympic (deprecated) were all Proof-of-Work (PoW) testnets, mimicking the main Ethereum network's original consensus mechanism.

  3. Solidity has the following value types.

    Answer: Addresses, Integer, Boolean, and Enum

    Solidity includes several fundamental value types that are passed by value, meaning a copy is made when assigned or passed to a function. These include `address` for Ethereum addresses, various `integer` types (e.g., `uint256`, `int8`), `boolean` for true/false values, and `enum` for user-defined enumerations. Fixed-point numbers are not natively supported as a value type, and structures are reference types.

  4. Variables of the type address hold

    Answer: A value of 20 bytes

    An Ethereum address is a 160-bit (20-byte) identifier for an account or contract on the blockchain. It is typically represented as a 40-character hexadecimal string prefixed with '0x'. This 20-byte length is a fundamental characteristic of Ethereum addresses.

  5. A version pragma is a great method

    Answer: To identify the compiler version for which a smart contract was created. Keeping changes from breaking helps.

    A version pragma, like `pragma solidity ^0.8.0;`, specifies the minimum and maximum Solidity compiler versions that can be used to compile the smart contract. This is crucial for ensuring compatibility and preventing unexpected behavior due to breaking changes or new features introduced in different compiler versions. It helps maintain the integrity and predictability of the contract's compilation.

  6. What was the name of Teku's eth2 client prior to their rebranding?

    Answer: Artemis

    Teku, a prominent Ethereum 2.0 client developed by ConsenSys, was initially known by the codename Artemis. The rebranding occurred as part of the ongoing development and maturation of the Ethereum 2.0 ecosystem, now referred to as the consensus layer.

  7. Which is TRUE about Loops in Solidity?

    Answer: Are risky when employed with expanding data structures, like arrays or mapping, because it is difficult to predict the gas requirements

    Loops in Solidity, especially when iterating over dynamic data structures like arrays or mappings, pose a significant risk due to unpredictable gas requirements. If the number of iterations or the cost per iteration increases over time, the transaction might run out of gas, leading to failed transactions or making the contract unusable. This is known as the 'gas limit problem'.

  8. Which is TRUE when defining a new datatype?

    Answer: Using a struct is preferable because it is less expensive than launching a new contract.

    In Solidity, `struct`s allow developers to define custom, complex data types by grouping together multiple variables. Using a `struct` is an efficient and cost-effective way to organize related data within a single contract, as it is significantly less expensive in terms of gas and deployment cost than deploying a separate contract for each custom data type instance.

  9. The result of the division of two integers, 5/2, is

    Answer: 2, as the decimal point has been truncated.

    Solidity performs integer division, which means any fractional part of the result is truncated, effectively rounding down to the nearest whole number. Therefore, 5 divided by 2 results in 2, as the decimal .5 is discarded. Solidity does not automatically convert integers to floats for division.

  10. As per the official Style Guide,

    Answer: Functions should use mixedCase, while contract names should be capitalized. You should indent text with four spaces and limit lines to 79 (or 99) characters.

    The official Solidity Style Guide recommends specific formatting conventions for readability and consistency. It states that function names should use `mixedCase`, while contract names should be `Capitalized`. Indentation should be done with four spaces, and lines should generally be limited to 79 or 99 characters to improve code readability.

  11. The elements of a mapping are keys and values.

    Answer: The key cannot be another mapping, struct, enum, or dynamically sized array; the value can be anything.

    In Solidity mappings, there are restrictions on the key type: it cannot be a mapping, a struct, an enum, or a dynamically sized array. This is because mapping keys are hashed, and these complex types do not have a fixed-size, unique representation suitable for hashing. However, the value type of a mapping can be virtually any Solidity type, including other mappings, structs, or arrays.