IT/Software career thread: Invert binary trees for dollars.

  • Guest, it's time once again for the massively important and exciting FoH Asshat Tournament!



    Go here and give us your nominations!
    Who's been the biggest Asshat in the last year? Give us your worst ones!

Noodleface

A Mod Real Quick
38,287
15,129
Interviewing some intern candidates and they want someone with "at least basic/understanding of python"

What kind of coding questions should I ask? Not a python expert
 

Asshat wormie

2023 Asshat Award Winner
<Gold Donor>
16,820
30,968
Interviewing some intern candidates and they want someone with "at least basic/understanding of python"

What kind of coding questions should I ask? Not a python expert
Uhhh have him solve whatever problems you guys usually ask to solve but insist the solution is written in python?
 

Deathwing

<Bronze Donator>
16,768
7,790
Interviewing some intern candidates and they want someone with "at least basic/understanding of python"

What kind of coding questions should I ask? Not a python expert
Some standard Python libraries trivialize typical interview questions. So you either have to say no standard library calls or make the question harder.

Our first question is implementing string->hex number without calling hex(), which is a "builtin" for Python.

After that, we ask them to do a path elision question but that's generally difficult in any language.
 

chaos

Buzzfeed Editor
17,324
4,839
Had one ask me to do ip sorting before, had to do it twice because apparently "bro just convert to int, .sort() and win" wasn't the intent.

Similarly, I think my solution to that string->hex problem would cause some facepalming with devs.

idk, glad I'm not a dev, I'd get creamed with all this shit.
 

Deathwing

<Bronze Donator>
16,768
7,790
If they didn't say you couldn't use builtins beforehand, that's their fault. The intent of the hex question is not to be some sort of gotcha, because of course you're going to use hex() 100% of the time. We want to see how candidates work through a problem. We give them unfettered internet access, if they just copy/paste a solution, we ask them to start tweaking it.
 

Khane

Got something right about marriage
20,380
14,047
I hate questions like that hex one. If you, as an interviewer, can't be bothered to come up with a legitimate, real world coding question why should you expect the candidate to take that interview seriously?

Obviously the purpose of coding questions should be to see how a candidate works through a coding problem but what's the point of asking a question that needs such a major caveat to even work and will never, ever need to be done in a real world scenario?

Letting them use the internet and be at a computer is a good interviewing practice so you can see how they'd actually tackle a new challenge in an actual work environment. But man... purposely saying "You're not allowed to use something you'll likely, actually use everyday to answer this question. Like code libraries or built in functions/methods" Ugh.
 
  • 2Like
Reactions: 1 users

Deathwing

<Bronze Donator>
16,768
7,790
That's a fair point, perhaps the question is a bit antiquated for Python. I don't think hex() is a builtin for C/C++, that's the focus of development at our company.

Honestly, it's a warmup question. Sometimes we use "build an index", like the back of a book, out of a bunch of words. But that's almost insultingly easy in Python. It has some interesting edge cases though.
 

ShakyJake

<Donor>
7,918
19,985
For junior dev applicants we give them 3 coding challenges:

* reverse a string
* count the number of usages of a word in a string
* SQL stuff that involves table joins. nothing crazy

Each challenge gives explicit acceptance criteria. So we are testing that they are able to code AND can follow instructions.
 

Noodleface

A Mod Real Quick
38,287
15,129
I hate questions like that hex one. If you, as an interviewer, can't be bothered to come up with a legitimate, real world coding question why should you expect the candidate to take that interview seriously?

Obviously the purpose of coding questions should be to see how a candidate works through a coding problem but what's the point of asking a question that needs such a major caveat to even work and will never, ever need to be done in a real world scenario?

Letting them use the internet and be at a computer is a good interviewing practice so you can see how they'd actually tackle a new challenge in an actual work environment. But man... purposely saying "You're not allowed to use something you'll likely, actually use everyday to answer this question. Like code libraries or built in functions/methods" Ugh.
I could just ask for pseudocode
 

chaos

Buzzfeed Editor
17,324
4,839
I had a moment like that last week, trying to get a pretty weird dns config to work over vpn, some guy on the openvpn site posts the exact issue back in 2015, no responses. Fucking crushing.
 

Noodleface

A Mod Real Quick
38,287
15,129
We were switching our code to use a completely different header format in our firmware image object code, but we wanted to support both. So while the object struct used the old header I had to find a way to support both (think, laying down 16MB of data in a buffer and it's expecting the header to be in a different format, different size, different fields). I could easily change it to just use the new header type, but we needed to support both. I ended up changing the header to be defined as a void pointer and casting it as the different headers based on usage. Took a lot of walks around the building and I'm not even sure I like that solution. It was a LOT of code I had to change, and I feel like there was probably something super simple I could've done.
 

Deathwing

<Bronze Donator>
16,768
7,790
It's been a while since I worked with a language that supported casting, but isn't the concept in general frowned upon? I'm assuming you had to dirty up your code with a fair amount of ifdef usage.
 

Vinen

God is dead
2,790
495
It's been a while since I worked with a language that supported casting, but isn't the concept in general frowned upon? I'm assuming you had to dirty up your code with a fair amount of ifdef usage.

Casting is possible in many languages. Even C# and Java.
 

Noodleface

A Mod Real Quick
38,287
15,129
It's been a while since I worked with a language that supported casting, but isn't the concept in general frowned upon? I'm assuming you had to dirty up your code with a fair amount of ifdef usage.
No ifdefs required. I sort of misspoke when I said struct, it's a class with structs in it. Another caveat, the new header has the old header inside it - so its OLD HEADER + NEW HEADER, or just support OLD HEADER.

So this is a basic idea:

C++:
typedef struct header
{
    UINT32    checksum;
    UINT8    sp_name[SP_NAME_SIZE];
} HEADER;

// Certificate Header
typedef struct {
  struct {
    UINT32  HeaderMagic;
  } Meta;

  struct {
    UINT8 Buffer[SIZE];
  } Certificate;

  struct {
    UINT8 Buffer[SIZE];
  } Signature;
} HEADER2;

typedef struct recv_header {
    HEADER2 header2;
    HEADER    header1;
} RECV_HEADER;

The code used to have a member HEADER *header, but now it is void *header.

So I pass it through a constructor, then when used we need to:
C++:
        ((HEADER *)(this->header))->checksum = (UINT32)checksum;
       
        //OR
       
        ((RECV_HEADER *)(this->header))->header1.checksum = (UINT32)checksum;
 
Last edited:

Deathwing

<Bronze Donator>
16,768
7,790
Casting is possible in many languages. Even C# and Java.
Yeah, been a while since I worked with those too ;) I've been on Python for a while now. I would definitely trust casting in a managed language much more than otherwise.

Noodleface Noodleface you aren't worried about possible loss of information from the casting? I mean, I guess you're working with firmware, so you have pretty tight control how this gets compiled and linked.
 
Last edited: