DEV Community

Jen Chan
Jen Chan

Posted on • Updated on

5 Unusual Test Questions I Got While Interviewing for Web Dev Roles

Illustration from 'Unicorn Being A Jerk' by CW Moss

Poor [Mister Unicorn](http://misterunicorn.com/index.php?/books/unicorn-being-a-jerk/)

Update: I changed the title from “5 Questions Companies Ask To Filter For CS Degree Holders” to the current one as the title was very linkbaity and seemed less related to the content of this post. While most of the mentioned questions involve having CS fundamentals/education to solve, the greater issue was that the tasks applicants were asked to complete were outlandishly difficult or unrelated to the day-to-day tasks of the position, thus giving the impression the employers were looking for someone world class.


If you, like I, didn’t go to school for compsci, you’re probably wondering why you got the interview but never made it past the second one. On reflection after around 9 flopped interviews, I imagine the reasons are:
1) My portfolio is lacking or too full of templated projects or buggy projects
2) I didn’t answer the following questions in the tech test in time ( which have little to do with on-the-job knowledge, but hey, I want to get to the next level right?).

Lo-and-behold: curveballs I’ve seen on hackerrank, timed tests and pre-irl front end engineer and software dev interviews.

1. Find if these numbers exist anywhere in a binary tree given a set of conditions.

To revise (in the British sense... to re-read): recursion and scope

2. Write a hamburger sandwich menu, tabbed navigation or drop down menu without using the internet

To revise: media queries, DOM manipulation and event handlers

3. Animate the stars on both sizes of a bevel texted CSS button without using JS.

To revise: CSS animations and gradients

4. What sorting method do you use to find a missing number within a series of infinite noncontiguous numbers?

To revise: sorting algorithms

5. What was the (O)n factor of that?

To revise: task efficiency

Ok I thought of 2 more I’ve come across...

6. Write a radio button JS quiz that shows and hides next answers based on whether the user checks the right choice. Test in the console or editor and don’t look up documentation online.

To revise: Array manipulation

7. Find how many times a particular letter in a sentence exists or repeats itself regardless if its first letter is uppercase or lowercase.

To revise: Array manipulation and object oriented JS

I think it’s unfortunate that tech tests include unrealistic work conditions and high pressure whiteboard scenarios. It makes candidates second guess their abilities on first impression and also worsens imposter syndrome coming out of it.

The good part is that I get a sense of what companies are looking for and I guess the saturation of job hunters from bootcamps are creating a need for talent recruiters and oldschool bro-folk to separate the diehards from the n00bs. And if you have the luxury of scabbing off your partner or parents, it’s kind of interesting to read about how compilers and programs think.

So my plan is to practice doing each type of question until I get to comfortably solving it in just under an hour. I hope I will.

In the meantime, I’m reading Eloquent JS, You Don’t Know Js, and Grokking Algorithms.

Feel free to share any more you’ve come across!

Top comments (18)

Collapse
 
cristinasolana profile image
Cristina Solana

"don’t look up documentation online" - when you hear this, run.

Collapse
 
aeiche profile image
Aaron Eiche

Agreed. It's fortunate that I've never run into this myself, but my immediate response to that sort of thing is "Do you expect your employees to not utilize documentation while at work?"

It's absolutely absurd.

Collapse
 
jenc profile image
Jen Chan

My gut feeling -giving them the greatest benefit of the doubt- is that they think you've used certain methods so much you'll remember...

Collapse
 
jenc profile image
Jen Chan

Unfortunately I’ve had this a couple times. (Sits in room flicking pencil)

Collapse
 
yechielk profile image
Yechiel Kalmenson

Once saw someone tweet that they'd respond to such a question saying "that's an interesting problem, do you come across this often here?"

You may not want to try it at home ;)

Collapse
 
jenc profile image
Jen Chan

You may enjoy this thread twitter.com/RebeccaSlatkin/status/...

Collapse
 
yechielk profile image
Yechiel Kalmenson

lol, some great replies there!

Collapse
 
giacomosorbi profile image
Giacomo Sorbi

The last one is actually a fairly plain regex problem: why should anyone use Arrays or OOP here? The latter at best if they want you to implement a new String method, ok, but meh...

Collapse
 
jenc profile image
Jen Chan

I imagine you meant Q7 by the "last" question. I'm curious how you'd solve that with regex; I didn't suggest it because I don't know any better. I would struggle to remember character patterns.

Collapse
 
giacomosorbi profile image
Giacomo Sorbi • Edited

Of course I meant the last one.

It is a pretty trivial task, to be fair:

String.prototype.count=function(elem, caseInsensitive = true){return (this.match(new RegExp(elem, `g${caseInsensitive ? "i" : ""}`))||[]).length;}
"Pippi".count('p'); //returns 3
"Pippi".count('p', false); //returns 2

On request I can offer code in Python, Ruby, Crystal and possibly something more.

Oh, and Pippi is my cat <3

Thread Thread
 
jenc profile image
Jen Chan

Thanks for illustrating that. It’s a new way of looking at it. And yes, in hindsight that question is not unusual.

I got that q twice in no-documentation situations so i just iterated through a string and return the number of truthy values. Not as rigorous or pure, but gets the job done.

Thread Thread
 
giacomosorbi profile image
Giacomo Sorbi • Edited

I assume you mean "situations in which I could not google" or the like; it might have been more efficient then to filter, at least space wise, instead of mapping a string and then running through an extra item of length n to count again.

Better yet, a reduce approach, to keep it in n time.

I would still think that a RegExp-based approach would have an edge in terms of performances, as long as you use NodeJs which has some really impressive regex engine under the hood, but I am too busy (or lazy) to build a jsperf about it right now.

If you fancy some practice with this kind of stuff, come and join us on CodeWars - it is cool and we have a rather good community.

Edit: oh, cool, this place support the git-flavored markdown! Edited the snippet above!

Thread Thread
 
jenc profile image
Jen Chan

Yes, I meant what you meant, but said "no documentation" to include situations where interviewers would throw you an O'reilly book or pdf for reference, but insist you can't code with internet.

Does every char make a difference? I read somewhere that for loops are still faster than forEach. Is coding an exercise like copywriting for sentence refinement? For me the thing got me into coding were the sexy results (coming from a background in video, things like animation didn't need to be rendered ahead of time as a huge file, if they could be executed as code, but of course, you could heat up your computer and slow down the browser etc ). But I can tell bad performance would impact quality and users would bounce away, so these things matter.

I agree with using the map and reduce functions. It makes a lot of sense. I only just got used to using map without errors!

At the risk of looking stupid in a euler-project style community I feel should ready myself by reading the aforementioned stack of books in my post, which have just arrived from Manning. I'm particularly excited about grokking algorithms, as a visual learner. I never learned code by reading books, but I realize there's some persnickety things you just don't learn by doing, then doing exercises after reading. It's a very different way of learning.

Also, is codewars for-pay? Must you be part of a "clan"? God I don't like that term.

Thread Thread
 
giacomosorbi profile image
Giacomo Sorbi

I am not sure why (HR) people decide to structure interviews that way; I was discussing with other devs recently and it makes no sense at all: ok, if you don't know what's the event loop, you can't explain how promises work or the like, then it tells me that you are not a great JS dev. But when I interviewed candidates I never expected them to quote MDN verbatim, much less I would care to see their merely mnemonically acquired knowledge of APIs or CSS properties.

Not sure about which user case you are referring to, but I doubt a for loop can outperform a .forEach(), as you need to declare a variable to iterate through it in the same way. Maybe some engine has some strong optimization, but I would guess that it is because the latter works only for array, which would imply that you first would have to turn the string into an array of characters (which technically was already how is more or less represented at a lower level, but I digress: still computationally expensive!), store the extra value at the cost of extra space and then loop though it with our beloved .forEach() (again, a .map() would be more convenient most of the time and we all love the idea of going functional whenever it is possible, don't we?).

Let me suggest you a small exercise to flex your functional muscles, then: might you replicate the behaviour of map() and .filter() using only the .reduce() method? And could you do so in order to be even more performing?

At the risk of looking (even more) rude and blunt, I think that is BS: books should be the companion of a practical training, not the other way around. You seem to have a decent grasp of core concepts, but what strikes me is that you apparently lacked practice in this kind of problems. Would you think you would become a great martial artist, ballerina or surgeon just reading books? And while I tend to disagree also with the fad of classifying/labelling people in things like "visual learner", assuming that actually works for you, go on YT, watch some video like the one from hacker-rank which in less than 10 mins can visually show how a quick sort or a BFS or an A* or whatever other algo works. But only after you hit the nose against the hard wall of a problem you cannot solve. Yet.

CodeWars is free to you (the pay option is to support the devs in exchange for a few extra stats and info on your profile); the "clan" term is just to follow the ninja/samurai gimmick of the site, same as ranking the katas by belts.

Thread Thread
 
jenc profile image
Jen Chan

god, let me read! I like it! 🤣

I think even before I solve problems I ought to understand what needs to be solved 🤷🏻‍♀️

The background knowledge is like a toolkit, you don’t know what you can use if you don’t know even know about it. I have a feeling you’re overestimating the amount of “core” I know since the first time I heard of sorting algo or binary tree or o(n) was in interviews.

I agree I lack practice. I just got my adhd under control so it’s been wonderful for learning and doing. Back when I didn’t, I could never read top to bottom let alone hold onto thoughts.

Thread Thread
 
giacomosorbi profile image
Giacomo Sorbi

Feel free to read, but in due time you need to build automatism like a professional athlete or chess-player.

I don't think I am over-estimating much, I see you have plenty of shortcomings (this discussion came from one of them, didn't it?), but I also see that you have a good understanding of a lot of stuff and that you practiced with commitment.

That is more than enough in my book, so I would still recommend to practice more as a first step; the drive to read and do more comes better after you see implementations of such a knowledge.

Collapse
 
jazzmalang profile image
Mark Gugler

Although I agree these interview questions are absurd, there is a good amount of merit to seeing peoples responses. I've been to interviews where I didn't answer a single question right and still got the job. I approached each question as a collaborative effort with the interviewers. "Don't look up documentation online" (if it is a good interviewer) really means "Ask me for help".

I will add though, if you're given a task and a set amount of time with no internet/resources while they leave the room. Walk out. Development should never be in a vacuum.

Collapse
 
jenc profile image
Jen Chan

In hindsight I think the hamburger sandwich menu question and the final 2 (number 5 and 6) aren't unusual to test on devs, but seeing how they tackle it without other prompts would definitely be interesting. (Under pressure my tendency is always to write more code than i need-_-) I also do like the ask-for-help thing, if they make themselves available for that.