11 ms·
I once had an in-person interview where they gave me a sheet of printed code and asked me to point out the syntax errors. Some interviewers are absolutely insan
by trinovantes 5y ago
I once had an in-person interview where they gave me a sheet of printed code and asked me to point out the syntax errors. Some interviewers are absolutely insane.
- hdjjhhvvhga 5y agoActually this one might make sense, depending on the code and the position you applied for.
- trinovantes 5y agoIt was for a junior c# position so I doubt it's applicable considering Visual Studio will point out the problems. But I'm curious what position would this question make sense?
- burntoutfire 5y agoIt doesn't sound that stupid, it checks whether you know the syntax of the language you'll be programming in.
- exdsq 5y agoDepends... imagine getting four pages of C# code and having to play Where's Wally but you're not even sure what Wally looks like. Surely it'd be better to just write FizzBuzz.
- mns 5y agoIt's literally asking someone to write perfect code in a time limited situation, under pressure, how can someone with any kind of coding experience ask someone else to do in an interview?
- killtimeatwork 5y agoIt not literally asking to write any code, just to read it.
- coldcode 5y agoNot one person ever code reviews code that was not already compiled. Requiring you know the syntax of a programming language (in my case, Swift, changes syntax in every release) outside of a compiler is pointless. I remember in the early days of J2EE people asking you for the home interface of an EJB stateful session bean. Like who the hell cares about memorization in the era of Google, and that was 20 years ago when Google did no evil. This isn't first year computer programming 101, you are paid to make things that work, not regurgitate syntax.
- michaelt 5y ago> I'm curious what position would this question make sense? I was once asked a similar but better posed question: I was given some code and asked what I'd point out if asked to do a code review on it. And the code had loads of things wrong with it, from bad variable names and incorrect comments, through unit tests that didn't have any assertions and loops that weren't actually loops, all the way to choosing a non-secure random number generator in an application that needed a secure one* In other words, it was a test of my ability to code review, with some glaring issues to give me some easy marks and set me at ease, and some subtle issues where talented people could really set themselves apart. It was fair and relevant to the job because I was presenting myself as a senior programmer with lots of experience doing code reviews and coaching junior developers. It's possible trinovantes's interviewer intended to give the same sort of test - but either didn't explain the question clearly enough, or trinovantes misheard or misremembered. * A bug right out of puzzle 94 in 'Java Puzzlers'
- w0mbat 5y agoCitrix gave me a page of code which had a lot of tricky obfuscated syntax problems. Code that looked live but was actually commented out, nested comments that were not terminated properly, code formatted in a very deceptive way, strings that were not quoted correctly so they would not end where expected on the page. It was all very contrived stuff that was deliberately deceptive, not like real broken code, and the errors would have shown up with syntax highlighting. I caught most but not all of the tricks. This is also the only interview I have ever had where a panel of engineers stood behind a desk and all barked questions at me. I did not get the job. At a different interview, this one with Microsoft, the lead engineer showed me a page of actual code from their app and asked me what I thought. Luckily the bug instantly leaped off the page to me, although many people would not see it. That was a good way of proving that I have a useful ability, and a better use of time than whiteboard coding or quizzes. I got the job and they were glad they hired me.
- RHSeeger 5y agoI tend to believe that "walk me through a peer review of this code" is a great interview question. It speaks to the user's familiarity with the language, with problem solving in general, and also people skills. Sure, it's not the end all/be all, but someone needs to be pretty amazing to want to work with them if they are incapable of doing a peer review.
- smt88 5y agoYour IDE can check your syntax. For people who have to switch between languages regularly, precise syntax memorization is difficult and a waste of time.
- MrDresden 5y agoWhile I understand where you are coming from, I disagree. IDE tools are great performance enhancers, but they can also be crutches. I would always expect a professional software developer to be able to parse some code on a page and point out its syntax errors (as well as suggest edits). edit; here I am thinking about something more substancial then just a missing ';' or a lack of a closing "
- deleted 5y ago[deleted]
- megous 5y agoLet's use (C++) something not common, but not all that crazy: bool x = false; x ||= something(); How many multi-lingual programmers will remember which one of the 7 languages they know does have a boolean assignment operators and which do not without looking it up? Does that make them unprofessional? How many do remember exact operator precedence rules for all those languages, when in practice you may need just the basic ones and use () to work around the lack of exact knowledge. Also which version? Something not working in PHP 7.3 may be ok in PHP 8, but company wants you to code in PHP 7.3, or ES5. In practice you get quickly acclimatized to any of the languages you know after working with them for a few days or a week, but good luck remembering exact rules of any of them at any given time when asked.
- HWR_14 5y agoYou're not mentioning or alluding to the one obvious syntax error. I don't know how to spoiler it so I will say there is an issue on the second line that, again repeating, I don't know how to call out. And yes, I work in multiple languages.
- ladberg 5y agoDesign mistakes maybe, but syntax errors are just not representative of any real debugging experience IMO.
- Terr_ 5y agoI could see it if you're resume talks about a whole bunch of intense recent development in the exact same language they want to test, but only then. In contrast, I've been stuck in a giant multi-language integration-fest, and... well, there are definitely languages on my resume that I would not be comfortable being pop-quizzed on, simply because I've been using others for the past two years.
- agent327 5y agoI've been doing C++ full time since 1996, and yet I frequently have intellisense warning me about forgetting something silly - like a missing capture in a lambda, or even forgotten semi-colons. That's because I'm not an f'ing compiler. _Can_ I make sure the code is 100% correct before even compiling? Sure, but I'll spend an hour checking every detail, while intellisense does it while I type.
- HWR_14 5y agoI mean, yes. In a whole program, typos or mistakes happen. No need to try to prevent those. So do spelling or grammar errors when writing in English. We expect a professional writer to have a human editor to catch those and not be perfect. But asking an applicant for a writing job to find the spelling/grammar errors in a paragraph seems reasonable to me.
- agent327 5y agoThe simple fact that you think so tells me that you aren't a programmer, and that you should stay far away from interviewing or managing programmers. About the only thing the two situations have in common is that both are based around a text-based medium; for the rest there is just no comparison between writing computer code, and writing text for humans. Have you ever noticed how very few people can actually write both good computer code, and good documentation for the users of that code? That's because they are completely different disciplines, requiring a completely different mindset. Let's turn this around: if I were interviewed by someone who flagged down my code for missing a #include or lambda capture (both very easy mistakes to make), I'd know that the people I'm interviewing with are idiots with no understanding of the thing they claim to be testing me on. Would I want to work there? Nope.
- rplnt 5y agoe.g. a compiler But yeah, I think I've seen questions like that for an intern positions. It's basically a "have you ever seen this language?" to weed out people quickly.
- baobabKoodaa 5y ago> It's basically a "have you ever seen this language?" to weed out people quickly. It's not that. People who constantly use multiple languages in an IDE will not be able to point out most syntax errors outside the IDE. So it's not a "have you ever seen this language" filter.
- yobbo 5y agoIt is disrespectful, but it is a proxy test for how many hours you have spent reading and writing code in that language.
- kamaal 5y agoA while back Indian companies were notoriously famous for giving questions from Let us C, from Yashwant Kanitkar. The questions go like, What is the output of the expression below? int i = 10; ****++&&*+p; Followed by a myriad of options. Including things like Syntax error. Not sure how this measures language proficiency.
- lloydatkinson 5y agoThat probably explains a few things...
- rdedev 5y agoMy diskile of C and C++ were particularly due to such questions. Its always in C or C++ I see such convoluted questions
- mlindner 5y agoI've been working in C for most of my career and I've never heard of such questions. They're not in any textbook I'm familiar with. In fact they're incredibly pointless and irrelevant.
- roland35 5y agoOoof... I have done a few double pointers in my day *, but anything beyond that seems like bad practice!
- merlincorey 5y ago> What is the output of the expression below? > int i = 10; > **++&&*+p; > Followed by a myriad of options. Including things like Syntax error. I consider myself fluent in C and to a lesser extent C++ -- that's a Syntax Error in C, at least. This isn't a particularly difficult one to spot, but I can understand how it would be if you weren't very familiar the language.
- Ntrails 5y agoGithub PRs also lack syntax checking etc - so it isn't something you'll never see at work right? (Admittedly if the PR doesn't build why are you reviewing it but whatever)
- andix 5y agoThat's why you are reviewing a pull request in your IDE. And you are having a CI build and unit tests in place. If it doesn't compile or a lot of tests are failing, a sane person won't even bother to review a pull request.
- pcthrowaway 5y agoSerious question, as I've never done a PR in my IDE; hadn't even thought to. If you check out the branch in your IDE, is there a way to have it highlight the changes in the branch you're reviewing? Or do you need to reference the output from `git diff` or the github PR view?
- Macha 5y agoVS Code: 1. Open Source control window 2. Checkout the PR branch 3. Open the branches listing panel in the sidebar. 4. Mouseover the target branch of the PR 5. There's an icon that looks like two nodes with arrows pointing between them. Mouseover text "Compare with ...". Click it. 6. The search and compare panel in the sidebar has a listing of files changed, you can click a file to get a diff view. There are gitlab [1] and github [2] extensions which streamline this workflow if your code is hosted on one of those services, and let you leave comments in editor which show up in the web UI. IntelliJ has support for display a diff for a branch or github PR built in [3] but I hate their diff modal view. [1]: https://marketplace.visualstudio.com/items?itemName=GitLab.gitlab-workflow https://marketplace.visualstudio.com/items?itemName=GitLab.g... [2]: https://marketplace.visualstudio.com/items?itemName=GitHub.vscode-pull-request-github https://marketplace.visualstudio.com/items?itemName=GitHub.v... [3]: https://www.jetbrains.com/help/idea/contribute-to-projects.html#incoming_pull_requests https://www.jetbrains.com/help/idea/contribute-to-projects.h...
- 5y ago
- tsukikage 5y agoA past employer of mine used to have one of these. It was a true work of art: around two dozen lines of code with something to discuss in EVERY SINGLE LINE, ranging from dumb syntax errors to logic errors to problems of overall design. Made for some great conversations.
- skeeter2020 5y agoThe problem I see is that it probably looks really dense and complex the first time a candidate sees it. This is not a great way to start the interview. To me it comes across like "find Waldo in the next 30 seconds. Also there's a bunch of other characters hidden in there. Go!" We all know what we're looking for (kind of) but it's a very stressful approach. It might work better if you paired and wrote this crazy code, and looked to them to identify issues as you built it up.
- robinson-wall 5y agoMore than a decade ago I had an amazon interviewer write some perl on a whiteboard, and ask me to find the error. There were two - I pointed out both and they didn't seem super happy about it. To this day I'm still not sure if one of them was an unintentional error.
- dspillett 5y agoDone right there will be a lot more in there than syntax errors. A good example of this sort of test will separate those who have revised syntax without really thinking (they'll get the syntax errors but little or nothing else, great if you want to employ a human linter) from those who actually think about what they are looking at will spot much more (a logical error that would cause an infinite loop, a point where a comment and the code disagree, an incorrectly validated input, an injection flaw, a heavy expression inside a loop that could be done first and result-cached for efficiency (your compiler cannot always identify such situations), hard-coded credentials, bad naming, ...). The best may identify some but also state why in the grand scheme of things is might not matter (efficiency in code that runs once so 10μs and 100μs is statistical noise) or where other priorities might take precedence (for example readability and therefore ease of maintenance).
- read_if_gay_ 5y agoDoes this kind of trick question work well in practice? If they explicitly ask for syntax errors it would be a waste of time to also check the code for other errors. I can’t imagine many people opting to do that unless they know it’s a trick question.
- flemhans 5y agoIf you'd see an obvious SQL injection, wouldn't it be hard to resist telling them?
- scrose 5y agoI don’t see what information people can glean from those trick questions. Any time I’ve interviewed people I’ve made it a point to emphasize that none of my questions are trick questions and if anything is unclear, they should ask clarifying questions. The result? Interviewees are more comfortable and are far more honest about what they know, what they don’t know, and you get to see a glimpse of what they’re really like.
- randomswede 5y ago
- ljm 5y agoI had to review someone's PR for one interview. Ultimately I failed it because me feedback focussed solely on implementation details and asking if there are better ways to solve the problem (with some suggestions as a nudge). Apparently, that was fantastic and showed all the qualities of good coaching...but they expected me to point out all of the instances of poor indentation and other aesthetic things. My justification that it was unimportant and that running rubocop would fix it wasn't good enough - the PR had to know all of the nitpicks. You know, if I had to do that for every PR I reviewed, I'd be burned out in no time. It was a shame, but if I didn't flunk that interview then I wouldn't be where I am now.
- dsr_ 5y ago"if I didn't flunk that interview then I wouldn't be where I am now" This is, I think, the closest thing there is to a universal experience in this field. Followed closely by "how did I miss that single-character error?"
- Verdex 5y agoBased on your description ... that wasn't a failure. Success is not working at places like that.
- bluedino 5y agoI worked at a place that did something similar. VBA code, printed out in a proportional font, no word wrap so long lines spilled over... "What does this code do?" That was a pretty easy one to figure out, it pulled coordinates from a database table, and then it stepped along all the lines trying to find the longest one (they were a metal shop). "Do you see any evidence that this code has been optimized?" That was the dumb question.
- liveoneggs 5y agoyou prefer being asked to write it out long hand?
- xorcist 5y agoI have done this. Is it really such an insane idea? Makes for a nice break from "what does this code do"? You need some technical "anchor" to make for more concrete discussion points.
- skeeter2020 5y agoWould you accept "my build toolchain and linter will catch all of these syntax and stylistic errors." as an answer? 'Cause that's what all your devs are going to do IRL.
- xorcist 5y agoNot really since that doesn't leave much room for discussion, but that is my problem not theirs. The point is to have something to discuss, not to listen for a singular answer. Now we can discuss hypothetical situations and philosophy but I'd much rather have a concrete piece of code to go through. Seeking out problems and errors can be a good conversation piece. Hopefully you get to hear some anecdotes, prod the taste in style and how well that that taste might play with others. The interview situation isn't easy for anyone, and anything that can if something is even remotely qualified helps.
- skeeter2020 5y agoWhat is super frustrating is that these same companies and people are convinced they can find game-changing productivity gains in software development, like magnitude-level improvements, yet ask questions that, what little increases we've made in the past 50+ years have made trivial.This is just a lazy question.
- siva7 5y agowait until you see this asshole move being pulled to find a bug in production code under time pressure their team has failed in the real environment by being given out some thousand-lines long printed code from the development branch.
- kevstev 5y agoWe may have had the same interviewer- tbh I thought this was pretty reasonable and more of a warm up really. I think this also lead to a discussion on some questionable logic and how you could improve the code. I had 10+ years experience in C++, I thought it was completely reasonable. Especially compared to their later questions around something along the lines of finding a shortest path in a tree. I interviewed there a bit before their process was so well known to be game-able, I went in with zero study time on obscure algorithms outside knowing the O(N) of the most widely used, and certainly did not practice actually writing or interacting with trees and such.
- neutronicus 5y agoYeah, I had an interview like that There was a function with a syntax error, that also returned a pointer to stack memory, and made some logic error where it assumed a class with no vtable would be polymorphic.