Live data from Hacker News

The four programming questions from my 1994 Microsoft internship interview (2023)

computerenhance.com

91–100 of 103 posts

Re: The four programming questions from my 1994 Microsoft internship interview (2023)

#91
You can tell a lot about a C/C++ engineer by asking a simple question like strcpy(). Assuming they get it right (which many don't), you can then cover test cases, you can discuss trade offs on safety vs performance, and failure modes. It can actually be very interesting.

Re: The four programming questions from my 1994 Microsoft internship interview (2023)

#95
post #58

Earlier quoted context omitted.

Why did that approach change?

I’m not sure if that strategy still works in today’s job market. It might still be, but I’m not the one to answer since I haven’t been on a job interview in quite some time.

I work in embedded systems. I always carry a few (small) projects with me in a backpack with a power supply and bring them out if certain topics allow me to do a show-and-tell.

I also carry a binder. Each page is a one-page description of a project with a color photo of the system and a bulled-point list of all technologies inside. It's a great conversation starter. Hasn't failed me yet.

Re: The four programming questions from my 1994 Microsoft internship interview (2023)

#96
post #72

My first ever programming interview was like a group interview. There were three or four programmers asking me questions, one at a time. The only one I remember was to check if two strings were equal (in C). I wrote (maybe buggy) code to iterate both pointers, comparing while looking for the null terminator. The interviewer stopped me and said, “You should compare their lengths first. If they are different, you can e…

C is pretty bizarre but I expect someone writing it professionally to know that even passing void compareStrings(char str1[], char str2[]) is equivalent to compareStrings(char * str1, char * str2) so no way to get the length of it with sizeof(str1) and strlen walks the string until it finds the null terminator.

Re: The four programming questions from my 1994 Microsoft internship interview (2023)

#97

Earlier quoted context omitted.

I’m not sure if that strategy still works in today’s job market. It might still be, but I’m not the one to answer since I haven’t been on a job interview in quite some time.

I work in embedded systems. I always carry a few (small) projects with me in a backpack with a power supply and bring them out if certain topics allow me to do a show-and-tell. I also carry a binder. Each page is a one-page description of a project with a color photo of the system and a bulled-point list of all technologies inside. It's a great conversation starter. Hasn't failed me yet.

10 years after I was hired, one of the interviewers still remembered me showing him a small board that I'd designed, even though he was a Windows MFC programmer and didn't know the first thing about microcontrollers.

I've made great hires who had binders just like you described.

Re: The four programming questions from my 1994 Microsoft internship interview (2023)

#98
post #40

Earlier quoted context omitted.

Exactly! I used this question regularly. It wasn’t a gotcha question or even an impossible-without-experience question as the author thinks. It was a show me HOW you think through something question. There are a lot of ways to solve it, from scanline to sin/cos to using the circle equation, but you can _progress_ from naive to advanced solutions, and all solutions above plus the DDA or Bresenham solutions have symmet…

I wonder if there's a class of people who managed to get CS degrees but really aren't that good. To them, it might feel more like either you remember the perfect and optimal but complex solution you were taught in a class, or you don't happen to remember it and are completely stuck and can't make any progress at all. I don't think I'd want to hire or work with somebody who can't come up with some sort of solution aft…

> I wonder if there's a class of people who managed to get CS degrees but really aren't that good

Yes, yes, oh my god yes!

The classic one that will stick in my memory forever was the candidate with an MSCS who was given the problem description and categorized and described what class of problem it was, but completely failed to make any progress in solving it.

I'm sure she was great at complex algorithms, but we just wanted a for... loop to start with.

The flipside of this is that one of the best hires we ever made had such a bad resume that I remember storming into my boss' office and asking why I was wasting my time interviewing that person.

Re: The four programming questions from my 1994 Microsoft internship interview (2023)

#99
post #80
post #22

Earlier quoted context omitted.

Well in an interview I guess something like "Of course we shouldn't allow C-strings in general outside of syscalls and argv, but for the purpose of the exercise...." And now you've shown that you know what you're talking about and that you won't be difficult to work with.

I don't think it was clear in 1994 that not passing the size of a string was a sin

Oh 100%, I was responding to the parent who's response was 'No'. Even if you have 100% ban on strcpy and z-strings you're forced to use them in certain cases (like argv), and I was pointing out that sometimes we engage with certain conceits in a job interview, and by refusing to engage with it you're giving out a signal that you'll be difficult to work with

Re: The four programming questions from my 1994 Microsoft internship interview (2023)

#100
Q1 Rectangle copy. Needs to know if overlapping ranges and/or NULL pointers need to be handled. It can be reduced to FromMaxY-FromMinY+1 memcpy()'s and some pointer math using strength reduction to replace unnecessary multiplies with adds.

Q2 String copy. Also needs to know if overlapping ranges and/or NULL pointers need to be handled. Must assume ASCIIZ in src. (DOS also had $-terminated strings and Pascal had length & pointer strings.) Pretty easy.

Q3 Flood fill. Keep filling towards either end of the current scanline while the pixel value is the same. Look up and down one scanline with the same width as the filled segment for additional scanline segments that are the same, and recursively begin the algorithm again for each.

Q4 Circle draw. IIRC needs a trig data table to avoid floating point. The current x position needs to be tracked and for each line in y, the length of the current line part to advance x needs to be calculated. Calculate one quarter of the circle and replicate it to all 4 quadrants. I believe the fairest circle rasterization calculation is to subtract half of a pixel width from the radius so that drawing relates to the center of pixels.

Post reply on HN