Jul 31, 2014

How many bits are allocated by "int i;"?

A few years ago I took the Texas certification exam you must pass if you want to teach computer science in grades 8 through 12. It was a waste of time because I wound up teaching in junior colleges where you need at least a masters degree, but no certification. (Isn't it more than a little bit odd that you need a certification to teach in grades K-12 but none is required for college level teachers? Makes no sense to me.)

The test questions were mostly very simple, some down right stupid. But one question left me completely stumped.

How many bits are allocated by "int i;"?

You are supposed to pick the correct answer from a list of four possible values. None of the values were 64, but 8. 16. and 32 were on the list. IIRC 24 bits was also on the list.

At first I thought it must be 32. But, then I realized they had not stated which programming language they were talking about. Off the top of my head I could think of four languages with an "int" data type. It could have been C, C++, Java, or C#. I'm sure there are many more possibilities.

Depending on the age of the test and the version of the standard and/or the implementation of which ever language it was the answer could reasonably be 16 or 32. Which to pick? I picked 32. I didn't get a perfect score on the test, actually I got a high "B". Kind of embarrassing. But, I didn't feel too badly about the score. More than one question was either incomplete or had an answer that wasn't in the multiple choice list of answers. Ever been in that situation? You have to pick the correct answer from A, B, C, or D, but there is not enough information provided to pick the answer they want. Makes for a nasty day.

The point I'm trying to make is that the people, the panel of experts, chosen to write the test knew less about programming languages than I expect a second year CS student to know. Maybe standards for second year students have declined since I was in school (yeah, I know, typical old fart comment!). But, standards for experts have not declined. So, how could this happen? Even if you assume the language was C, the answer could be either 16 or 32. And, truth be told, I know of implementations where it could have been 36 bits.

The people who wrote the test did not know that there was more than one valid answer to the question. They could have checked most of the answers to the test questions by exercising their google muscles. But, they did not. The people trusted to write the certification test for CS teachers in Texas are clueless on the subject they are supposed to be experts in. So clueless they didn't even try to verify their answers. OK, what does that tell you about the other certification tests?

To make it worse... not long after I took that test CS was dropped from the required curriculum in Texas schools. That almost makes sense, if you can't even write a valid certification test, maybe you shouldn't try to teach the subject at all.