Search test library by skills or roles
⌘ K

Adaface Sample Solidity Questions

Here are some sample Solidity questions from our premium questions library (10273 non-googleable questions).

Skills

🧐 Question

Medium

Delegated Contract Execution
Delegatecall
Modifiers
Contract Security
Solve
In the Solidity code provided, there are two contracts: MainContract and HelperContract. MainContract uses delegatecall to execute a function in HelperContract. Carefully analyze the code and determine the outcome of specific operations.
 image
After deploying both contracts and setting the HelperContract address in MainContract, what will be the result of calling setHelperVars(100) from an EOA (Externally Owned Account)?
A: Only HelperContract's state is modified.
            B: Only MainContract's state is modified.
            C: States of both MainContract and HelperContract are modified.
            D: Transaction fails due to the onlyOwner modifier in MainContract.
            E: MainContract's sender and value are modified, but num remains unchanged.
            F: HelperContract's sender and value are modified, but num remains unchanged.

Medium

Functions and arguments
Fallback functions
Solve
Review the following Solidity code:
 image
We want to add a fallback function to the contract. Pick the correct fallback function and correct statements:
 image
E: Fallback function is executed if contract receives plain Ether without any data
            F: Fallback function is executed if caller calls a function that is not available
            G: If multiple unnamed functions are defined for a contract, the cheapest function is used as fallback function

Easy

Private and Internal
Smart Contracts
Contract Inheritance
Solve
Review the following Solidity code:
 image
Pick the correct statements:
            
            A: private increment function defined in contract_e is accessible in derived contract d_c but not accessible outside the derived contracts.
            B: private increment function defined in contract_e is accessible only inside contract_e and not accessible to derived contracts as well.
            C: internal variable str defined in contract_e is accessible in derived contract d_b but not outside the derived contracts.
            D: internal variable str defined in contract_e is accessible only inside contract_e and not accessible to derived contracts as well.

Medium

Smart Contract Interaction
Contract Interaction
Gas Usage
Error Handling
Solve
You are reviewing a set of two interacting Solidity smart contracts, `ContractA` and `ContractB`. `ContractA` calls a function in `ContractB`, which in turn updates state variables in both contracts. Your task is to determine the correct behavior and gas usage implications based on the pseudo code provided:
 image
The contracts are deployed correctly, and `ContractB` is initialized with the address of `ContractA`. Consider what happens when `incrementBoth` function of `ContractB` is called.
A: Only `ContractB`'s count is incremented; `ContractA`'s count remains unchanged.
            B: Both `ContractA` and `ContractB`'s counts are incremented, with higher gas costs due to inter-contract calls.
            C: Transaction fails due to lack of error handling in `ContractB`.
            D: Gas optimization is achieved due to internal transaction handling.
            E: `ContractA`'s count is incremented twice due to recursive call.
            F: `ContractA`'s count is not incremented due to `external` keyword restriction.
🧐 Question🔧 Skill

Medium

Delegated Contract Execution
Delegatecall
Modifiers
Contract Security

3 mins

Solidity
Solve

Medium

Functions and arguments
Fallback functions

3 mins

Solidity
Solve

Easy

Private and Internal
Smart Contracts
Contract Inheritance

2 mins

Solidity
Solve

Medium

Smart Contract Interaction
Contract Interaction
Gas Usage
Error Handling

2 mins

Solidity
Solve
🧐 Question🔧 Skill💪 Difficulty⌛ Time
Delegated Contract Execution
Delegatecall
Modifiers
Contract Security
Solidity
Medium3 mins
Solve
Functions and arguments
Fallback functions
Solidity
Medium3 mins
Solve
Private and Internal
Smart Contracts
Contract Inheritance
Solidity
Easy2 mins
Solve
Smart Contract Interaction
Contract Interaction
Gas Usage
Error Handling
Solidity
Medium2 mins
Solve

Trusted by recruitment teams in enterprises globally

Amazon Morgan Stanley Vodafone United Nations HCL PayPal Bosch WeWork Optimum Solutions Deloitte Microsoft NCS Doubtnut Sokrati J&T Express Capegemini

We evaluated several of their competitors and found Adaface to be the most compelling. Great library of questions that are designed to test for fit rather than memorization of algorithms.


Swayam Narain, CTO, Affable

hashtag image heart icon Swayam
customers across world
Join 1200+ companies in 75+ countries.
Try the most candidate friendly skills assessment tool today.
g2 badges
Ready to streamline your recruitment efforts with Adaface?
Ready to streamline your recruitment efforts with Adaface?
logo
40 min tests.
No trick questions.
Accurate shortlisting.
ada
Ada
● Online
Previous
Score: NA
Next
✖️