Smart Contracts Coursera Quiz Answers – Networking Funda

All Weeks Smart Contracts Coursera Quiz Answers

This second course of the Blockchain specialization will help you design, code, deploy and execute a smart contract – the computational element of blockchain technology. Smart contracts allow for implementing user-defined operations of arbitrary complexity that are not possible through plain cryptocurrency protocols.

They allow users to implement conditions, rules, and policies of the domain applications. Smart contracts are a powerful feature that, when properly designed and coded, can result in autonomous, efficient, and transparent systems.

Enroll On Coursera

Smart Contracts Week 1 Quiz Answers

Self-Check Answers

Q1. Who coined the phrase “smart contract”?

  • Hal Finney
  • Satoshi Nakamoto
  • Vitalik Buterin
  • Nick Szabo

Q2. Smart contract is the centerpiece of Ethereum blockchain. What is another smart contract model?

  • Intelligent contract of Bitcoin
  • Chaincode of Hyperledger
  • Bitgold of Szabo
  • Legal contracts

Q3. What does a smart contract represent?

  • Transaction layer
  • Business logic layer
  • Proof of work
  • Integration API

Q4. How does a smart contract transaction differ from the usual cryptocurrency transfer (say. Bitcoin)?

  • It is confirmed faster
  • It enables asset transfer in addition to digital currency
  • The validation process is simpler
  • It enables time ordered events to be recorded

Q5. An important characteristic of a decentralized network enabled by the blockchain technology is that ____.

  • you hold the assets instead of the intermediaries
  • the EVM holds the assets for you
  • a central authority holds your assets

Self-Check Answers

Q1. What is a standard notation used for representing identifiers?

  • Upper case
  • Lower case
  • Camel case

Q2. According to Ethereum Metropolis version, once a smart contract is deployed it is immutable. True or False?

  • False
  • True

Q3. What is a CLI?

  • Common Language Infrastructure
  • Command Language Interpreter
  • Call Level Interface
  • Command Line Interface

Q4. You cannot execute a smart contract from another smart contract. True or False?

  • False
  • True

Q5. Which of the following are used to determine the address of a contract? (Select 2)

  • Address of the creator’s account
  • Nonce of the creator’s account
  • Name of the contract
  • Contract creation date

Smart Contract Basics Answers

Q1. After compiling and deploying the Greeter contract, what value does execution of hello function (button) display?

  • “hello”
  • “”
  • Null
  • “World”

Q2. After calling the “set” function of Greeter contract with string value “Michael”, what value does execution of hello function (button) display?

  • “World”
  • Null
  • “Michael”
  • “”

Q3. What is the default value of storedData on compiling and deploying the SimpleStorage contract?

  • Null
  • 0X0 or 0
  • -100
  • 100

Q4. After calling or clicking the increment function with a parameter of 5, what is the value of storedData?

  • -100
  • 5
  • 0
  • Null

Q5. After calling or clicking the decrement function with a parameter of 6, what is the value of storedData?

  • 0
  • Null
  • 5
  • 115792089237316195423570985008687907853269984665640564039457584007913129639935

Q6. How do you deploy a contract in Remix?

  • By clicking Load.
  • By clicking Compile.
  • By clicking Create or Deploy.
  • By clicking Start.

Q7. Where can you see the bytecode of a contract in Remix?

  • It is displayed when a contract is deployed in the run menu.
  • By checking the Settings for the contract.
  • By clicking the Details button under the compile menu
  • In the file explorer.

Q8. What are specified in a transaction to invoke an operation on a smart contract?

  • Address and time
  • Account number and transaction IDs
  • Block number and number of transactions
  • Function and parameters

Q9. What do you need to access a smart contract from an application?

  • Only the ABI (Application Binary Interface)
  • Just the smart contract address
  • The address and the ABI (Application Binary Interface) of the contract

Q10. What does the basic structure of a contract contain?

  • Pragma directive
  • Name of the contract
  • Data and functions
  • All of the above

Smart Contracts Week 2 Quiz Answers

Week 02 All Self-Check Answers

Q1. What does a simple function definition in Solidity contain?

  • Function header and code
  • Modifier definitions
  • Fallback definition
  • Owner of the contract

Q2. Smart contracts can be inherited from other smart contracts? True or False?

  • True
  • False

Q3. Transacting on the ethereum blockchain has a cost associated with it. Which of these units is used to measure that cost?

  • Bytes
  • Coin
  • Gas
  • Ether

Q4. What is the size of “uint”?

  • 112 bits
  • 64 bits
  • 256 bits
  • 128 bits

Q5. 1 ether equals

  • 10 ^ 6 wei
  • 10 ^ 8 wei
  • 10 ^ 16 wei
  • 10 ^ 18 wei

Q6. What is the default visibility modifier for an identifier in a smart contract?

  • Protected
  • Public
  • Static
  • Private

Q7. What is the size of an Ethereum address?

  • 16 Bytes
  • 64 Bytes
  • 20 Bytes
  • 256 Bytes

Q8. Which one of the following elements of Solidity is equivalent to a hash table?

  • Address
  • Array
  • Mapping
  • Struct

Q9. In a smart contract, how can you access the address of an account that initiated a transaction?

  • msg.address
  • msg.value
  • msg.sig
  • msg.sender

Q10. What is an Enum?

  • A custom data type that can hold a group of several variables.
  • A custom data type that can hold finite set of values.
  • A custom data type that can hold infinite set of values.
  • A predefined data type with finite set of values.

Q11. Individual elements of “struct” can be accessed using

  • Colon notation[Eg. person:name]
  • Argument notation [Eg. name(person)]
  • Dot notation [ Eg. person.name]
  • Arrow notation [Eg. name => person]

Q12. Which is true about function modifiers?

  • Specified at the entry of a function and executed after the function ends
  • Specified at the entry to a function and executed before the function begins
  • Specified at the exit of a function and executed after the function ends

Q13. What function is used to reject a failed transaction without recording it in the blockchain?

  • return
  • delete
  • revert
  • reject

Solidity – Week 2 Quiz Answers

Q1. Load the BidderData.sol in the Remix and create it. What buttons do you observe in the user interface at the right bottom of Remix?

  • bidAmount, eligible, name
  • bidAmount, eligible, minBid, name
  • bidAmount, eligible
  • No buttons are generated

Q2. Why do you see these buttons when there are no functions in the BidderData.sol contract?

  • Getters are generated for variables of uint type
  • Setters are generated for public variables
  • Getters are generated for constant variables
  • Getters are generated for public variables

Q3. Who can mint coins in the Minter contract?

  • Anyone
  • User with a Ethereum Key Pair
  • Creator of the contract
  • User with public address of minter

Q4. Deploy the Minter contract from the first account. Now mint 500 coins for the first account. Then send 200 coins from the first account to the second account. After this sequence of transactions, what are the balances in the first account and the second account?

  • 300, 0
  • 500, 200
  • 300, 200
  • 500, 0

Q5. Choose the third account from the Account drop down menu, stay in this account and mint 600 coins for the same account. What is the balance of the third account?

  • 200
  • 600
  • 500
  • 0

Q6. In the BallotBasic.sol, who is the chairperson?

  • Developer of the contract
  • Miner of the contract
  • Creator of the contract

Q7. How is the number of proposals in the BallotBasic.sol contract initialized?

  • Using the constant definition
  • Using the global variable
  • Using the constructor argument
  • None of the above

Q8. In the BallotBasic.sol, who can register new voters?

  • All users have it granted.
  • Any registered user can get it themselves.
  • The chairperson of the ballot.
  • Other users with the right to vote.

Q9. Which is the base unit for time in solidity?

  • Milliseconds.
  • Days.
  • Seconds.
  • Minutes.

Q10. How is the placeholder for any function indicated in the modifier definition?1 point

  • Using +;
  • Using _;
  • Using { }
  • Using require

Smart Contracts Week 03 Quiz Answers

Self-Check Week 03 Answers

Q1. In our Ballot example, how much weight is given to the chairperson’s vote?

  • None
  • 1
  • 3
  • 2

Q2. How many constructors can be there in a Solidity contract?

  • 3
  • 1
  • 2
  • many

Q3. What data structure represents the details of a single voter in our Ballot example?

  • struct
  • mapping
  • array
  • address

Q4. What was an issue in the Ballot smart contract discussed in lesson 1?

  • Unnecessary use of variables
  • The functions can be called in any order
  • The design of the contract was flawed
  • It had no major issues

Q5. What does the keyword “now” in a Solidity contract stand for?

  • time in which the transaction was submitted
  • time in which the block is added to the chain (block.timestamp)
  • time in which the transaction was triggered
  • time in which the transaction was originated

Q6. In the Ballot smart contract, what datatype was used to represent the “stages” of balloting?

  • bool
  • enum
  • mapping
  • array

Q7. revert() results in a state-reverting exception. True or False?

  • True
  • False

Q8. In the Ballot example, how do we check if the contract is in the required state?

  • using modifiers
  • using block number
  • using functions
  • using events

Q9. Invoking an event is by the name of the event and any parameters. True or False?

  • False
  • True

Q10. The main use of events is to ____.

  • make a call oraclize
  • wait for a callback from the client application to signify a milestone has been reached
  • indicate to a client application, user interface or a transaction monitor that a significant milestone has been reached.
  • confirm that the transaction was submitted

Putting It All Together – Week 3 Answers

Q1. How are time elements added to BasicBallot contract we discussed earlier?

  • Using “now” variable along with the message sender
  • Using “now” variable along with enum for stages
  • Using “now” variable
  • Using timestamp and epoch time

Q2. In BallotWithStages.sol, how are the stages validated in register and vote functions?

  • Using if and return statements
  • Using if and throw statements
  • Using if and assert statements
  • Using if and require statements

Q3. Compile and create BallotWithStages.sol. Immediately try and vote. What is the status of the transaction? [After the transaction is initiated observe the console window at the bottom of Remix IDE. Click on Details button to check if transaction was successful or failed]

  • Transaction mined and execution succeeds
  • Transaction failed and execution fails
  • Transaction failed and execution succeeds
  • Transaction mined and execution fails

Q4. Time variable “now” does not provide the real current time. True or False?

  • True
  • False

Q5. In BallotWithModifier.sol, where is the condition about the stages defined?

  • Inside the constructor
  • Inside the function
  • Inside the function parameters
  • Inside the modifier

Q6. Assert statement in the winning proposal method of BallotWithModifier.sol makes sure that the function does not return a value if nobody voted. True or False?

  • True
  • False

Q7. Compile and create BallotWithModifier.sol. Immediately try and vote. What is the status of the transaction? [After the transaction is initiated observe the console window at the bottom of Remix IDE. Click on the Details button to check if the transaction was successful or failed]

  • Transaction mined and execution succeeds
  • Transaction failed and execution fails
  • Transaction mined and execution fails
  • Transaction failed and execution succeeds

Q8. Even though we have specified only tens of seconds (30 and 60 seconds) as the stage time, the stage time or duration in real-life application it could be longer. True or False?

  • False
  • True

Q9. What stage does the contract have to be in for the winning proposal to produce a result?

  • 3 (Done Stage)
  • 2 (Vote Stage)
  • 0 (Init Stage)
  • 1 (Register Stage)

Q10. In BallotWithModifiers.sol, how is the end of the voting stage indicated to the other applications?

  • Using the event votingCompleted
  • Using the return value of the function
  • Using the callback function
  • Using the fallback function

Smart Contracts Week 04 Quiz Answers

Best Practices- Week 4 Answers

Q1. Blockchain is suited for which of the following applications?

  • Peer to Peer transactions with intermediaries
  • Autonomous systems guided by rules and policies
  • Transactions within a small organization
  • Organization with high speed transactions

Q2. Smart contracts are visible to all participants on the chain. True or False?

  • True
  • False

Q3. It is a best practice that a design of a smart contract is

  • Simple
  • Coherent
  • Auditable
  • All of the Above

Q4. If you need to store large documents for a blockchain application, how would you store it?

  • Keep the documents in the blockchain
  • Store the documents off-chain and keep the metadata in the blockchain
  • Hash the document and save it in blockchain

Q5. Which data type is preferred for computational operations in blockchain?

  • Integer
  • String
  • Address
  • Enum

Q6. In Solidity, a preferred order of various types of functions given below is:

1. Constructor

2. Private

3. Public

  • 1,3,2
  • 2,3,1
  • 2,1,3
  • 3,1,2

Q7. Which of the following is/are true about modifiers?

  • A function can have any number of modifiers
  • Visibility modifiers for a function should come before custom access modifiers
  • Modifiers can be without any parameters
  • All the above

Q8. Payable functions can be used as standalone functions. True or False?

  • True
  • False

Q9. Which of the following hashing technique is provided by Solidity?

  • Keccak256
  • Sha1
  • Md2
  • Sha512

Q10. Remix IDE has a ____.

  • Just in time compiler
  • Interpreter
  • Run time compiler
  • Batch compiler
Smart Contracts Coursera Course Review:

In our experience, we suggest you enroll in the Smart Contracts Course and gain some new skills from Professionals completely free and we assure you will be worth it.

Smart Contracts course is available on Coursera for free, if you are stuck anywhere between quiz or graded assessment quiz, just visit Networking Funda to get Smart ContractsCoursera Quiz Answers.

Conclusion:

I hope these Smart Contracts Coursera Quiz Answers would be useful for you to learn something new from this Course. If it helped you then don’t forget to bookmark our site for more Coursera Quiz Answers.

This course is intended for audiences of all experiences who are interested in learning about new skills in a business context; there are no prerequisite courses.

Keep Learning!

All Course Quiz Answers of Blockchain Specialization

Course 01: Blockchain Basics

Course 02: Smart Contracts

Course 03: Decentralized Applications (Dapps)

Course 04: Blockchain Platforms

Leave a Reply

error: Content is protected !!