3 Key Concepts for Junior Dev Job Interviews

Paulo D’Alberti
6 min readDec 13, 2019

In our first guide we looked at how to maximize your chances of landing a job interview for a junior dev position while attending the Le Wagon coding bootcamp in Tokyo. In this guide we’ll look at 3 concepts, which you need to understand well and present well, in order to convert that job opportunity into an actual job.

Before we start let’s make clear what this article is not: it’s not a silver bullet, that will land you any job you apply for. Also, since everyone tries to make the job interview process unique, it might happen that one or more of these concepts won’t appear in your specific interview. But they are still the most common (or in a way the most basic), so it pays to know about them. With that out of the way, let’s take a look at the 3 concepts:

Order of Operation

Often you’ll see pictures similar to this being shared on social media. This is a typical “gotcha” on order of operation.

The first concept is the bread and butter of programming. In its simplest forms, it’s about how different operations have a different “weight”. Those with a higher weight will be calculated before those with a lower weight, even if they are written at a later position. You probably know this from your Math classes, where they taught you that 2 + 3 * 4 is the same as 2 + 4 * 3, but completely different than 3 + 2 * 4. That’s because multiplication has a higher weight than addition and thus gets calculated first (to better picture it, you could write is as 2 + (3 * 4)).

While you probably won’t get any exercise testing you specifically on this concept, you’d be better off quickly reviewing it and keeping an eye out for it. To help you prepare, here is a table with the operation priority for Ruby:

So let say we have a more complex operation like:

result = subcount || 10 / 10 - 2**3

First you would evaluate the operator with the highest weight — the exponentiation (2**3), then move into the division (10 / 10), subtraction ((10 / 10) - (2**3)), logical “or” (subcount || ( (10 / 10) - (2**3) )), and finally the assignment for an operation that covered in parentheses would look like this:

result = ( subcount || ( (10 / 10) - (2**3) ) )

As you can see, whenever you are unsure about the execution just add some parentheses around the operations you’d like to evaluate first.

Control Flow

Control flow is about the order in which individual statements, definitions, methods and the similar are executed or evaluated. In Ruby (and almost all the programming languages) the control flow goes from top to bottom, so if you write something like:

num = 1num = 2num = 3

The final value of num will be 3.

Despite the apparent simplicity of this concept, it’s something so many people seem to struggle, that they even created an exercise specifically for this: FizzBuzz. The exercise is pretty simple: create a method that prints numbers from 1 to 100, but substitute the number for Fizz if it’s divisible by 3, Buzz if by 5, and FizzBuzz if both by 3 and 5. The tricky part is to realize where you want to write the last condition. If you were for example to write it like this:

def FizzBuzz
counter = 1
until counter >= 100
if counter % 3 == 0
puts "Fizz"
elsif counter % 5 == 0
puts "Buzz"
elsif counter % 3 == 0 && counter % 5 == 0
puts "FizzBuzz"
else
puts counter
end
counter += 1
end
end

When the counter would get to 15 (which is divisible both by 3 and 5), it would still print just “Fizz”. That’s because due to the control flow, it would go checking which conditions apply from top to bottom, stopping at the first applicable one, and never reaching the one we wanted. To prevent this from happening write your more specific conditions above the less specific ones. In this case the condition to print “FizzBuzz” is the most specific one as it launches based on 2 conditions, so it should come first.

Another example for practice (where you’ll also practice the Time class): a store is open on weekdays from 9 to 12 and from 2 to 6, and on Saturday from 10 to 4 continuously. Write a method that takes a Time instance as a parameter, and returns “Open” or “Closed”. I prepared the file and tests in Ruby for you, so you can just go ahead and fork it.

Oddly enough, a good way to practice Control Flow outside of programming is through trading card games such as Magic: the Gathering. Stop by the fellas at Tokyo MTG and they’ll be more than happy to tell you all about it. Also, if you are the type of person who likes to get its mind blown by high level deep dives, check this article on FizzBuzz.

Recursion

How do you write a looping behaviour, without using any iterators (for … in, until, while, each, times do, etc.)? For example, how would you write a method that takes an integer x as a parameter and prints all numbers from x until 1? Hint: if you are trying to think of a workaround like puts (1..x).to_a.reverse, that’s not looping ;-)

The answer is with recursion. Recursion is when a thing is defined in terms of itself or its type. In programming (more concretely in Ruby) it’s calling a method inside the same method. So for the example above the solution would be something like:

def countdown(x)  puts x  countdown(x — 1) unless x <= 0end

Let’s unpack what’s going on here. The method will print the initial number with which we called it, and then call itself again with the number reduced by one. This continues until it reaches the stopping condition (so you avoid an infinite loop) — in this case until it reaches 0.

Want to see something cool? Try swapping the order of line 2 and 3, run the method, and see what it produces.

Recursion is almost a low blow, because it’s something you might not ever use when building applications, yet a lot of interviewers looooove to test you on it. So take some time to get acquainted with how to use recursion and be on guard for exercises that directly or indirectly ask you to apply it.

If you need more practice, here is another example: Write a method using recursion that takes a parameter (max) and sums all Fibonacci numbers that are smaller than max. As before, here is the exercise to fork.

— — — — — — — — — — — —

And that’s all from my side. Did you like it? Think I’m missing something or disagree with some of my points? Tell me in the comments below or shoot me a message here. Also share with me your success stories, I’d love to hear them!

Now there is nothing left for me to say other than to wish you good luck on your hunt, and hope to hear from you soon!

--

--