Slashdot Mirror


Programming Job Skills Test?

eclecticgeek asks: "I've recently finished a CS/SD degree at uni and the interviews are starting to come thick and fast. I've yet to have a skills test for any of them, and it's only a matter of time before I do. I'm hoping to do one this week and I will get the choice of language. The position is quite broad and they're more after competent programmers in general, rather than any one specific language. So I'm wondering, have you done a developer skills test? What type of things did you get asked?"

27 of 189 comments (clear)

  1. sort of... by bblazer · · Score: 2, Interesting

    I once got asked what was on page 71 of the "Camel Book." Most just wanted to see code samples, and asked more about how I would handle certain tasks. I guess they were more interested in how I thought about the algorithm or the problem at hand. The actual language came second.

    --
    My .bashrc can beat up your .bashrc!
    1. Re:sort of... by ComputerSlicer23 · · Score: 2, Interesting
      I've never been asked certain questions, but I can tell you without looking that the printf specificiers are on page 151 of K&R C in the first edition, and on page 155 in the second. I used to forget all the various format specifiers and rules. I haven't used them in so long, that I don't care any more. However, I still remember the page number.

      I used to know exactly the page that function pointer syntax was described in the Harrison and Steele C book (Not sure if Harrison is the right guy, but Steel was the other author). I've since forgotten it and now remember, http://function-pointer.org.

      When I was still boning up on C++ I could tell you the chapter headings of most of the chapters in Strousops book. I haven't read the book in so long it's ridicilous. I can still tell you which books introduced me to which topics, and other better references I've found on that topic since then.

      The sad part is I've used function pointers regularly enough now, that I can tell you how to do everything but a function pointer to a member function off hand. I can generally figure out a pointer to a member function in fairly short order given a compiler.

      Kirby

  2. Skills test...you get lots of interviews? by SunFan · · Score: 2, Interesting


    Skills tests are as unique as the interviews that contain them. What interests me, however, is that you say you are getting tons of interviews. Are companies hiring, again? I gave up on the IT industry last year after seeing the rotten low-hanging fruit that was available. It seemed the only open jobs were the ones that no one wanted.

    --
    -- Microsoft is the most expensive commodity operating system and office suite vendor in the marketplace.
  3. Don't fret over this by marcus · · Score: 4, Interesting

    Sometimes it is not the code that counts, but your approach. Are you applying for a software "design" position? If so, then show some evidence of designing something before you code. Consider the position you are targeting. Application software? Embedded firmware with restricted resources? Is pure speed important? Code size? Maintainability? Portability? Ask for a more detailed spec if what is given is too vague, or just put comments in your code showing where things should/could be changed if your interpretation of the spec is wrong.

    If you are competent, you'll be OK. Every coding position I've ever had included a skills test, except one. The one exception was for a position at a company that I had already worked for in the past...

    --
    Good judgement comes from experience, and experience comes from bad judgement.
    - W. Wriston, former Citibank CEO
    1. Re:Don't fret over this by kraut · · Score: 2, Interesting

      Make sure you only put stuff on your CV that you actually know - I hate nothing more in a candidate than claiming skills they don't actually have. If you only know C, and have just looked at a C# book, that's fine - as long as you don't pretend to be a C# expert. Otherwise you will be found out, and you won't get the job.

      --
      no taxation without representation!
  4. I've done a few by jd · · Score: 3, Interesting
    Most have asked for samples of code. Typically, this has been where the requirements were for things like PHP, ASP (bleagh!), Javascript and other web-based stuff.


    Jobs that have required "application" programming have typically set specific tasks. One I did wanted a search engine for web pages.


    Yet others have involved very specific technologies. These are usually but not always in the form of a certification-style test. One that I did of this sort involved the real-time aspects of the ACE/TAO implementation of CORBA.


    It depends a lot on the company as to what they are actually looking for. Bleeding-edge companies are likely to be more interested in novel solutions, for example, because it shows you can think and not just copy. ROTM companies, on the other hand, want things done fast and never mind the details. Any company that brags about ISO 9000 is likely a stickler for standards, whether the solution is any good or not.

    --
    It's a small world and it smells funny; I'd buy another if it wasn't for the money; Take back what I paid (SoM)
  5. General Logic by web_boyo_in_sac · · Score: 5, Interesting

    I got this at my last job as part of my second interview, thankfully it was a take home "quiz".

    "You are stranded on a deserted island, thousands of miles from nowhere you are forced to survive with what you have.

    You have a handful of nails, a hatchet with a hammer head, 100 feet of rope, a large lens and a few dozen square yards of sail cloth.

    The island has a variety of birdlife, fishing and crabs, but mostly inedible seeds, very acidic but edible berries and a large grove of coconut palms.

    One side of the island seems to be geothermally active with several hot springs and some sulfer smelling vents, and a large variety of volcanic rock, obsidian and flint along with some hematite and copper deposits.

    Now given this very restricted and scientifically unplausible situation, how would you survive?
    Please take as much time as you need and give as thorough an answer as possible."

    1. Re:General Logic by GlenRaphael · · Score: 4, Interesting
      I'll take a brief stab at it.

      Immediately, you need water, food and shelter. Shelter is the easiest: tie a length of rope between two palm trees, drape the sail cloth over the line and weigh down the corners appropriately; you've got a basic pup tent or tube tent to (somewhat) protect yourself from the sun and the wind.

      You can get water from coconuts a la Cast Away. Use the obsidian to fashion spear heads for fishing, and the flint to sharpen your axe. (You can actually catch fish in a river with your hands alone - I'm not sure if that applies here. In any case, tools are a good thing. ) Crabs should be pretty easy to catch with the help of a cup or a basket or a spear.

      Use the "large lens" to start a fire for warmth at night and to cook the fish. And perhaps to look for ships.

      Medium term: Build a big SOS sign and have moss handy to throw on the fire for smoke to signal any passing plane or boat. Build a more permanent shelter. Explore the entire island and inventory everything on it.

      Long term: Build a smokehouse. Find ways to accumulate and stockpile excess water and food and firewood beyond your daily needs -- especially water. If no rescue boat shows up, ultimately build a raft or sailboat and take your chances.

      Eat the berries every once in a while so you don't get scurvy. I don't know enough metalurgy to do anything with the sulfer/hematite/copper, but it's not clear you need it anyway. Do you? What am I missing? If I knew metalurgy I'd probably want to cast more nails or make a drill bit...

      --
      I play Nerd-Folk!
    2. Re:General Logic by bladesjester · · Score: 4, Interesting

      Actually, copper's even easier than that. Copper is one of the few metals that can be worked in a fire as cold as a campfire (this is where I put on my smith's hat).

      In order to extract the copper, all you really need to do is break the rocks up into smallish pieces and toss them in the fire. when the fire has gone out, remove the rocks, and dig the copper out of the sand. To work it, just build another fire to heat it.

      You don't want to hammer it cold. It cracks like you wouldn't believe.

      To extract the iron from the hematite, you'd basically need to make a crude bloom forge or a primitive smelter. The palm fronds would provide the carbon content if you could get the fire hot enough (The Japanese used rice stalks and charcoal to smelt the black sand that was used in the production of swords before they started trading for higher grade materials that were easier to work with). The main difficulty in getting the fire hot enough is forcing air through the fire, so it's really not all *that* difficult.

      As far as the iron being too hard to work with a rock, it's not. The master I studied with did an amusing trick by making horse shoes using a glass coke bottle for a hammer. To make a basic hammer, all you need is to take a piece of steel (which you can make and mold, or even shape with the hammer head of the axe) that is rectangular and affix a handle to it.

      --
      Everything I need to know I learned by killing smart people and eating their brains.
  6. Don't Lie by CertGen · · Score: 3, Interesting

    I can't tell you how many times now I've interviewed some little fresh-out-of-school-all-eager-and-willing twat who has every language any one ever mentioned to him in school listed on his resume.

    Don't lie about what you know.

    If you cannot answer a simple question in a language you've listed on your resume then it shouldn't be there.

    If you really think you need to bone up a lack luster resume with lists of useless abilities be smart about it. Make a grid and list the language and your current level of proficency. Then the interviewer isn't appalled when you're asked to answer a simple question in Perl but you can't remember how even declare a scalar in Perl because you only ever wrote one Perl script...

    ...five years ago...

    ...but really you just copied someone else's Perl CGI script and changed the HTML output to match your own amateur porn site's look and feel.

    1. Re:Don't Lie by Ratbert42 · · Score: 2, Interesting
      Don't lie about what you know.

      Amen. That is the kiss of death. I interviewed three guys today and busted one guy on two different "keywords" he slipped on his resume but didn't know. We shot him down and told the placement agency that his skills didn't match his resume.

    2. Re:Don't Lie by Ryne · · Score: 2, Interesting

      I'm a little bit curious how you would consider someone who wrote that he was proficient in only one language.

      Java is pretty much the only language that I feel comfortable enough with to start off coding right away, but I've dabbled into lots of other languages and I'm of the oppinion that anyone with a proper programming background can pick up pretty much any language.

      In this case, will it help to write a list of languages I've used (more than copying someone's script :) to show off that I have a broader background than only Java?

  7. Not Language Specific by etedronai · · Score: 2, Interesting

    In general when I give written tests to try to judge a software engineers skill it is not language specific. I am not interested in seeing if people have memorized all of the constructors that are associated with a HashTable. Rather I am trying to find out where they are as a programmer and as a software engineer. To this end I ask for them to answer all question is pseudo code or their favorite language. I generally arrange the test to get sequentially harder - so it will be arranged something like:
    1. Implement a fuction that takes in a string and returns that string with the characters in the opposite order.
    2. Implement a function with the same functionality as question 1 but implement it with recursion.
    3. Write me two functions, that are meant to run in a thread safe manner, where one function pushes strings on to a stack and the other retrieves data from the stack and prints out the string.
    4. Please develop a high level UML-like design for a simple thread pool. Please be sure to include ways to retrive threads out of the pool, exprire threads out of the pool when they have been inactive for a certain period of time, grow as usage increases etc.

    Those are the types of questions that I ask. Once they have answered all of the questions I generally sit down with them and grill them on their answers - to me this is the most important part as you get to see how they react to their answers being questioned, see how fast they can think on their feet and see how they pick up new ideas that are given to them and how they can apply that to the problems that are given.

    Just my 2 cents.

  8. Choose Your Language-Functional by Anonymous Coward · · Score: 1, Interesting

    "I would feel more comfortable in (given the concept in a skills test is assessment in a short space of time, a conceptually 'nice' RAD language (that can be programmed quickly as well as designed quickly) would win over stock languages)."

    That would be Flowdesigner.

    Failing that there's Lisp or Smalltalk.

  9. Re:I lost a job to one by Glonoinha · · Score: 2, Interesting

    Too bad for them; two years later that ad is still running at least once a month.

    And that is about the stupidest part of the hiring process. I went through about the same thing with a company a few years ago - they wanted two years of embedded code experience in some obscure language (which of course I didn't have.)

    Two years later they still haven't filled the position - for fux sake, if they had hired me back then I would have two years in their exact application by now. If a company leaves a position open for a year because they want a year's experience in something - they could have brought in a guy with a broad background and brought him up to speed in the year, and trained him to think the way they wanted.

    --
    Glonoinha the MebiByte Slayer
  10. Are you serious? by Anonymous Coward · · Score: 2, Interesting
    This sounds like the episode "Arena" from Star Trek (The Old Series).

    With nails, hatchet, rope and cloth you could probably build some sort of raft but whether that would be sea worthy is another matter.

    Probably would be a mistake to eat the berries as they would probably rot your teeth and then you wouldn't be able to eat much of anything. Perhaps, there is some other chemical use for acidic berries?

    You could probably build a crab trap with the rope.

    You could probably start a fire with the flint.

    You might be able to build a sea worthy vessel out of copper. You'd certainly have plenty of sand to form a mold.

  11. Smartest Test by Poietes · · Score: 2, Interesting

    Some companies here in NZ use a particularly smart test to find good programmers. After they've established the technologies you are fluent in, they will ask you to code something specific using a language that you've never used. You are given Internet access and a time limit. Since good programming is language-independent, and it is the use of good underlying concepts and technique that is more important, I think this test much better demonstrates a potential candidate's ability to adapt and solve problems without requiring them to demonstrate rote learning of tons of APIs. If you get a skill test along these lines, count your blessings and do your best to get a job with the company that set it. They understand what programming's about.

    1. Re:Smartest Test by tomstdenis · · Score: 2, Interesting

      That's not always true. Some languages do have idiosyncrasies that are nasty to overcome. Ruby for instance is nothing like C. Same thing with Python.

      So if you put on your resume
      - Mastery of C
      - familiar with Java, Perl, C++

      I wouldn't expect them to ask you to write a Python webserver or something "to see how you think" during an interview.

      RiM [the blackberry makers] are big on quizzes too. I posted for a job online and they made me solve some "number of shapes with N sides" puzzle. I was 99% to an answer so they were a bit annoyed but decided to interview anyways. During the interview they gave me another question [about how to draw some form of pascal triangle].

      While we were discussing the question I basically asked him "does solving puzzles make me a great employee?" to which he replied "it's good to know how you think" or some such.

      See my background is crypto and math. I know how to multiply fast, how to exponentiate fast, etc. But because I took the full 3 minutes to write the algo [for the triangle thingy] he seemed not pleased as if I wasn't smart enough for the job.

      So I then asked him to give me an algorithm to multiply 1024-bit numbers quickly [less than n^2 time] to put him in his place. He said he didn't know how and was mystified by the question. I told him "oh, well because YOU can't solve that puzzle you're a bad employee".

      At which point the interview was over.

      To me interviews are stressful. Giving stupid questions is retarded. Wanna see what I'm capable of? Check out the 100,368 lines of C, TeX and Perl that make up my public domain portfolio [e.g. libtom projects] that is used by corporations around the globe.

      But somehow that doesn't count.

      During an interview at entrust [a crypto company] they didn't seem to care about LibTomCrypt and more so if I could debug a Java program they printed out [it had a race condition]. I never said I was proficient at Java [my resume lists it but all my projects are in C].

      Mostly I think interviewers don't do proper background checks. They [entrust] never downloaded a copy of LibTomCrypt to look at it. The questions were not suited to my resume [they called me first!] and I left feeling stupid because I couldn't answer the questions properly. ... just my experience...

      Tom

      --
      Someday, I'll have a real sig.
  12. Worst interview ever! Ever! by PylonHead · · Score: 3, Interesting

    I was working a job doing Windows apps in C++ by day, but what I really wanted to do was develop games. I had done some small scale stuff on my own, and I wanted a chance to do it professionally.

    So I heard through the grapevine that a small computer consulting company I knew was looking to develop a game, and they were looking for a programmer. I decided I would try moonlighting on the game while keeping my day job. I showed up after hours, and was met by the top three people that ran the place.

    I was ushered into a small dark office. They sat in a rough semicircle around me. After a brief introduction, they started firing difficult logic problems at me. For about an hour and a half. No paper, no time to myself, I was expected to work out the answer out loud. It was intimidating as hell.

    But I'm good at that type of stuff, and although I needed a little prodding on one of the problems I eventually came up with the right answers. They seemed satisfied. I explained what sort of compensation I would require, they agreed, and we decided I would come in after hours the next day to get started.

    So the next day rolls around, and I show up. I get setup on a machine, but clearly the president of the company wants to talk to me about something.

    So he comes out and says it. "Well, I've talked to my associates, and we've decided we don't want to pay you. We're a little cash poor right now. So what we want you to do is create a prototype, and we'll market it, and cut you in for a percentage of the profit."

    I was floored. They wanted to make all the decisions, while I did all the up front work, for the possibility of some of the profit later on. They wanted me to be their bitch.

    If they had told me this up front, I would have walked out the door right then, but instead I had to sit through the most stressful interview of my life, fighting for their approval. Blech.

    --
    # (/.);;
    - : float -> float -> float =
  13. Re:Simple tests by kmahan · · Score: 2, Interesting

    Sorry -- we did say "signature." I was in a hurry as I was writing the base post.

    As for weird answers from the programming question -- here are a few that I remember:

    - "What's a linked list?" (bad answer)
    - Arguing about the definition of a Singly Linked list (they wanted to use the back pointers of a Doubly linked list)
    - A popular one was writing a routine that walked through the list but didn't actually reverse it
    - Another popular one was the "repeatedly walk to the end of the first list, remove the last node, then walk to the end of the 'new' list and put it onto the end of that one" -- correct but inefficient.
    - A variation on the above would be do do the same thing but create a COPY of each node as you put it into the other list
    - Walk the initial list, get a count, create an array of nodes, walk the list again setting the array elements to the corresponding node in the list, then walking the array backwards to get the reverse order
    - write a loop that tries to walk through the list and "switch" pointers (doable, but rarely done correctly, also lots of temp vars and pain involved)
    - one person that I recall tried to create a new node type with a previous pointer, went to a lot of work to copy things over, and then walk backwards reversing the next/prev links.

    Some folks were careless and even if they got it reversed wouldn't check to make sure they'd cleared A's next ptr.

    I always asked the person talk walk through their answer with a simple a->b->c linked list and tried to help them arrive at a working answer. Some people appreciated it and tried to make it correct. Some people got very annoyed - first because they were being asked to write something this trivial, and second because they walked through it and found they got it wrong.

    Lots of people got it correct on the first try.

    --
    Invalid Checksum. Retrying.
  14. Re:I lost a job to one by Bill+Dog · · Score: 2, Interesting
    Don't assume. Two possible scenarios (among prolly others):

    1) They have no intention of hiring someone that answers the job posting.
    a) They're establishing that they can't find anyone qualified for the position, making it H1-B eligible.
    b) They've already picked out a candidate, or plan to only fill it internally, but regs, such as if it's a govt. job, require them to announce it publicly.

    2) Overworked programmer bitches to his boss about being overworked, and that they really need to add another body. Boss just wants him off his back so he says okay and tells HR to put up an ad. HR puts out the notice of the job, and responses fill an inbox or db somewhere. Boss never calls HR back to get a list candidates, because he doesn't care. Developer assumes company tried but couldn't find anyone.

    --
    Attention zealots and haters: 00100 00100
  15. Quizzed in an invented language by dmorin · · Score: 3, Interesting
    I was told once to expect a programming quiz. I got there and discovered that the quiz consisted of 20 questions about a completely imaginary language. Each page of the quiz would explain one rule of the language, then ask a question about it. The trick was that as you got farther in the test the knowledge from previous questions factored into the answers.

    HR guy told me I had to get 18 out of 20 right or I was done. Then he said I had about 3 minutes per question, and walked out. I finished it, checked my answers, changed about 5 answers...and scored an 18. Turns out the 5 I changed were indeed wrong and I'd changed them to correct answers. Phew!

    Most annoying part was when I asked the HR guy why I'd gotten the two wrong. He said he had no idea, he only knew the correct multiple choice letters, not any logic behind them. So being a geek I opened the book back up, rethought the two I'd missed, and came to the correct solution for both of them. Of course at that point he didn't care, but damnit I did.

    Compare that with the job where I currently am. I was asked a programming question, I wrote some code, the interviewing manager told me that it was a good "brute force" answer. Well that bugged the crap outta me, so I thought about it all the way home, thought of a better answer, and emailed it to him with a note saying "It may be too late for this to matter but my head will explode if I don't send it." During the next round of interviews I told one of the engineers that story and he laughed and said, "Well, I know two people that did that exact thing, and both of them work here now." make that 3.

  16. MacGyver a Powered Transmitter? by Schwarzchild · · Score: 2, Interesting
    "Using the acidity of the berries in conjunction with the nails, you could make a battery of some kind. Probably not enough to do much given your other equipment, but its at least a use."

    Yes, yes. You could build some sort of very primitive crystal radio using the hematite and copper. Additionally, you might be able to power a transmitter by using the berry acid as a battery. Of course, even if you were able to reach someone by short wave radio or whatever you might not be able to tell them where you are.

    --

    "sweet dreams are made of this..."

  17. Re:Simple tests by darnok · · Score: 2, Interesting

    All good points in the parent...

    When I bring new techos into a team, I want them to have the following tech background/skills:
    - strong communication skills. Very very important in any coding environment, and becoming moreso as outsourced development, Extreme Programming etc become mainstream. You'd better be able to talk to peers, superiors and underlings, or you're going to waste a lot of time and money. You don't have to be the best speaker in an interview, but you need to be able to sustain a technical discussion
    - significant real-life experience with BOTH a compiled (e.g. Java, C#, C++, ...) and a scripting (e.g. Perl, Python, Ruby, ...) language. It's surprising how often this comes up, but people who say something to the effect of "I use {C#, Java, C++} for everything and never need anything else" basically lose me there and then; that tells me either they're very inexperienced and/or very inefficient straight away. Or possibly Richard Stallman ;->
    - experience working in a team, on some sort of significant project. That could be a CS project at university; what I'm interested in is their perspective on how the roles and responsibilities within a team dynamic work, what they've learned from the experience and where their personal interests lie
    - expertise in a mix of CS areas. I realise that's tough when you're just finishing a CS degree, but in that case people who've done units outside of the standard Java/C# coding stream would gain extra points from me. A guy who presents as "All I want to be for the rest of my life is a coder" probably won't work out that well in my experience; it's the guy who's prepared to take other stuff on that will tend to get ahead
    - a life outside of IT; family, hobbies, whatever. If you've got that, that generally means you've got fair to good time management skills in order to get your degree while keeping other balls in the air, and those skills will be called upon in most technical roles

  18. Evil Java question by rjshields · · Score: 1, Interesting
    I've never been asked this one, fortunately because I would have got it wrong:

    int i = 0;
    i = i++;
    What is the value of i now? (Hint: it's not 1)

    It seems Java behaves differently from other languages in this respect.
    --
    In this world nothing is certain but death, taxes and flawed car analogies.
  19. Gilligan's Island by obtuse · · Score: 4, Interesting

    First - survival, but you might have one volatile asset to help with your rescue. Do you have a watch, and is it still running and on time? Do you know the date? If so, the sooner you take a reading of the angle of the sun & combine it with the time, the more accurately your position can be determined. Otherwise, start tracking the arc of a shadow & wait for the solstice, & take a readings then. Include these readings on the messages you toss into the sea. (Pumice, coconut husks?)

    Make shoes - you won't live long if your feet give out. Any injury could kill you by way of infection. Make clothes from the cloth, and conserve it. It will deteriorate in the sun, but better it than your skin. If you can clothe yourself with feathers or anything else, you want to do that instead. Depending on how long you are on the island, you may need to make a sail from the cloth. It is also a source of fine thread. You might use it to skin a boat.

    Make a prominent distress sign, visible from the air.

    You can distill water from the hydrothermal vents, or at least use the heat to distill seawater.

    Can you make a compass from the hematite or nails? If the hematite is specular hematite, it may be possible to polish it into a signalling mirror. Try the copper too.

    With the copper & nails as a battery (voltaic pile) you could make a spark gap generator to produce radio noise. It's a little Gilligan's Island, but you could probably rig a machine (powered by wind, or gravity by way of ported water or sand) to use this to constantly transmit SOS. Depending on your ability to work the copper, you may be able to make enough wire to make a simple radio receiver & speaker. You may need to use your battery to magnetize pieces of nails.

    If the wind is constant enough, you might make a kite to hoist an antenna.

    Can the seeds be made edible after making into flour and treating with ashes or the acid from the berries? Acorns aren't edible either, but lot's of people have survived on them. Vary your diet to avoid scurvy, ricketts or worse.

    How large is the lens? If it's a page sized fresnel lens, then you can melt concrete with those, so smelting small quantities of iron is not entirely implausible. A blind spot in the center of your vision won't improve your survival odds, so don't look at the hot spot. Hang the lens on a frame.

    Prepare a signal fire, & keep coals ready to light it. Don't burn down your coconut trees.

    Can the berries be fermented? Not just for entertainment, but alcohol can clean wounds, and could be useful for fuel.

    Nothing gets thrown away or tossed into the sea. Make a latrine in a place that won't cause any trouble. Even your waste is a resource. Look out for birdlime. You might just be able to make a black powder flare for signalling from that, the sulfur & some charcoal. Burn as little as you must, as you don't have time to wait for fuel to grow. Besides, you've got free heat from the hydrothermal vents.

    As others have said: Obsidian & flint: Knives, spear points. Coppper -fishhooks. You could probably work the nails too. Lots of other excellent suggestions here. With the copper & hematite, you should be able to make a diode, and from that a radio receiver. Good luck making a speaker or earphone. Homemade wire, nail fixed magnet, diaphragm of palm or cloth. Handy, but probably impossible: Triode amplifier.

    Finally, use wax from the berries & feathers from the birds, & make wings. Fly away, but don't get too close to the sun, or the wax will melt and you'll fall into the sea, to the dismay of your father.

    A related problem is how does one make accurate tools or measuring devices without already having them? One way to start is by making a flat surface by rubbing two things together.

    --
    Assembly is the reverse of disassembly.
  20. Re:easier than that (one line) by ameline · · Score: 2, Interesting

    I'm afraid I can't hire you with that answer. While shorter, it is clearly undefined in C/C++. I quote (from memory) the relevant ANSI/ISO standard; "Between the previous and next sequence point an object shall have its stored value modified at most once by the evaluation of an expression. Furthermore, the prior value shall be accessed only to determine the value to be stored." You are modifying 'a' twice between sequence points. And NO, an assignment operator is NOT a sequence point.

    --
    Ian Ameline