Coding challenge for the bored

Just a quick quiz that popped up.
Test your basic python post your score.

4 Likes

7 out of 8. So could do better.

2 Likes

8/8. Since I don’t use python, I was a little unsure on the while loop, and my brain kept telling me the answers for most of the print() statements were wrong because they didn’t have a trailing space on the string…

6 Likes

8/8. I don’t use python, either, but my PHP got me through.

6 Likes

8/8. Easy to answer if you have used most any language.

A really fun site is hacker Rank. I found it when I preparing for interviews but it’s fun enough to do any time. I was pretty happy when one of the companies I interviewed used the site for my initial screen. Types of problems are broken down such that you can really focus on a particular type of problem or you can hit a wide range of problem types. Every problem has a discussion area so that you can discuss different approaches and see how others solved the problem.

4 Likes

7/8 here. I guessed wrongly that it would do BODMAS

4 Likes

This quiz is ridiculous. Who is it even for?

1 Like

Bored people on the internet who can’t be arsed doing any actual coding. Not me of course, I’m the exception. :wink:

5 Likes

A company I did technical interviews for had a basic programming question that asked the interviewee to write a for loop to find a missing number in an array of numbers.

I watched several dozen people spend 30 minutes trying and failing to do this. Lets not even talk about handling corner cases or tricks to avoid having to inspect each element. Just write a damn loop and check for a condition.

It’s really hard to watch someone struggle like this for a prolonged period of time.

So to answer your question, for people like I interviewed to tell them to study harder or pick a new hobby/career.

8 Likes

Software lore I picked up: a prof once did an analysis of students’ pretests and the best predictor for how well they’d do in the class was whether they had a consistent model of how the assignment operator works. Didn’t have to be correct, just logically consistent.

8 Likes

I think I’ve seen their code in the wild. :wink:

8 Likes

That makes total sense though. Assignment operators are tricky. You need to understand pass by reference, pass by pointer, and pass by value, and obviously the difference between a shallow copy and a deep copy.

6 Likes

This is something people need to do to understand programming, not demonstrate proficiency in any language. Like, it’s what you learn immediately after figuring out that programming isn’t ripping open the computer and soldering it. Who would say they’re a programmer but not understand what that means?

4 Likes

…and then there’s what your wife assigns to you, usually of the pass-by-Mac’s-Milk-to-pick-up-some-milk-and-bread variety, and if you botch the assignment, you had better damned well be a smooth operator…

5 Likes

It was baffling.

Then there was the person that came in on a recommendation from an employee and started to type the solution perfectly before we had fully given her the complete problem. She gave the optimized answer. She asked zero clarifying questions even though what we initially provided was intentionally a little vague in some areas. To her shock we gave her a second problem that was equally basic. And strangely she struggled a lot with just solving this second problem. I’m not sure what happened to the employee beyond that the hiring manager passed on that the person they recommended seemed to know the exact problem and optimal answer ahead of time. I know they didn’t get the $1000 hiring bonus.

10 Likes

Number 3 was wrong.

myname = "Taylor"
print("Hello", myname)

Will print:

HelloTaylor (not Hello Taylor)

Lame!

Shamefully I got 7/8 because I forgot my order of operations in the math one (a pragmatic programmer sprinkles parenthesis into to compound math operations to ensure proper ordering).

Assuming behavior of a + b * c is a great way to code annoying bugs. (

Also I’ve never written a line of Python. I don’t mess with languages that don’t use semicolons unless it’s assembly.

9 Likes

@ficuswhisperer is right that 3 is wrong, but it’s multiple choice, so hey.

I got 8/8, and since I’m a BSA who gets told my job is “non-technical” all the time, this pleases me. Even if it is just a Buzzfeed quiz.

5 Likes

I’m more familiar with this, although it is less hiring oriented:

6 Likes

The test also fails on one small point; you can deduce the answer to (1) from the other questions!
More generally, I agree with the @ficuswhisperer comment above about order in expressions: personally I think that except with RPN, expressions like a + b * c should evaluate to undefined: because people get them wrong so often that this would surely reduce the number of bugs. It’s 2017, parentheses are cheap, and in my experience people who want to demonstrate their 1337 (that seems so long ago) programming skills with long bracketless expressions or complex regexes are a source of present and future trouble.
(I once had a newly graduated programmer who without permission took a whole block of code and replaced all the date entry sanity tests with a regex of his own devising which was “so much better” than letting Calendar check it. Sure enough, it didn’t know that 1900 was not a leap year. In fact, it didn’t know that any year wasn’t a leap year. But he had got A for the assignment…)

6 Likes

The quiz is actually correct assuming this is Python 3. A space will be used to separate positional arguments to the print function, so it will indeed output Hello Taylor. You can try this online if you don’t have a python interpreter handy.

Python 2, of course, will instead print ('Hello', 'Taylor').

8 Likes