ISRO Scientist/Engineer SC (Computer Science) study materials
ISRO Scientist/Engineer SC (Computer Science) study resources

ISRO Scientist/Engineer SC (Computer Science) common mistakes

ISRO Scientist/Engineer SC (Computer Science) · Understand the traps and how to avoid them.

Mistake 1

In discrete-mathematics counting questions, computes the number of onto functions from a 4-element set to a 3-element set as 3^4 − 3 and stops, omitting the +3 correction term.

Applies inclusion–exclusion only to the first term and forgets the alternating signs and pairwise intersection terms.

What to do instead

Write out |A1∪A2∪A3| with all single and pairwise terms; for onto functions use 3^4 − C(3,1)2^4 + C(3,2)1^4 = 36. Practice identifying whether the question asks for all functions, injective functions, or surjective functions.

Mistake 2

In a Karnaugh map with don't-care cells, circles a quad made only of X cells and treats it as a valid implicant.

Don't-cares are optional values, but candidates optimize for the largest possible circle rather than ensuring every required 1 is covered by a group containing at least one 1.

What to do instead

Mark X cells clearly, but every chosen group must contain at least one 1. After minimization, verify that every 1 is covered and that no selected group consists solely of don't-cares.

Mistake 3

Predicts the output of `i = 5; printf("%d %d", i++, ++i);` as `5 7` by evaluating left to right.

Assumes a fixed evaluation order and ignores sequence points; modifying the same object twice without an intervening sequence point is undefined behaviour in C.

What to do instead

Do not evaluate such expressions. Learn sequence points and the rule that two modifications of the same scalar between sequence points are undefined. In exams, identify the expression as undefined behaviour rather than guessing an output.

Mistake 4

Solves a 0/1 knapsack problem by sorting items by value/weight ratio and taking items greedily until capacity is full.

Transfers the fractional-knapsack greedy rule to the 0/1 variant, where each item is indivisible and a high-ratio item can block a better combination.

What to do instead

Use dynamic programming over capacity: for each item, iterate weights downward and apply dp[w] = max(dp[w], dp[w−wt_i] + val_i). Reserve the ratio greedy method for fractional knapsack only.

Mistake 5

Classifies L = {a^n b^n c^n | n ≥ 1} as context-free because a PDA can push a's and then match b's and c's.

Assumes one stack can enforce two independent equalities. After matching the b's, the stack is empty, so the number of c's cannot be compared with the earlier counts.

What to do instead

Prove non-context-freeness using the pumping lemma for CFLs, or intersect with abc* and apply closure properties. Remember that a single stack cannot count three independent symbols.

Mistake 6

In Banker's algorithm, grants a resource request whenever Request ≤ Available, without first checking Request ≤ Need.

Focuses on currently free resources and forgets that a process cannot request more than its declared maximum claim.

What to do instead

Check Request ≤ Need first, then pretend to allocate and run the safety algorithm. Grant the request only if a safe sequence still exists; otherwise restore the old state and make the process wait.

Mistake 7

After finding that a relation is in 3NF, immediately declares it to be in BCNF without checking the determinants.

3NF permits a non-superkey determinant when the dependent attribute is prime; BCNF forbids every non-superkey determinant.

What to do instead

List all nontrivial functional dependencies and test each determinant. BCNF requires every determinant to be a superkey; if one is not, decompose the relation and recheck the resulting relations.

Mistake 8

For a subnet that must support 5 hosts, chooses /29 because 2^3 = 8 ≥ 5, then assigns the all-ones address to a host.

Forgets that each subnet reserves the network address and the directed broadcast address, so usable hosts are 2^h − 2.

What to do instead

Compute host bits from 2^h − 2 ≥ required hosts. For 5 hosts, h = 3 gives 6 usable addresses; reserve the first and last addresses and assign only the middle addresses to hosts.

Mistake 9

Equates cyclomatic complexity M with the number of test cases required to cover all execution paths through a module.

M gives the number of independent paths in a basis set, not the total number of paths, which can grow exponentially with loops and branches.

What to do instead

Use M as an upper bound for basis-path testing: identify M independent paths and design tests for them. Do not claim exhaustive path coverage from M alone.

Mistake 10

Uses `==` to compare a JavaScript variable with a number and expects strict type equality, for example expecting `'0' == 0` to be false.

Confuses loose equality, which performs type coercion, with strict equality, which compares both type and value.

What to do instead

Use === and !== for comparisons unless coercion is explicitly intended. Remember that '0' == 0 is true, while '0' === 0 is false; also check null and undefined behaviour separately.