Gave my first interview today for a junior dev role. I wanted to make the questions interesting...

Gave my first interview today for a junior dev role. I wanted to make the questions interesting, particularly targeting those with a good understanding of programming concepts and problem solving rather than rote memorisation of CS coursework.

Here were the questions
>Solve fizzbuzz up to a given number using recursion rather than loops
>Why is the following pseudo code dangerous and how can it be improved?
DATA = recieve_user_input()
for u in connected_users():
u.send_message(DATA)

>given a binary file loaded into the variable X, print the following information
>the magic number, the first 2 bytes
>the version number, the next 32 bits
>the message type, the next 8 bits as ASCII
>The data itself, which is the rest of the file after the message type

And fuck me Jow Forums, 90% had no idea how to solve any of those. Are grads just fucking dumb or did I mess up the questions??

Attached: 1496002653305.jpg (570x396, 59K)

>Are grads just fucking dumb or did I mess up the questions??
Can be a combination of both. A rule of thumb is to test questions out with existing engineers/devs first, and get some feedback regarding them.

Which ones in particular did they have a hard time doing?

Sanitising / length checking the user import
Parsing the binary file

>Sanitising / length checking the user import
It isn't apparent unless you specify (or encourage them) to ask what the receive_user_input() function does. Also, considering how it appears to be pythonesque pseudo-code it is not automatically obvious that either DATA or user-side buffers can have fixed lengths.

>Parsing the binary file
Depends on how much they have fiddled with pointer arithmetics and stuff like that. If you get people who have done C only for a single course, I guess they are going to have a hard time.

But I agree that these are all low-hanging fruits, so candidates should be able to solve these given a reasonable amount of time. What experience and backgrounds did the candidates have?

Out of curiosity, what were the expressed qualifications they need to have in the job posting?

.. Would you care if I googled the library? I know how to do these but I haven't memorized all function names or parameters. If you said no Google I'd sweat buckets...

I don't think you need any (standard) library functions to solve any of these. The fizzbuzz is just implement it using printf, the second one is just a matter of using reasoning and logic (and being familiar with buffer overflows, code injection etc), and the last one is just a matter of pointer arithmetic and casting.

I'm not OP, btw (I'm and )

>It isn't apparent unless you specify (or encourage them) to ask what the receive_user_input() function does. Also, considering how it appears to be pythonesque pseudo-code it is not automatically obvious that either DATA or user-side buffers can have fixed lengths.
The role is a python web-dev role. I was thinking (hoping?) that sanitising user import would be an obvious thing to these people. I also *like* to think that people with degrees have a general interest in tinkering with things, everybody has tried '1=1-- into the input box before, right?

CS degree with provable programming experience. Github, a fucking uni placement reference. Requirements were low, nobody knows the languages we use so we try to hire right out of Uni.

It's pseudo code, I wouldn't have minded if you had explained why raw input was a bad idea to send directly to clients and written sanitise(DATA[:some_limit])

>Depends on how much they have fiddled with pointer arithmetics and stuff like that.
Depending on the language, you might not ever need to do pointer arithmetic to solve that in a reasonable way, IMO.

damn, mike, what happened to you?

For the last I would use a stream no?
For sanitizing inputs, I agree, it's a bit vague. Perhaps include an example of an unsanitized input and have them recognize it?
For fizz buzz, rofl

That's true, it is also just a matter of offsetting into the byte string.

>The role is a python web-dev role. I was thinking (hoping?) that sanitising user import would be an obvious thing to these people.
While I agree with your sentiment, people put different emphasis on what "junior" means. Some people may interpret that as minimum knowledge and experience required, and that you will receive training on work (and thus the lower compensation/salary associated with the junior position).

> I also *like* to think that people with degrees have a general interest in tinkering with things, everybody has tried '1=1-- into the input box before, right?
They should have, and honestly this was one of the first things I learned about in lectures in uni too, always sanitize user input.

>CS degree with provable programming experience. Github, a fucking uni placement reference. Requirements were low, nobody knows the languages we use so we try to hire right out of Uni.
Okay, thanks.

>It's pseudo code, I wouldn't have minded if you had explained why raw input was a bad idea to send directly to clients and written sanitise(DATA[:some_limit])
This sounds fairly reasonable imo.


Your questions were reasonable OP. You should complain that HR didn't do their job properly when screening candidates.

But if you want a comment, I would also ask for something other than fizzbuzz, for example reversing a string using recursion.

Use string as char array, decrement for loop adding them into another string, print that other string

The questions seem fine to me, nothing too hard

Just wondering, how did they react when they couldn't solve any of these simple tasks during a job interview?

>For the last I would use a stream no?
Ask questions about the data, loop through bit-by-bit if required or use unpack if you're an advanced user

I messed with streams for a month or so earlier this year parsing and getting/setting data in a game map. So I guess you'd read two bytes, then read, oh what is 32 bytes.. A signed integer I think.. Then read 8 bytes, then poop the rest out however. That's how I'd approach it anyways

>You should complain that HR didn't do their job properly when screening candidates.
If OP is asking questions like FizzBuzz, wouldn't screening candidates be his job?

Good point.

1)
def fizzbuzz(limit, n=1):
if n > limit:
return
if n % 3 == 0 and n % 5 == 0:
....
fizzbuzz(limit, n+1)

2) No error detection/handling, streams can be multiplexed which might be more efficient then loop over all. Can't say if user's input can be invalid in context of the program without more information.
3) does it mean file handler is variable X or content of file is variable X as byte array?
uint8_t magic[2];
uint8_t version[4];
uint8_t msgtype[1];
char buf[1024];
size_t r;

if ((r = fread(magic, 1, 2, X)) != 2)
err(1, "fread magic");
printf("magic: %x%x\n", magic[0], magic[1]);
if ((r = fread(version, 1, 4, X)) != 4)
err(1, "fread version");
printf("magic: %x%x%x%x\n", version[0], version[1], version[2], version[3]);
if ((r = fread(msgtype, 1, 1, X)) != 1)
err(1, "fread msgtype");
printf("magic: %x%x\n", msgtype[0]);

while ((r = fread(buf, 1, 1024, X)) != 0) {
fwrite(buf, 1, r, stdout);
}

The first is moronic. The second is missing context and the third is missing information.

>loops

It is called iteration, you mong

>rote memorisation of CS coursework.

This is all uni is, dude.

>good understanding of programming concepts and problem solving

This is what you learn from a "junior" dev role.

I couldn't answer the last question (granted, I haven't graduated yet), and I struggle to think of any of my class mates who could do so easily. Even the absolute highest performers would be pretty put on the spot by it -- and these are the kind of guys who go off to work for Google or start their own startup, certainly not applying for "junior dev roles" for a company whose interviewer posts on Jow Forums (no offense).

Unless these questions directly relate to the job role, I think this is a type of interview that is on the way out. Even older companies are starting to wake up to the fact that autistically specific questions / whiteboarding is ineffective and unnecessarily stressful. It almost feels like you created this interview because you knew how it would go down and you'd get a little soapbox moment about "CS grads these days..". Or you're just larping

Stop being such a pussy, go back to hackernews

>I wanted to make the questions interesting
>Solve fizzbuzz

Attached: 1447525154845.jpg (500x500, 76K)

That doesn't surprise me. Neither file I/O nor sanity checking are emphasized in CS coursework so most grads probably aren't familiar with them. The only way to get a lower success rate is to ask about desktop GUI development.

they are frauds and charlatans, you did well

if you need real software written and not some bullshit calculator "app" or something, then this was a good way to filter out the average cuck who walks in claiming he's not actually a cuck, when in fact his wife is at that moment being fucked by tyrone

>Even the absolute highest performers would be pretty put on the spot by it -- and these are the kind of guys who go off to work for Google or start their own startup, certainly not applying for "junior dev roles" for a company whose interviewer posts on Jow Forums (no offense).

no. i have a grade in probably the bottom 30% of my class and i can answer those questions about binary

Not a CS student, just a mechatronics engineering student that writes C for microcontrollers sometimes. I would probably have to write an iterative fizzbuzz and convert it to using recursion for #1. The tools I use don't allow me the luxury of writing recursive algorithms that are later optimized (tail call optimization?). #2 is trivial once you said what you were looking for, but at first glance I would have assumed the recieve_user_input() function to handle "sanitation." In other words, coming from a purely C background, seeing anything other than stdio function calls for user input make me assume that something smarter is happening behind the scenes. #3 is easy peasy, but I honestly would not expect CS students to be comfortable with bits and bytes. It is entirely possibly that a reasonably intelligent CS grad would never have dealt with handling data at the level of bytes.

Just took a quick look at the CS curriculum for my university. Looks like the intro class is in python. Later courses deal with algorithms, data structures, a class or two about machine data representation and memory, software engineering, and programming language design. There are a few others. From the looks of it, if a CS student didn't land an internship or do personal projects, they could graduate without any real experience writing programs. However, they would probably have a fighting chance at coming up with data structures and algorithms to solve specific problems. Either that or undergrad CS is tailored for getting people in to graduate CS programs.

>It is entirely possibly that a reasonably intelligent CS grad would never have dealt with handling data at the level of bytes.
doubt it, in any CS program there's a microcontroller/C programming course, and the first week of that course is nothing but binary

Where is the recursion here if you're just using a loop?

>This is all uni is, dude.
if this is your impression of CS/how you see it, you are literally wasting your time in uni, drop out and do something more productive (develop projects on your own)

Posts like this give me hope that I can stop being a neet someday

Generally you have to consider people can be very nervous, you you should start with something really easy (to boot their confidence and make them get calm) and then slightly go up with the level.

The recursive fizzbuzz question is good (since every programmer should know about this one, but the variation is funny).

The question about sanitizing is OK, but I would not rate it too high if they don't get what you want to know. But you can give them a few hints if they don't get the idea.

The question about the binary file is is not that good IMO, since it's too langauge specific and also something that many people probably never have used before. You might as well ask them about some XML or JSON details - either you know it or you don't but it's not something you can solve by thinking about it.


I like open questions where there is more than one possible solution. After all you want to see how people think and how they deal with something they don't know yet.

Don't complain, suggest different strategies.

Thought that was seanbaby from the thumbnail

1) Nice Q. Bonus points for knowing tail call recursion.
2) srsly? There is nothing wrong. All the tendious work is usually left out when writing in pseudo code. That is the point you know?
3) Again bad q. Endianness?

You're asking for a junior role, not a senior role. New grads don't have that much experience. Even many of the experienced devs don't have that much experience in certain specific instance.

Sanitizing stuff requires bit of experience/reflex with the security, something a junior dev wouldn't be too familiar with.

Extraction of bytes/bits data should be standard knowledge but still lacking working experience make it difficult.

I'm self-taught and only really do quick hack scripts and I have a rough understanding of these question/concepts so if I was asked for these question, I would need a bit of googling to help me come up with proper solution, mainly on which methods/functions to call for the bits/bytes data extraction from a binary file part. The questions aren't hard, just requires knowledge/experience imo.

I'm taking wild guess but it seems that maybe that code SHOULDN'T send the data to all users. For example, if it were a chat application, it would be better if the user didn't get his own message back. The message should be pushed on the client side and then every connection other than the user would get it.

Also checking data length, curse words, etc

>>Why is the following pseudo code dangerous and how can it be improved?
Is it because DATA could contain some weird bullshit, so it's better to perform checks on it?

>I couldn't answer the last question (granted, I haven't graduated yet), and I struggle to think of any of my class mates who could do so easily. Even the absolute highest performers would be pretty put on the spot by it -- and these are the kind of guys who go off to work for Google or start their own startup, certainly not applying for "junior dev roles" for a company whose interviewer posts on Jow Forums (no offense).
Fucking 16YO HIGH SCHOOLERS of my country going to the computers course could answer all of these questions, by the end of their school year they'll already have dealt with binary files and recursion with C
I think you're just a terrible shitter

>>given a binary file loaded into the variable X, print the following information
>>the magic number, the first 2 bytes
>>the version number, the next 32 bits
>>the message type, the next 8 bits as ASCII
>>The data itself, which is the rest of the file after the message type

>open HxD
>input the binary to HxD
>???
>wa la

you can save a lot of time when you are trying to hire by simply saying you are a dick in your posting. no need to wait anyone's time. you reminded me of the falco kike

>>open HxD
>>input the binary to HxD
>>???
>>voila
Fixed.