ExamGecko
Home Home / Blockchain / CBDE

Blockchain CBDE Practice Test - Questions Answers, Page 6

Question list
Search
Search

To Iterate through a mapping, you:

A.
can use the length parameter of the mapping.
A.
can use the length parameter of the mapping.
Answers
B.
you need an external helper variable.
B.
you need an external helper variable.
Answers
C.
you cannot iterate any mapping to make the overall language design more safe.
C.
you cannot iterate any mapping to make the overall language design more safe.
Answers
Suggested answer: B

Function and Variable Visibility:

A.
a function that is marked as internal cannot be called by other contracts, unless the function is used by a derived contract. Private Functions cannot be called by any other outside contract and public variables are generating automaticallya getter function.
A.
a function that is marked as internal cannot be called by other contracts, unless the function is used by a derived contract. Private Functions cannot be called by any other outside contract and public variables are generating automaticallya getter function.
Answers
B.
a function that is marked as external can never be called internally. Private functions can also be called by derived contracts using inheritance. Private variables are accessible also in derived contracts.
B.
a function that is marked as external can never be called internally. Private functions can also be called by derived contracts using inheritance. Private variables are accessible also in derived contracts.
Answers
Suggested answer: A

View and Pure Functions:

A.
a function marked as pure can change the state, while a view function can only return static calls.
A.
a function marked as pure can change the state, while a view function can only return static calls.
Answers
B.
a function marked as view can never access state variables, while pure functions are here to return only one value.
B.
a function marked as view can never access state variables, while pure functions are here to return only one value.
Answers
C.
a view function can access state variables, but not write to them. A Pure function cannot modify or read from state.
C.
a view function can access state variables, but not write to them. A Pure function cannot modify or read from state.
Answers
Suggested answer: C

View and Pure Functions:

A.
can only be accessed during calls.
A.
can only be accessed during calls.
Answers
B.
can be accessed during transactions and calls.
B.
can be accessed during transactions and calls.
Answers
Suggested answer: B

The Fallback function:

A.
cannot receive Ether, not even by adding the payable modifier.
A.
cannot receive Ether, not even by adding the payable modifier.
Answers
B.
can contain as much logic as you want, but it’s better to keep it short and not exceed the gas stipend of 2300 gas.
B.
can contain as much logic as you want, but it’s better to keep it short and not exceed the gas stipend of 2300 gas.
Answers
C.
can be used to avoid receiving ether.
C.
can be used to avoid receiving ether.
Answers
Suggested answer: B

You need to use ____________ to get the address that initiated the transaction.

A.
Tx.origin
A.
Tx.origin
Answers
B.
Msg.sender
B.
Msg.sender
Answers
Suggested answer: A

If a User calls contract A and that calls Contract B, then msg.sender in Contract B will contain the address of:

A.
the User.
A.
the User.
Answers
B.
contract A.
B.
contract A.
Answers
Suggested answer: B

Loops in Solidity:

A.
are a great way to circumvent gas requirements, because a loop will only consume gas once.
A.
are a great way to circumvent gas requirements, because a loop will only consume gas once.
Answers
B.
are dangerous when used with data structures that grow, such as arrays or mapping, because it is hard to estimate the gas requirements.
B.
are dangerous when used with data structures that grow, such as arrays or mapping, because it is hard to estimate the gas requirements.
Answers
C.
should be avoided where possible, because of unknown side-effects on the gas requirements.
C.
should be avoided where possible, because of unknown side-effects on the gas requirements.
Answers
Suggested answer: B

Events:

A.
are stored on chain and are a great way to get a return value when a contract calls another contract.
A.
are stored on chain and are a great way to get a return value when a contract calls another contract.
Answers
B.
are stored in something like a side-chain and cannot be accessed by contracts.
B.
are stored in something like a side-chain and cannot be accessed by contracts.
Answers
C.
are used primarily for debugging exceptions in solidity.
C.
are used primarily for debugging exceptions in solidity.
Answers
Suggested answer: B

According to the official Style Guide:

A.
you should capitalize function names, events and contract names, to avoid confusion with JavaScript. You should use Tabs to indentation and a maximum of 80 characters per line.
A.
you should capitalize function names, events and contract names, to avoid confusion with JavaScript. You should use Tabs to indentation and a maximum of 80 characters per line.
Answers
B.
contract names should be capitalized, while functions should be mixedCase. You should use 4 spaces as indentation and a maximum of 79 (or 99) characters per line.
B.
contract names should be capitalized, while functions should be mixedCase. You should use 4 spaces as indentation and a maximum of 79 (or 99) characters per line.
Answers
C.
contract should be mixedCase, as well as function names. Events should be capitalized. 2 spaces should be used as indentation and a maximum of 120 characters per line.
C.
contract should be mixedCase, as well as function names. Events should be capitalized. 2 spaces should be used as indentation and a maximum of 120 characters per line.
Answers
Suggested answer: B
Total 102 questions
Go to page: of 11