Testing Your C Knowledge With This One Simple Quiz

One of the most exciting aspects of the C programming language — as effectively high-level assembly — is that although it’s a bit friendlier for the developer, it also adds a lot of required know-how on account of its portability across platforms and architectures. This know-how is what [Oleksandr Kaleniuk] manages to wonderfully illustrate with a simple 5-question, multiple-choice quiz on what the return value is of the provided function snippets of C code. How well do you know C?

For those who have had their run-ins with C directly (or indirectly via the support for it in languages like C++) the words ‘undefined behavior‘ (UB) are likely to induce a nervous twitch or two, along with a suspicious glance at whichever parts of reality are about to evaporate and destabilize the Universe this time. Although it is said that a proper C program is written with zero UB cases in it, in practice this can be rather tough, even before considering the other exciting ways in which a piece of code can fail to do the expected thing.

For languages other than C this is of course also a challenge, which is the reason why certification programs for e.g. avionics go out of their way to weed out such preventable issues, and only few programming languages like Ada (anything avionics, medical, etc.) and C++ (F-35 and other US DoD projects) make it into devices where failure is literally not an option.

Think You Know C? Find Out

I’ve had the fortune or misfortune of interviewing a lot of job candidates over the years. It amazes me how often someone will claim to know something, sound reasonable, but then if you quiz them on it, it becomes really obvious that they don’t know much. To flush this out, we had a three-question test that would tell you a lot. People who got the right answer were ahead of the game, of course, but even looking at how people approached the answer (right or wrong) would tell you a lot, too.

I remember one case where the answer involved casting a value. A candidate had impressed me until faced with the question to which he said (more or less): “Well, there’s this function. I think it is called ‘cast’…” I think the look on my face told him that I actually knew the answer (not surprising, since I was giving the test) and that wasn’t it.

[Oleksandr Kaleniuk] has a C quiz of only five simple questions. They reminded me of at least one of my old company’s three-question quiz. I don’t want to say too much about the character of the test because I don’t want to give away the answers, but if you think you are a C wizard, go check it out. Then come back in the comments and tell us how you did. Just try to avoid posting spoilers (although you should probably avoid the comment section until you come back).

Continue reading “Think You Know C? Find Out”

Numerous Quiz Buttons Built On The Cheap

[Sprite_TM] was tapped to build a rather large quiz buzzer system. Judging from his past work we’re not surprised that he seemed to have no trouble fulfilling the request. As the system is not likely to be used again (or rarely if it is) he found a way to finish the project that was both quick and inexpensive.

Each buzzer consists of a base, a button (both mechanical and electrical), and a couple of LEDs to indicate who buzzed in first. The mechanical part of the button uses a plastic bowl from Ikea and a wooden dowel surrounded by some pipe insulation. A momentary push switch is glued on the top of that dowel, and the insulation projects above that just a bit. This way it acts as a spring. The Dowel has been sized so that the bowl lip will hit the wooden base just as it clicks the switch.

As you can see, all of the buzzers are interlinked using Ethernet cable. The real trick here is how to read 14 buttons using just one CAT5 cable. This is done with the clever use of a 4×4 button matrix for a total of 16 buttons. The matrix also includes the LEDs for each buzzer. Since CAT5 has four twisted pairs this works out perfectly.

Looking for a more robust system thank this? Here’s a pretty nice one.