What is the key difference between composition and inheritance for reusing code?
Anonymous Quiz
4%
They are functionally identical
92%
Inheritance is 'is-a' and couples tightly; composition is 'has-a' and flexible
4%
Composition can only be used in functional languages
0%
Inheritance is always the better choice
Topic: Debugging & Code Output
🔍 Quick look before the question:
🔍 Quick look before the question:
def modify(lst):
lst.append(100)
lst = [1, 2, 3]
lst.append(200)
original = [0]
modify(original)
print(original)
Why might an interviewer intentionally give you an ambiguous or underspecified problem?
Anonymous Quiz
5%
Because they forgot to write a clear problem statement
91%
To see how you handle ambiguity and clarify requirements
5%
Because ambiguous problems are always impossible to solve
0%
It has no intentional purpose
What does idempotent mean for a function or operation, outside the specific API context?
Anonymous Quiz
12%
It runs exactly once and then can never run again
77%
Applying it repeatedly gives the same result as applying it once
12%
It always returns void
0%
It can only take zero arguments
Why might explaining your algorithm's time and space complexity unprompted be a good habit in a coding interview?
Anonymous Quiz
5%
It's unnecessary and wastes time
81%
It shows you're thinking about efficiency, not just correctness
10%
Interviewers always ask for it explicitly, so it's redundant
5%
It's only relevant for senior-level roles
Which collection interface in Java does not allow duplicate elements?
Anonymous Quiz
15%
List
70%
Set
7%
Map
7%
Queue
What is a key difference between arrow functions and regular functions regarding 'this'?
Anonymous Quiz
22%
Arrow functions get their own 'this' bound at call time, just like regular functions
69%
Arrow functions don't have their own 'this'; they inherit it lexically from the surrounding scope
3%
Regular functions never have access to 'this'
6%
There is no meaningful difference
Topic: Java
🔍 Quick look before the question:
🔍 Quick look before the question:
public class Test {
static int counter = 0;
static synchronized void increment() {
counter++;
}
public static void main(String[] args) throws InterruptedException {
Thread t1 = new Thread(() -> {
for (int i = 0; i < 1000; i++) increment();
});
Thread t2 = new Thread(() -> {
for (int i = 0; i < 1000; i++) increment();
});
t1.start(); t2.start();
t1.join(); t2.join();
System.out.println(counter);
}
}
What will counter reliably print, and why?
Anonymous Quiz
35%
Some unpredictable number less than 2000, because of a race condition
35%
Exactly 2000, since synchronized serializes the increments
18%
Exactly 1000, because only one thread actually runs
12%
0, because static fields can't be modified by threads
What does the SQL DISTINCT keyword do?
Anonymous Quiz
7%
Sorts results
83%
Removes duplicate rows
3%
Groups rows
7%
Filters null values
What does Array.prototype.map() return?
Anonymous Quiz
18%
The same array modified in place
68%
A new array with transformed elements
8%
A single combined value
5%
Undefined
Topic: Debugging & Code Output
🔍 Quick look before the question:
🔍 Quick look before the question:
for i in range(5):
if i == 3:
continue
print(i)
Topic: SQL
🔍 Quick look before the question:
🔍 Quick look before the question:
BEGIN TRANSACTION;
UPDATE accounts SET balance = balance - 200 WHERE id = 1;
UPDATE accounts SET balance = balance + 200 WHERE id = 2;
COMMIT;
Why is wrapping both UPDATEs in a single transaction important here?
Anonymous Quiz
13%
It makes the two statements run faster
87%
It ensures both updates succeed or both roll back together
0%
It only matters for SELECT statements
0%
It has no functional effect, just style
Topic: Debugging & Code Output
🔍 Quick look before the question:
🔍 Quick look before the question:
def outer():
result = []
for i in range(3):
def inner():
return i
result.append(inner)
return [f() for f in result]
print(outer())
What does this print?
Anonymous Quiz
40%
[0, 1, 2]
35%
[2, 2, 2]
5%
[0, 0, 0]
20%
This raises a NameError