DEV Community

Cover image for Interview questions. Are they wrong?
Victor
Victor

Posted on

Interview questions. Are they wrong?

In this article, I'm going to share a controversial opinion about interview questions. I understand that I may be wrong, and I'm not claiming that this is 100% true for most cases.

It's applied not only for web development but since I'm a web dev, I'll show examples based on my experience.

What's wrong with the interview questions?

I've been working as a web dev for almost ten years. I've started working in 2011 when I graduated. My tech stack hasn't changed from that time. I still use PHP/MySQL & javascript mostly.

From time to time, I hear about interview questions asked in small/mid-sized companies.

And here is the confusion: while I've been developing web apps, I really haven't used or written such code samples as interviewers ask me to write or explain.

I don't understand this.

For example, a company develops some web apps, maybe a CRM or analytics apps.

Nowadays, a lot of systems are written using frameworks.

In 90% of cases, typical tasks which devs do are:

  • Install framework
  • Build UI with components
  • Set handlers for UI elements
  • Send requests using Axios or another library
  • Provide feedback to the user, depending on the results of the requests
  • Use some libs for common stuff, like charts/validation/date pickers/etc
  • HTML/CSS stuff
  • Working with external APIs
  • etc

Now, I've rarely had to:

  • Deal with complex type conversion in javascript
  • Deal with algorithms. I understand that for Google, or for really complex systems (if you make a game, develop 3D graphics, etc.), they a must. But not for a typical web app.
  • Use prototypes. I use them but rarely
  • Write tricky code when I don't know what "this" points to. When I started working with frameworks, I rarely had problems with "this"
  • Remember that typeof something is something not logical. Since javascript is not easy to remember and understand if we talk about types. I really forget all the time what's the type of array (Object?) and why NaN is not NaN

Let's check some interview questions, and I'll be more clear.

Example questions

I've just googled "tricky javascript questions," and here what I got. Companies might not ask exactly these questions, but they are in the same category, tricky questions.

function foo() {
  let a = b = 0;
  a++;
  return a;
}

foo();
typeof a; // => ???
typeof b; // => ???
Enter fullscreen mode Exit fullscreen mode

I've never in my life written let a = b = 0. Non-readable, who knows how this works in javascript.

Oh, "b" is global in this case? Nice. I didn't know about it. And didn't have to deal with it, never.

Next.

const clothes = ['jacket', 't-shirt'];
clothes.length = 0;

clothes[0]; // => ???
Enter fullscreen mode Exit fullscreen mode

I'm not sure I've ever changed the length of the array. I change the array itself, not its length. But in case I did change it and had some problems with it, I'd console.log the result and know immediately what's going on.

function arrayFromValue(item) {
  return
    [item];
}

arrayFromValue(10); // => ???
Enter fullscreen mode Exit fullscreen mode

What? No comments.

let i;
for (i = 0; i < 3; i++) {
  const log = () => {
    console.log(i);  }
  setTimeout(log, 100);
}
Enter fullscreen mode Exit fullscreen mode

This one is a prevalent question. I always forget why it works that way, but I'm aware of this case. Not sure if I have ever written something like this, but after let was introduced, it's not a problem.

Let's go ahead:

Why 018 - 017 equals 3?
Enter fullscreen mode Exit fullscreen mode

NEVER used the octal system. Okay, guys who are attentive enough may notice the leading zero in the numbers. But another dev, who can be very responsible & experienced, might not notice this and might not remember that the octal system exists at all.

Again, I don't claim that my opinion is absolute, immutable truth.

But when I hired people, I asked only questions like these:

  • What is computed/methods/filters/watchers in vuejs?
  • Which library do you use for working with API?
  • Which API you worked with?
  • OS experience, do you know Linux? Are you okay with bash?
  • Do you have examples of your work?
  • Which IDE / OS you use, comfortable with?
  • HTTP verbs/headers/codes
  • Ways of optimizing site?

etc

I think I never ask "What the code will output". Do you want to know what the code will output? console.log :)

SAME for logical quizzes, you know all these quizzes about coins & scales etc.

I never solved them, but I can write an HTTP request in a minute.

Do you need a coin/scale-solver or you need to display results of an API request to your users?

Top comments (6)

Collapse
 
thevediwho profile image
Vaibhav Dwivedi

"I never solved them, but I can write an HTTP request in a minute."

THIS. I have worked on many projects which were complex at times as a lot of concepts were involved in it. In fact, I learnt most of production level stuff when building a Saas application.

In a recent interview, they asked me such "tricky" questions which made no sense to me because I haven't written such code!

Collapse
 
mcsee profile image
Maxi Contieri

Amazing Article!

Large companies seldom need dynamic programming coders.
We need developers dealing with legacy designs, coupling, team work, OOP principles, Patterns.
Recruiters are very out of sync and most tech leaders too.

Learn dynamic programming and metaheuristics. Is good to know that stuff. But you probably won't need it in your next job

Collapse
 
dmahely profile image
Doaa Mahely

I'd console.log the result and know immediately what's going on.

From now on this is my answer whenever I get a tricky question in an interview 😂

Collapse
 
stefandrl profile image
Stefan Drl • Edited

Hi!
I've recently had an interview and can confirm all you've written.
I had this one (in php): $a = 5; $b= $a; $a++; is $a === $b? :)

Collapse
 
vponamariov profile image
Victor

$= a?
No syntax error? :)

Anyway, I won't work in a company which writes such code 😡

Collapse
 
stefandrl profile image
Stefan Drl

Sorry, my bad :) $b = $a