Typical OA structure at Indian product companies?
60-90 minutes: 2-3 coding problems (Easy-Med-Hard), sometimes 10-20 MCQs (DSA output, OS, DBMS, CN, aptitude). Partial scores count, because test cases are scored individually. (Easy)
Career & Behavioral · 6 sections
Campus online assessments end to end: timing strategy, fast I/O, overflow and maths shortcuts, plus the JavaScript, Python and Java output-prediction tricks that decide the MCQ round.
60-90 minutes: 2-3 coding problems (Easy-Med-Hard), sometimes 10-20 MCQs (DSA output, OS, DBMS, CN, aptitude). Partial scores count, because test cases are scored individually. (Easy)
Read all problems first. Solve the easiest fully, then brute-force the others to collect partial test cases, then optimise. Watch the constraints for the intended complexity. (Easy)
Not handling n = 0/1, duplicates, negative numbers, integer overflow, off-by-one in binary search, printing extra spaces or debug output, reading input in the wrong format. (Easy)
Webcam on, no tab switching (often logged), no second screen or phone. Plagiarism checks compare code across candidates, so even "similar" code gets flagged. Write your own. (Easy)
Test your laptop, webcam and internet, have a backup hotspot, keep a language template ready (fast I/O, typedefs), revise 10 patterns (Deck 7), sleep. Log in 15 minutes early. (Easy)
C++: `ios::sync_with_stdio(false); cin.tie(nullptr);`. Java: `BufferedReader` + `StringTokenizer` (or DataInputStream). Python: `input = sys.stdin.readline`. Use `print` with join. (Easy)
// C++
ios::sync_with_stdio(false); cin.tie(nullptr);
// Python
import sys
input = sys.stdin.readline
Sums and products past 2.1×10⁹ overflow int. 10⁵ × 10⁹ = 10¹⁴ needs 64-bit. Take mod 1e9+7 after each multiplication: `(a*b)%MOD` with 64-bit operands. (Easy)
const long long MOD = 1e9 + 7;
long long r = (a * b) % MOD; // 64-bit operands
The default recursion limit is ~1000. Use `sys.setrecursionlimit(10**6)` (and possibly threading with a larger stack), or convert to an iterative stack. (Med)
import sys
sys.setrecursionlimit(10**6)
Binary exponentiation, O(log b). (Python has a built-in `pow(a, b, m)`.) (Easy)
def power(a, b, m):
r = 1; a %= m
while b:
if b & 1: r = r * a % m
a = a * a % m; b >>= 1
return r
O(n log log n). Mark multiples starting from i², loop i up to √n. Good for n ≤ 10⁷. (Easy)
is_prime = [True] * (n + 1)
for i in range(2, int(n ** 0.5) + 1):
if is_prime[i]:
for j in range(i * i, n + 1, i):
is_prime[j] = False
Precompute factorials and inverse factorials (Fermat: inv = a^(p−2) mod p for prime p). Then nCr = fact[n]·inv[r]·inv[n−r]. O(1) per query. (Med)
fact[0] = inv[0] = 1
for i in range(1, n + 1):
fact[i] = fact[i - 1] * i % p
inv[n] = pow(fact[n], p - 2, p)
for i in range(n, 0, -1):
inv[i - 1] = inv[i] * i % p
# nCr = fact[n] * inv[r] % p * inv[n - r] % p
54 km/h = 15 m/s, so 150/15 = 10 s. (km/h × 5/18 = m/s.) (Easy)
km/h * 5/18 = m/s
54 * 5/18 = 15 m/s
150 / 15 = 10 s
A process has its own address space. Threads share memory, heap and files within a process but have their own stack and registers. Thread context switches are cheaper. (Easy)
1NF atomic values. 2NF no partial dependency on part of a composite key. 3NF no transitive dependency. BCNF every determinant is a candidate key. (Easy)
1NF -> atomic
2NF -> no partial dependency
3NF -> no transitive dependency
BCNF -> every determinant is a candidate key
TCP: connection-oriented, reliable, ordered, flow and congestion control (HTTP/1.1, HTTP/2). UDP: connectionless, no guarantees, low latency (DNS, video, QUIC/HTTP/3 builds reliability on top of UDP). (Easy)
**1 4 3 2**. Sync code runs first, then the microtask queue (promises), then macrotasks (timers).
console.log(1);
setTimeout(() => console.log(2));
Promise.resolve().then(() => console.log(3));
console.log(4);
**3 3 3**. `var` is function-scoped, so there is one shared `i`. With `let` the output is **0 1 2** — a new binding per iteration.
for (var i = 0; i < 3; i++) setTimeout(() => console.log(i));
**[1, 10, 2]**. The default sort compares elements as strings. Use `.sort((a, b) => a - b)` for numeric order.
[10, 1, 2].sort()
`"object"` (a historic bug), `"number"`, `"object"` (use `Array.isArray` to detect arrays).
typeof null
typeof NaN
typeof []
**false, true**. `==` has special null/undefined rules (`null` only equals `undefined`), while relational operators convert `null` to `0`.
null == 0
null >= 0
`3`, `"52"`, `0`. `-` coerces to number; `+` with a string concatenates; unary `+` converts to number.
"5" - 2
"5" + 2
+""
`false, true, true, -1`. `includes` uses SameValueZero; `indexOf` uses `===`.
NaN === NaN
Object.is(NaN, NaN)
[NaN].includes(NaN)
[NaN].indexOf(NaN)
**ReferenceError**. The inner `x` is hoisted but sits in the temporal dead zone until its declaration.
let x = 1;
{
console.log(x);
let x = 2;
}
**2 vs 1**. `.length` counts UTF-16 code units; spreading iterates code points.
"\u{1F44D}".length
[..."\u{1F44D}"].length
`undefined`, `1`. Arrow functions take `this` from the enclosing scope, not from the object.
const o = {
n: 1,
f: () => this.n,
g() { return this.n; }
};
o.f();
o.g();
A **Promise** (fulfilled with `1`), not `1`. Use `await f()` or `.then`.
async function f() { return 1; }
console.log(f());
`false` — the sum is `0.30000000000000004`. Compare with `Math.abs(a - b) < Number.EPSILON`, or use integer paise for money.
0.1 + 0.2 === 0.3
**[2, 2, 2]**. Late binding: closures look up `i` at call time. Fix with `lambda i=i: i`.
fs = [lambda: i for i in range(3)]
print([f() for f in fs])
`[[1, 0, 0], [1, 0, 0], [1, 0, 0]]`. The three rows are the same list object. Use `[[0] * 3 for _ in range(3)]`.
a = [[0] * 3] * 3
a[0][0] = 1
print(a)
**-4 1**. Floor division rounds towards −∞, and `%` takes the sign of the divisor (C and Java give `-3, -1`).
print(-7 // 2, -7 % 2)
**2 4**. Banker's rounding (round half to even).
print(round(2.5), round(3.5))
**{1: 'c'}**. `1 == True == 1.0` and they hash the same, so the first key object is kept and the value is overwritten.
d = {1: 'a', True: 'b', 1.0: 'c'}
print(d)
Raises **TypeError**, yet `t` is now `(1, [2, 3])`. `+=` mutates the list in place first, then the tuple item assignment fails.
t = (1, [2])
t[1] += [3]
**2**. `finally` overrides the return. Python 3.14 emits a **SyntaxWarning** for `return`/`break`/`continue` in `finally` (PEP 765).
def f():
try:
return 1
finally:
return 2
**True False** — vacuous truth.
print(all([]), any([]))
`''` and `'abc'`, because slices clamp. `s[10]` raises `IndexError`.
s = "abc"
print(s[10:], s[-10:])
print(s[10])
**None**. `list.sort()` sorts in place and returns `None`; `sorted(x)` returns a new list.
x = [3, 1, 2]
y = x.sort()
print(y)
`<class 'int'>`, `<class 'tuple'>`. The comma makes the tuple, not the parentheses.
print(type((1)), type((1,)))
**a12** and **3a**. Evaluation is left to right; arithmetic happens only until a String appears.
System.out.println("a" + 1 + 2);
System.out.println(1 + 2 + "a");
**5**. `x++` yields the old value 5, and then that 5 is assigned back over the incremented value.
int x = 5;
x = x++;
System.out.println(x);
**-2147483648**. `+2³¹` overflows int. Use `Math.absExact` (throws) or cast to long.
System.out.println(Math.abs(Integer.MIN_VALUE));
The first is a **compile error** (int to short narrowing). The second compiles, because compound assignment includes an implicit cast.
short s = 1;
s = s + 1; // compile error
s += 1; // ok
**false, true**. Literals are pooled; `new` creates a heap object; `intern()` returns the pooled one.
String a = "hi";
String b = new String("hi");
a == b;
a == b.intern();
Throws **UnsupportedOperationException**. `List.of` is immutable (and rejects nulls).
List.of(1, 2).add(3);
Usually a **ConcurrentModificationException** (fail-fast iterator). Use `list.removeIf(cond)` or `Iterator.remove()`.
for (String s : list) {
if (cond) list.remove(s);
}
The first throws **ArithmeticException**. The second prints **Infinity** (IEEE 754).
System.out.println(1 / 0);
System.out.println(1.0 / 0);
**98** and **b**. `char + int` promotes to int; the cast converts back to a character.
char c = 'a';
System.out.println(c + 1);
System.out.println((char) (c + 1));
Want this as flashcards? Study these 47 cards recall-first in the browser — flip, answer out loud, grade yourself.
What's new and the interview questions people are actually getting asked. No spam.