Verizon interview prep
7 practice questions on the topics candidates reported from Verizon interviews, with answers. The questions are ours; each one links to the interview report that names its topic.
DSA 1
-
Merge sort splits the array in half, sorts each half and merges them. What is its time complexity, and its extra space for an array?
- O(n log n) time in every case, with O(n) extra space for merging
- O(n^2) time in the worst case, with O(1) extra space
- O(n) time, with O(log n) extra space
- O(n log n) time on average but O(n^2) in the worst case
Show the answer
A. O(n log n) time in every case, with O(n) extra space for merging
There are log n levels of halving and each level merges n elements, whatever the input order. Merging needs a temporary array. Quick sort is the one that degrades to O(n^2).
This topic is named in a candidate’s interview report: Software developer interview, 2023, on GeeksforGeeks.
Java 1
-
How are the JDK, the JRE and the JVM related?
- The JDK contains the JRE plus tools such as javac; the JRE contains the JVM plus the standard libraries; the JVM runs bytecode
- The JVM contains the JDK
- The JRE is needed to compile Java, the JDK to run it
- They are three names for the same program
Show the answer
A. The JDK contains the JRE plus tools such as javac; the JRE contains the JVM plus the standard libraries; the JVM runs bytecode
You compile with the JDK's javac to bytecode; the JVM inside the JRE runs that bytecode. Recent Java versions ship the JDK (or a jlink-built runtime) rather than a separate JRE download.
This topic is named in a candidate’s interview report: On-campus interview, 2021, on GeeksforGeeks.
Python 1
-
What does this print?
s, p = "aaaaa", "aa" print(s.count(p), sum(1 for i in range(len(s)) if s.startswith(p, i)))- 4 4
- 2 2
- 2 4
- 4 2
Show the answer
C. 2 4
str.count counts non-overlapping matches: positions 0 and 2, so 2. Checking every starting position also finds the overlapping ones at 1 and 3, so 4.
This topic is named in a candidate’s interview report: On-campus interview, 2021, on GeeksforGeeks.
DBMS and SQL 2
-
What is the difference between GROUP BY and ORDER BY?
- They mean the same thing
- GROUP BY collapses rows with equal values into one row per group, usually with aggregates such as COUNT; ORDER BY only sorts the result rows
- ORDER BY removes duplicate rows
- GROUP BY sorts in descending order and ORDER BY in ascending order
Show the answer
B. GROUP BY collapses rows with equal values into one row per group, usually with aggregates such as COUNT; ORDER BY only sorts the result rows
SELECT dept, COUNT(*) FROM emp GROUP BY dept returns one row per department. Adding ORDER BY COUNT(*) DESC then sorts those rows; ORDER BY never changes how many rows there are.
This topic is named in a candidate’s interview report: Software developer interview, 2023, on GeeksforGeeks.
-
What is a trigger in SQL?
- A query that runs on a schedule, such as every night
- Code the database runs automatically when a chosen event, such as an INSERT, UPDATE or DELETE on a table, happens
- A constraint that stops NULL values
- Another name for a stored procedure the user calls by hand
Show the answer
B. Code the database runs automatically when a chosen event, such as an INSERT, UPDATE or DELETE on a table, happens
A trigger can run BEFORE or AFTER the event, for example to write an audit row whenever a salary changes. A stored procedure, by contrast, runs only when it is called.
This topic is named in a candidate’s interview report: On-campus interview, 2021, on GeeksforGeeks.
Aptitude 2
-
With a 3-litre and a 5-litre jug: fill the 5 and pour into the 3 until it is full, empty the 3, pour the 5's remainder into the 3, then fill the 5 again and top up the 3. How much is left in the 5-litre jug?
- 3 litres
- 2 litres
- 4 litres
- 1 litre
Show the answer
C. 4 litres
The first pour leaves 2 litres in the 5. Those 2 go into the empty 3, which then needs 1 more. Topping it up from a full 5 leaves exactly 4 litres.
This topic is named in a candidate’s interview report: On-campus interview, 2021, on GeeksforGeeks.
-
Why are manhole covers usually round?
- Round covers are cheaper to paint
- A circle has the same width in every direction, so the cover cannot fall through its own hole, and it can be rolled and placed at any angle
- Square covers are not allowed by law
- Round shapes are better for drainage
Show the answer
B. A circle has the same width in every direction, so the cover cannot fall through its own hole, and it can be rolled and placed at any angle
A square cover turned diagonally could drop through the opening, since its diagonal is longer than its side. A circle of constant width cannot.
This topic is named in a candidate’s interview report: On-campus interview, 2021, on GeeksforGeeks.