Interview Questions Flashcards

1
Q

Things to consider in whiteboard interviews while trying to understand the problem

A

if the input is a string or an array, could it be empty? If so, what should the output be?
if the input is a number, could it be negative or zero? If so, what should the output be?
if the input is an array, is it sorted?
if the input is a number, could it be an integer or a decimal?
if the input is an array, could it contain duplicate elements?

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Example Pseudo Code

A

Define a function named sumAll that takes an array of numbers and returns their sum.

declare variable to hold the sum, initialized at 0
use a loop to iterate through the array from beginning to end
for each number in the array:
add the number to the current sum
assign the result of the addition back to the sum
after the loop completes, return the final value of sum

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Steps to take when you first get the problem from interviewer

A
Write down the prompt.
Understand the problem.
Write pseudo-code for a solution.
Translate the pseudo-code to actual code.
Trace the code with example inputs.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Common types of technical questions asked

A

variables
conditionals
loops
primitive data (booleans, numbers, strings)
collections (objects, arrays, and maybe a couple of other data structures)
functions / methods

How well did you know this?
1
Not at all
2
3
4
5
Perfectly