Curated interview practice questions with answers. These are practice scenarios, not a verified list of past interview questions.
About Tech Mahindra hiring for Blockchain roles
Tech Mahindra is an Indian IT services and consulting company and part of the Mahindra Group. It is known for its strong telecom and communications practice and also serves banking, manufacturing and healthcare clients. In India it hires for software engineers, test engineers, network engineers, data analysts and data engineers.
For Blockchain roles, this Tech Mahindra practice set focuses most on Consensus and Scaling (5), dApp Development (5), Blockchain Fundamentals (5), DeFi, Tokens and NFTs (4). It has 18 easy, 12 medium questions, so you can start easy and work up to the harder ones.
Company type
IT services
Headquarters
Pune, India
Main India offices
Pune, Hyderabad, Bengaluru, Noida, Chennai
Tech Mahindra Blockchain interview process
Online assessment (aptitude + English essay)
Coding test
Technical interview
HR round
Typical pattern based on public candidate experiences. Rounds vary by role, team and year.
Solved for Tech MahindraStart practicing
3 QUESTIONS FREESign up to unlock the full question bank and track your progress.Unlock every question and answer, then continue practising company-wise and package-wise.
In Proof of Work, miners repeatedly change a nonce and hash the block header until the hash is below a difficulty target. Finding it takes huge computation, but anyone can verify it with one hash. The first miner to succeed broadcasts the block and earns the block reward plus fees. Nodes follow the chain with the most accumulated work. Bitcoin targets a block every ten minutes and adjusts difficulty every 2016 blocks to keep that pace.
Validators deposit 32 ETH (after the Pectra upgrade a validator can hold up to 2048 ETH) to join. Time is divided into 12-second slots and 32-slot epochs. In each slot a randomly chosen validator proposes a block and committees attest to it. The fork-choice rule LMD-GHOST picks the head, and Casper FFG finalises checkpoints when two-thirds of stake agrees. Honest validators earn rewards; offline ones lose small amounts, and provably malicious ones are slashed.
03
How do you connect a browser wallet to a dApp using ethers.js?
Browser wallets inject an EIP-1193 provider at window.ethereum. Wrap it with BrowserProvider and request accounts.
import { BrowserProvider } from 'ethers';
async function connect() {
if (!window.ethereum) throw new Error('Install a wallet');
const provider = new BrowserProvider(window.ethereum);
const signer = await provider.getSigner(); // prompts the user
const address = await signer.getAddress();
const { chainId } = await provider.getNetwork();
return { signer, address, chainId };
}
In production, use EIP-6963 discovery or a connector library so users with several wallets can choose.
DeFi, decentralised finance, means financial services such as trading, lending, borrowing, stablecoins and derivatives built as smart contracts on public blockchains. Anyone with a wallet can use them without a bank account or approval, contracts are transparent, and protocols can be combined like building blocks. Examples are automated market maker exchanges, overcollateralised lending markets and liquid staking. The risks are smart contract bugs, oracle failures, volatile collateral and unclear regulation.
05
How is a blockchain different from a traditional database?
A traditional database is controlled by one administrator who can create, update and delete rows, and trust comes from that owner. A blockchain is shared by many parties, is append-only, and trust comes from cryptography and consensus. The trade-off is performance: a database handles thousands of writes per second with low latency, while a public chain is slower and costlier. Use a blockchain only when several parties who do not fully trust each other must share one record.
Immutability comes from hash linking plus consensus. Each block includes the previous block's hash, so editing a past transaction changes that block's hash and every block after it. An attacker would have to redo the work or stake for all those blocks faster than the honest network, which is economically impractical on a large chain. Strictly it is tamper-evident and practically immutable rather than impossible to change; a hard fork by social agreement can still rewrite history.
Solidity is a statically typed, contract-oriented, curly-brace language for writing smart contracts on Ethereum and other EVM chains. Its syntax resembles JavaScript and C++, and it compiles to EVM bytecode plus an ABI. It supports inheritance, libraries, user-defined types, custom errors and events. Version 0.8.x is current, with checked arithmetic by default. Developers usually write it with Foundry or Hardhat and reuse audited building blocks from OpenZeppelin Contracts.
08
What is the difference between an externally owned account and a contract account?
An externally owned account (EOA) is controlled by a private key, has a balance and nonce but no code, and is the only type that can start a transaction. A contract account has code and storage, is controlled by its code, and acts only when called. Since the Pectra upgrade's EIP-7702, an EOA can also delegate to contract code, so the line is blurring as smart accounts become common.
09
Write a simple Proof of Work loop in Python with a difficulty setting.
The miner increments the nonce until the hash starts with the required number of zero hex digits.
import hashlib
def mine(data, difficulty=4):
prefix = '0' * difficulty
nonce = 0
while True:
h = hashlib.sha256(f'{data}{nonce}'.encode()).hexdigest()
if h.startswith(prefix):
return nonce, h
nonce += 1
print(mine('block-1: A pays B 5'))
Each extra zero makes mining about 16 times harder, while verifying still needs one hash.
10
How do you call read and write functions of a contract with ethers v6?
A dApp usually has smart contracts on a chain holding core logic and assets; a front-end, often React or Next.js, that connects to the user's wallet; a library such as ethers.js, viem or wagmi to read and write contracts through an RPC provider; an indexer or subgraph for fast queries of history; decentralised storage such as IPFS for files and metadata; and optional back-end services for notifications, relaying or off-chain computation, with oracles bringing external data on-chain.
12
How do you read a Chainlink price feed in Solidity safely?
Ethereum is a programmable blockchain: besides transferring its native currency ETH, it runs smart contracts, which are programs stored on-chain that execute exactly as written. Bitcoin focuses on being secure, scarce digital money with a deliberately limited scripting language and the UTXO model. Ethereum uses an account model, Proof of Stake since 2022, about 12-second blocks, and a large ecosystem of tokens, DeFi, NFTs and Layer 2 rollups built on top.
14
Explain public, private and consortium blockchains.
A public blockchain such as Bitcoin or Ethereum lets anyone read, transact and run a validator. A private blockchain is run by one organisation that controls who joins, useful for internal audit trails. A consortium (permissioned) blockchain is governed by a group of organisations, for example several banks sharing trade-finance data on Hyperledger Fabric. Public chains give maximum decentralisation; permissioned chains give privacy, known identities and higher throughput.
15
What is a nonce in blockchain? Explain both common meanings.
In proof of work, the nonce is a number miners change repeatedly in the block header until the header hash falls below the difficulty target. In Ethereum's account model, the account nonce is a counter of transactions sent from an address; each transaction must use the next nonce, which orders transactions and prevents replay. A stuck transaction with a low nonce blocks all later ones from that account until it is mined or replaced.
16
What is ECDSA and why does Ethereum use the secp256k1 curve?
ECDSA is the Elliptic Curve Digital Signature Algorithm. It gives strong security with short keys: a 256-bit key is roughly as strong as a 3072-bit RSA key, which keeps transactions small. Bitcoin and Ethereum use the secp256k1 curve, whose simple structure allows efficient computation. A signature has values r and s plus a recovery id v, which lets nodes recover the signer's public key from the signature, so the sender address need not be included separately.
17
Why should you not use tx.origin for authorisation?
tx.origin is the EOA that started the transaction, while msg.sender is the immediate caller. If a contract checks require(tx.origin == owner), a phishing contract can trick the owner into calling it, and that contract then calls the victim; tx.origin is still the owner, so the check passes and funds can be stolen. Always use msg.sender for access control. tx.origin also breaks with smart contract wallets and account abstraction.
18
How do you run Slither on a Foundry project and focus on important findings?
Install it with pip and run it from the project root; it detects Foundry automatically.
pip install slither-analyzer
slither .
# Only medium and high impact issues
slither . --exclude-low --exclude-informational
# Exclude dependencies
slither . --filter-paths 'lib|test'
# Print a summary of contracts and functions
slither . --print human-summary
Triage each finding: fix real bugs and record why false positives are safe.
19
Write a basic ERC-721 NFT contract using OpenZeppelin.
Values like block.timestamp, blockhash or block.prevrandao are visible to or partly controlled by block producers, and any contract can read them in the same transaction and only proceed when the outcome is favourable. So lotteries and NFT trait reveals based on them can be gamed. Use a verifiable random function such as Chainlink VRF, which delivers randomness with a cryptographic proof in a later transaction, or a commit-reveal scheme for simpler cases.
21
How does inheritance work in Solidity, including virtual and override?
A contract inherits with is, for example contract Token is ERC20, Ownable. Parent functions that may be changed must be marked virtual, and the child must use override; with several parents you list them, as in override(A, B). Solidity uses C3 linearisation, so the order of the parent list matters, from most base to most derived, and super calls the next contract in that order. Constructors of parents run first in linearised order.
22
How do you store an NFT image on IPFS and use it in your contract?
Upload the image to IPFS using a node or a pinning service, which returns a CID. Create a metadata JSON file whose image field is ipfs://<imageCID>, then upload the metadata folder to get a folder CID. Set the contract's base URI to ipfs://<folderCID>/ so tokenURI(5) resolves to the file for token 5. Pin the content with more than one provider, and use a gateway URL only for display in the front-end.
23
What is the difference between a full node, a light node and an archive node?
A full node downloads and validates every block and keeps the current state, so it can verify everything independently. A light node stores only block headers and asks full nodes for Merkle proofs of the data it needs, which suits mobile wallets. An archive node keeps all historical states, so you can query a balance at any past block; indexers and block explorers need it, but it requires many terabytes of storage.
24
What is the difference between a soft fork and a hard fork?
A soft fork tightens the rules so that new blocks are still valid for old nodes; it is backward compatible, like Bitcoin's SegWit upgrade. A hard fork changes the rules so that old nodes reject new blocks, so every node must upgrade or the chain splits, as with Ethereum and Ethereum Classic in 2016. Planned network upgrades on Ethereum, such as Dencun and Pectra, are coordinated hard forks that all clients adopt together.
25
What is the difference between optimistic rollups and zk-rollups?
Optimistic rollups assume batches are valid and allow a challenge window, typically about seven days, during which anyone can submit a fraud proof; this makes them EVM-compatible and simpler but slows native withdrawals. Zk-rollups submit a validity proof with each batch, so L1 verifies correctness mathematically and withdrawals finalise once the proof is accepted. Zk proving is computationally heavy and EVM equivalence was harder, though zkEVMs have matured a lot by 2026.
26
How does a constant product automated market maker work, and what is impermanent loss?
A constant product AMM holds two tokens with reserves x and y and keeps x times y equal to k. A trader adds one token and removes the other so that k stays constant after fees, which makes price equal to the reserve ratio and rise with trade size. Liquidity providers earn fees, but when prices move, arbitrage rebalances the pool, leaving them worse off than simply holding; that gap is impermanent loss.
27
Explain public, external, internal and private visibility.
public functions can be called externally and internally, and public state variables get an automatic getter. external functions can only be called from outside, or via this.f(), and read arguments directly from calldata. internal functions and variables are available to the contract and contracts that inherit it. private is limited to the defining contract only. Note that private only restricts other contracts; the data is still fully visible on the blockchain to anyone.
28
What is the difference between view, pure and payable functions?
A view function reads state but does not modify it, so it is free when called off-chain via eth_call. A pure function neither reads nor modifies state and works only on its inputs, for example a math helper. A payable function can receive ETH along with the call; non-payable functions revert if ETH is sent. View and pure functions still cost gas when called inside a state-changing transaction.
A Layer 2 is a network that executes transactions off the main chain and inherits security from it by posting data or proofs back to Layer 1. Ethereum Layer 1 handles only around 15 to 30 transactions per second at higher fees, so L2s batch thousands of transactions into one L1 submission, cutting fees to cents or less. Rollups are the main type. Users bridge assets from L1 to the L2 and can withdraw back.
30
Your fantasy sports contract needs live match scores. How do you get that data on-chain?
Smart contracts cannot call web APIs, so use an oracle. Options include a decentralised oracle network such as Chainlink Functions to fetch from several sports APIs and aggregate, or an optimistic oracle where results are proposed and can be disputed. Settle only after the match result is final, use multiple data sources, add a dispute window for high-value pools, and handle cancelled matches. Avoid a single back-end key posting results, which is a central point of failure.
Tips to crack the Tech Mahindra Blockchain interview
Read about telecom basics like 4G, 5G and network operations, since communications is Tech Mahindra's largest vertical.
Practise English essay and verbal ability sections, which often appear in Tech Mahindra online assessments.
Revise SQL and one programming language, and prepare a clear two-minute explanation of your project.
Keep a one-minute story ready for every project on your CV: problem, your part, tools, result.
Practise the hard questions on this page aloud; Tech Mahindra interviewers usually ask follow-ups on your first answer.
Frequently asked questions
How many rounds are there in the Tech Mahindra Blockchain interview?
Candidates usually go through 4 stages: Online assessment (aptitude + English essay); Coding test; Technical interview; HR round. The exact rounds change with the role, team, location and your experience, so confirm the process with the recruiter.
Which topics should I prepare for the Tech Mahindra Blockchain interview?
This practice set leans on Consensus and Scaling (5), dApp Development (5), Blockchain Fundamentals (5), DeFi, Tokens and NFTs (4). Revise those first, then practise explaining one or two of your own projects end to end, because most Tech Mahindra interviewers ask you to walk through real work.
Are these the exact questions asked at Tech Mahindra?
No. These are curated practice questions that match the skills and difficulty usually tested in it services interviews like Tech Mahindra's. They are not a leaked or verified list of past questions.
Where does Tech Mahindra hire Blockchain professionals in India?
Tech Mahindra has large teams in Pune, Hyderabad, Bengaluru, Noida, Chennai. Openings and locations change often, so check the Tech Mahindra careers page and filter by city and experience.