Walmart interview prep
6 practice questions on the topics candidates reported from Walmart interviews, with answers. The questions are ours; each one links to the interview report that names its topic.
DSA 1
-
Print the matrix [[1, 2, 3], [4, 5, 6], [7, 8, 9]] in spiral order, starting at the top-left and moving right.
- 1 2 3 4 5 6 7 8 9
- 1 2 3 6 9 8 7 4 5
- 1 4 7 8 9 6 3 2 5
- 1 2 3 6 5 4 7 8 9
Show the answer
B. 1 2 3 6 9 8 7 4 5
Go right along the top row, down the right column, left along the bottom row and up the left column, then repeat inside. Keep four bounds (top, bottom, left, right) and move one inward after each side.
This topic is named in a candidate’s interview report: SDE on-campus interview, 2024, on GeeksforGeeks.
DBMS and SQL 1
-
Table a has ids 1, 2 and 3. Table b has ids 2, 3 and 4. How many rows does this query return?
SELECT a.id, b.id FROM a FULL OUTER JOIN b ON a.id = b.id;- 2
- 4
- 3
- 6
Show the answer
B. 4
Ids 2 and 3 match, giving two rows. Id 1 appears with NULL for b, and id 4 with NULL for a. An INNER JOIN would return 2 rows and a LEFT JOIN 3.
This topic is named in a candidate’s interview report: SDE on-campus interview, 2024, on GeeksforGeeks.
Computer networks 2
-
At which OSI layer does IP routing happen?
- Data link (2)
- Network (3)
- Transport (4)
- Application (7)
Show the answer
B. Network (3)
Routers read IP addresses and forward packets between networks at layer 3. Switches work at layer 2 with MAC addresses.
This topic is named in a candidate’s interview report: SDE on-campus interview, 2024, on GeeksforGeeks.
-
A message reaches a phone. Which OSI layer gets it to the right app on that phone, rather than just to the phone?
- Network (3), using IP addresses
- Data link (2), using MAC addresses
- Transport (4), using port numbers
- Physical (1), using signals
Show the answer
C. Transport (4), using port numbers
IP addresses at layer 3 get packets to the right device. Port numbers in TCP or UDP at layer 4 hand them to the right program on it. MAC addresses at layer 2 only carry a frame across one link, such as phone to Wi-Fi router.
This topic is named in a candidate’s interview report: SDE on-campus interview, 2024, on GeeksforGeeks.
Web development 1
-
What does this JavaScript print?
var fns = []; for (let i = 0; i < 3; i++) fns.push(() => i); var g = []; for (var j = 0; j < 3; j++) g.push(() => j); console.log(fns.map((f) => f()).join(""), g.map((f) => f()).join(""));- 012 012
- 333 333
- 012 333
- 333 012
Show the answer
C. 012 333
let is block-scoped, so each loop iteration gets its own i and each arrow remembers 0, 1 and 2. var is function-scoped: all three arrows share one j, which is 3 after the loop.
This topic is named in a candidate’s interview report: Entry-level SDE interview, 2024, on Reddit.
Aptitude 1
-
How many positive factors does 36 have?
- 9
- 8
- 6
- 12
Show the answer
A. 9
36 = 2 x 2 x 3 x 3, so it has (2 + 1) x (2 + 1) = 9 factors: 1, 2, 3, 4, 6, 9, 12, 18 and 36. Only perfect squares have an odd number of factors, because the square root pairs with itself.
This topic is named in a candidate’s interview report: SDE on-campus interview, 2024, on GeeksforGeeks.