Curated interview practice questions with answers. These are practice scenarios, not a verified list of past interview questions.
About Cognizant hiring for Blockchain roles
Cognizant is a US-headquartered IT services and consulting company with most of its workforce based in India. It provides application development, testing, cloud, digital engineering and data analytics services, with strong practices in healthcare, insurance and banking. In India it hires for programmer analyst, quality engineer and data roles through campus and off-campus programmes such as GenC.
For Blockchain roles, this Cognizant practice set focuses most on DeFi, Tokens and NFTs (5), Smart Contract Security (5), Blockchain Fundamentals (4), Consensus and Scaling (4). It has 16 easy, 13 medium, 1 hard questions, so you can start easy and work up to the harder ones.
Company type
IT services
Headquarters
Teaneck, New Jersey, USA
Main India offices
Chennai, Bengaluru, Pune, Hyderabad, Kolkata
Cognizant Blockchain interview process
Online assessment (aptitude + reasoning)
Coding assessment
Technical interview
HR round
Typical pattern based on public candidate experiences. Rounds vary by role, team and year.
Solved for CognizantStart 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.
✓ 3 questions free • Unlock the rest in seconds
01
You open a transaction on a block explorer. Which fields do you check and what do they mean?
Check the status (success or failed), the block number and confirmations, from and to addresses, and the value transferred. For contract calls, check the decoded input data and emitted event logs, which show token transfers. Check the gas limit, gas used and effective gas price, which together give the fee paid, plus the nonce. If the status failed, the revert reason tells you why, while fees are still charged for gas used.
02
Write a Foundry unit test and a fuzz test for a contract.
Foundry tests are Solidity contracts; functions starting with test run as tests, and parameters make them fuzz tests.
import {Test} from 'forge-std/Test.sol';
import {Vault} from '../src/Vault.sol';
contract VaultTest is Test {
Vault v;
function setUp() public { v = new Vault(); }
function testDeposit() public {
v.deposit{value: 1 ether}();
assertEq(v.balanceOf(address(this)), 1 ether);
}
function testFuzzDeposit(uint96 amt) public {
vm.assume(amt > 0);
vm.deal(address(this), amt);
v.deposit{value: amt}();
assertEq(address(v).balance, amt);
}
}
Run with forge test -vvv.
03
A retail brand wants to give customers loyalty points as blockchain tokens. How would you design it?
Keep it simple for non-crypto users. Use a low-fee Layer 2 or a permissioned chain, and create wallets automatically with account abstraction or embedded wallets linked to phone login, so customers never handle seed phrases. Sponsor gas through a paymaster. Make points a non-transferable or restricted ERC-20 if resale is not intended, to avoid VDA tax and securities issues. Keep customer data off-chain and show points in the brand's normal app.
04
What is a consensus mechanism and why does a blockchain need one?
A consensus mechanism is the set of rules that lets thousands of independent nodes agree on one order of transactions and one current state, even when some nodes are faulty or malicious. Without it, two nodes could accept conflicting transactions and double spending would be possible. Common mechanisms are Proof of Work, Proof of Stake, Proof of Authority and BFT protocols like PBFT, Tendermint and Raft, each trading off decentralisation, speed and fault tolerance.
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.
06
How did integer overflow bugs happen before Solidity 0.8?
Before 0.8, arithmetic wrapped silently: a uint8 at 255 plus 1 became 0, and 0 minus 1 became the maximum value. Attackers exploited this, for example by making a balance underflow to a huge number or an overflowed multiplication pass a check, as in the 2018 batchOverflow token bug. Developers used the SafeMath library to revert on overflow. Since 0.8 the compiler checks automatically, except inside unchecked blocks and in inline assembly.
07
What are state channels, such as the Lightning Network?
A state channel locks funds in an on-chain contract or multisig between parties, who then exchange many signed off-chain updates and settle only the final state on-chain. Lightning on Bitcoin links channels into a network so payments route through intermediaries using hashed timelock contracts. Channels give instant, nearly free payments but need participants to be online or use watchtowers, and they lock liquidity, so they suit repeated payments between known parties rather than general smart contracts.
Events are declared in Solidity and emitted with emit; the EVM writes them as logs in the transaction receipt. Each log has the contract address, up to three indexed topics plus the event signature hash, and non-indexed data. Logs are much cheaper than storage but contracts cannot read them. Front-ends and indexers subscribe to events to update the UI, track token transfers and build history, so emitting clear events for every state change is good practice.
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 would you implement Sign-In with Ethereum on a web back-end?
Follow EIP-4361. The server generates a random nonce and stores it in the session. The front-end builds a SIWE message with domain, address, statement, URI, chain ID, nonce and issued-at time, and the wallet signs it. The server verifies the signature with a SIWE library, checks domain, nonce, expiry and chain, then issues a session cookie or JWT and deletes the nonce. For smart contract wallets, verify via ERC-1271 isValidSignature.
11
What is a digital signature and what does it guarantee?
A digital signature is a value produced by signing a message hash with a private key. Anyone with the public key can verify it. It guarantees authentication (the holder of the key signed it), integrity (the message was not changed, since any change breaks verification) and non-repudiation (the signer cannot later deny it). In blockchain, every transaction is signed, so nodes accept a transfer only if the signature matches the sending account.
12
Why do you want to work in DeFi, given its risks and volatility?
I am drawn to DeFi because it turns financial products into open, auditable code, and that combination of finance and engineering motivates me. I understand the risks: hacks, market crashes and regulatory change. That is why I have focused on security, testing and risk thinking, not just writing contracts. I see volatility as a reason to build carefully. I want to work on a team that values audits, monitoring and user protection.
13
What are Delegated Proof of Stake and Proof of Authority?
In Delegated Proof of Stake, token holders vote for a small set of block producers who validate on their behalf, giving high throughput but more centralisation. In Proof of Authority, a fixed set of known, reputable validators sign blocks; their identity, not stake, is at risk. PoA, often via Clique, IBFT or QBFT, suits private and consortium EVM networks and some testnets, where participants are known and fast, predictable block times matter more than open participation.
14
Write a simple escrow contract where a buyer deposits and releases payment to a seller.
It is an ordering rule for functions. First do checks: validate inputs, permissions and balances with require. Then apply effects: update all state variables, such as reducing the user's balance. Only then do interactions: external calls, token transfers or ETH sends. Because state is already updated, a re-entering call sees the new state and cannot repeat the action. Combine it with a nonReentrant modifier for defence in depth, especially in functions calling unknown contracts.
The mempool is each node's waiting area for valid transactions that have been broadcast but not yet included in a block. Block producers usually pick transactions paying the highest fees or priority tips. Every node has its own mempool, so contents can differ slightly. Because pending transactions are public, bots can watch the mempool and front-run trades, which is why private transaction relays and order-flow auctions are used for sensitive transactions.
17
How can a smart contract suffer denial of service?
Common causes: loops over arrays that grow with users until they exceed the block gas limit; push payments in a loop where one reverting recipient blocks everyone; relying on an external call that an attacker can make fail; and griefing by filling storage cheaply. For example, an auction that refunds the previous bidder will freeze if that bidder is a contract that reverts. Use pull payments, bounded loops, pagination and failure isolation.
I see myself as a senior smart contract engineer, owning the design and security of production protocols and mentoring juniors. In the next two years I want to master Solidity, testing and audit techniques, and contribute to open source. Later I would like to specialise in security or Layer 2 infrastructure. I hope to grow inside a team like this one, where the work is real and the standards are high.
19
What is a hash collision and why does it matter for blockchains?
A collision is when two different inputs produce the same hash. If attackers could find collisions, they could swap one transaction or block for another with the same hash and break integrity, Merkle proofs and address uniqueness. For SHA-256 and Keccak-256, finding a collision needs about 2^128 work, which is infeasible. This is why older broken hashes such as MD5 and SHA-1 must never be used in blockchain systems.
Reentrancy happens when a contract makes an external call, such as sending ETH, before updating its own state, and the receiver calls back into the contract to repeat the action. For example, a withdraw that sends funds and then sets the balance to zero can be re-entered to withdraw many times. The 2016 DAO hack drained millions this way. Prevent it with checks-effects-interactions, reentrancy guards, and pull payments.
21
What does a smart contract audit process look like?
It starts with scoping: fixed commit, documentation, threat model and test coverage. Auditors run automated tools like Slither and fuzzers, then do manual line-by-line review, checking business logic, access control, economic attacks and integrations. They write findings rated critical, high, medium, low and informational with fixes. The team fixes issues, auditors review the fixes, and a final report is published. Audits reduce risk but do not guarantee safety, so add bug bounties and monitoring.
22
How do you calculate a borrower's health factor in a lending protocol?
Health factor = (sum of collateral value x liquidation threshold) / total debt value. Below 1, the position can be liquidated.
Example: collateral 10 ETH at 3,000 dollars = 30,000 dollars, liquidation threshold 80 percent, debt 18,000 dollars of stablecoins.
HF = (30,000 x 0.80) / 18,000 = 1.33.
If ETH falls to 2,250, collateral is 22,500, so HF = 18,000 / 18,000 = 1.0 and liquidation begins. Users raise HF by repaying debt or adding collateral.
23
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.
The Merge, completed in September 2022, switched Ethereum from Proof of Work to Proof of Stake by joining the original execution chain with the Beacon Chain, which had been running PoS since December 2020. Mining ended, energy use fell by more than 99.9 percent, and new ETH issuance dropped sharply. Block times became a fixed 12 seconds. Staked ETH withdrawals were enabled later in the Shapella upgrade of April 2023.
25
How is public-key cryptography used in blockchain?
Each user has a private key, kept secret, and a public key derived from it. The private key signs transactions, and anyone can verify the signature with the public key, proving the owner authorised the transfer without revealing the private key. Addresses are derived from public keys. Because control of funds equals control of the private key, losing it means losing access, and leaking it means anyone can spend the funds.
26
What are the main components of Hyperledger Fabric?
Hyperledger Fabric is a permissioned enterprise framework. Peers hold the ledger and run chaincode (smart contracts written in Go, Java or JavaScript). Orderers, usually using Raft, sequence transactions into blocks. A Membership Service Provider issues identities through certificate authorities. Channels give separate private ledgers to subsets of members, and private data collections hide data inside a channel. Fabric uses an execute-order-validate flow with endorsement policies instead of mining.
A blockchain is a distributed, append-only ledger where records are grouped into blocks and each block stores the hash of the previous block, forming a chain. Many independent nodes keep a copy and agree on new blocks through a consensus protocol, so no single party controls the data. Changing an old block would change its hash and break every later link, which makes tampering easy to detect. Bitcoin and Ethereum are the best known public examples.
28
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.
29
How do you get current fee data and send an EIP-1559 transaction with ethers.js?
Situation: a user sent tokens to the contract address directly instead of using deposit, and they were stuck. Task: support him honestly. Action: I listened, explained calmly what happened without blaming him, checked whether a recovery function existed, and escalated to the team. We had a rescue function for stray tokens behind the multisig, so after verification we returned them. Result: he thanked us publicly, and we added a front-end warning.
Tips to crack the Cognizant Blockchain interview
Understand the GenC, GenC Next and GenC Elevate tracks so you know which skills and coding level each role expects.
Revise SQL queries, OOP concepts and basic testing terminology since many freshers are placed in development or QA projects.
Read about Cognizant's healthcare and life sciences domain work, which is a large part of its client base.
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; Cognizant interviewers usually ask follow-ups on your first answer.
Frequently asked questions
How many rounds are there in the Cognizant Blockchain interview?
Candidates usually go through 4 stages: Online assessment (aptitude + reasoning); Coding assessment; 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 Cognizant Blockchain interview?
This practice set leans on DeFi, Tokens and NFTs (5), Smart Contract Security (5), Blockchain Fundamentals (4), Consensus and Scaling (4). Revise those first, then practise explaining one or two of your own projects end to end, because most Cognizant interviewers ask you to walk through real work.
Are these the exact questions asked at Cognizant?
No. These are curated practice questions that match the skills and difficulty usually tested in it services interviews like Cognizant's. They are not a leaked or verified list of past questions.
Where does Cognizant hire Blockchain professionals in India?
Cognizant has large teams in Chennai, Bengaluru, Pune, Hyderabad, Kolkata. Openings and locations change often, so check the Cognizant careers page and filter by city and experience.