Providers, Signers, ABIs, and Token Approval Flow Quiz Solution

Awais SajidAwais Sajid
5 min read

Lesson Banner Image

What is the difference between a Provider and a Signer?

Providers can only read data, signers can read and write data

What is the purpose of having an ABI?

Contains information about the smart contract code to help encode/decode responses

If Alice wants a contract to take some AliceCoin from her, assuming the contract has code to do so, what does she need to do?

Call approve(…) on the AliceCoin contract followed by a function call to the other contract


Demystifying the Ethereum Virtual Machine (EVM) Quiz Solutions

Q: Which is the better analogy for Ethereum?

  • Distributed State Machine

Q: There is only one implementation of the EVM, and that is in Solidity

  • False

Intro to React and Next.js: LearnWeb3 Quiz Solutions.

🤔 What is the power of JSX?

It is an extension of Javascript that allows you to return HTML elements from JS functions

What is composition?

It is the combination of multiple components to create a single hierarchial HTML document

You can pass arbitrary data to components through props?

Yes

How do React components allow you to make your code easier to understand?

By enabling reusability of components through data passing

What will the above code do when run?

Crash due to an error

In the above code, what happens when you click on the Increment button?

Nothing will happen

Why are state variables (useState) used in React?

They are used to maintain values that re-render the HTML whenever the value changes

useEffect hook can only be run when the page first loads?

False

In the above code, what happens when the Start button is clicked?

The React app gets stuck in an infinite loop

useEffect can only be dependent on one value?

False

What is a difference between useRef and useState?

Updates to reference variables are done synchronously whereas updates to state variables are done asynchronously

What is the main difference between React and Next.js when it comes to routing between webpages?

React requires a routing library whereas Next does file based routing automatically

How do you write REST API endpoints in Next.js applications?

By creating files within the pages/api/ subdirectory

React components must begin with an uppercase letter when being used in JSX?

True


Digging-deeper-into-soliditys-syntax: LearnWeb3 Quiz Solution

What is an analogous data structure to mappings?

Hashmaps

What are enums used for?

To restrict a variable to have one of a few predefined values

What are structs used for?

Creating custom data types

What is the difference between view and pure functions?

view functions can read state, pure functions cannot

What are events used for?

Logging values to the blockchain

What is the key difference between .send(), .transfer(), and .call(){} methods for sending Ether in Solidity?

  • .send() method returns a boolean indicating success

  • or failure, .transfer() method reverts transactions if they fail, while .call(){} method allows forwarding all available

  • gas and also returns a boolean indicating success or failure.

Using a well-known library is cheaper than writing the same code directly in your contract?

Yes, because you don’t pay gas on it’s deployment


How to create Merkle Trees for airdrops: Quiz Solution

What kind of data structure is a Merkle Tree?

  • Tree

How is each leaf node labeled in Merkle Tree?

  • Cryptographic hash of the data block

How is each non-leaf node labeled in Merkle Tree?

  • Cryptographic hash of its child nodes’ values

In the above image, what will be the label of parent node for C and D leaf nodes, in case of Merkle Trees?

  • Hash CD

If node D is replaced with node E, what will be the label of the parent node now?

  • Hash CE — it will change

Can the same data give two different hashes in a Merkle Tree?

  • No

Which one of the following is not a property of a hash function?

  • Can be reverse engineered

Which one of the following is not a benefit of using a Merkle Tree?

  • Data is stored sequentially

Where are Merkle Trees not used?

  • SQL Databases

How does a merkle proof work?

  • We give the verifier the value of the node we want to check along with all other nodes which are required from the tree to hash up and form the root hash .

How Ethereum nodes store data and executes smart contracts Quiz Sol

What does the Ethereum world state contain?

A mapping from account addresses to account states

Every account state contains a code hash?

False

What are the types of transactions on Ethereum?

Contract creation and message calls

The EVM uses what kind of machine architecture?

Stack-based architecture

How big can each stack element be in the EVM?

32 bytes

What is the maximum depth of the stack in the EVM?

  • 1024

What kind of data structure is a stack?

LIFO

How many local variables can a single function define in Solidity?

16

Which of the following statement is true?

You can write 8 bits or 256 bits at once in memory but only read in 256 bit chunks

What is the Program Counter used for?

It points to the OPCODE that needs to be run in the EVM

💡
Please give claps to this article if you really liked it it would take less than 10 seconds 🫡 🫡
0
Subscribe to my newsletter

Read articles from Awais Sajid directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Awais Sajid
Awais Sajid

As a Cybersecurity student passionate about Hacking and Blockchain security, I strive to develop innovative solutions to protect against emerging threats.