VBScript Quiz Answers, Part Four, Plus, More Trivia!
Last night I gave away more copies of my book at our Visual Studio Tools for Office developer lab, but this time I made the trivia questions a whole lot easier. I played five rounds of "Odd Man Out" -- you know, like from Sesame Street. One of these things is not like the other, one of these things just doesn't belong…
Just for fun, how many of them can you get?
A) Mort, Elvis, Einstein, Roger
B) WMI, ADO, DAO, ODBC
C) Gudgeon, Springlering, Pintle, Tumblehome
D) Frodo, Pippin, Bilbo, Drogo
E) Chicago, Daytona, Everett, Cairo
Spoiler warning: I'll put the answers in the comments to this post.
Pizza, beer, VSTO demos and dumb trivia questions -- it's a developer paradise over here, I tell you!
Anyway, moving swiftly on with the answers to my VBScript quiz:
4) Inside a class definition, which of the following are syntactically legal? Why?
(a)
Private Default Sub Default()
(b) Public Default Function Default
(c) Public Default
(d) Public Default Property Get Default(Property)
(a) is illegal, the rest are legal.
(a) is illegal because it makes no sense to have a private default method. The rest are legal because it is perfectly legal to use
Default and Property as the names of member functions, properties and variables.
Why? We added the
Default and Property keywords to the language in VBScript v5. We were afraid that we would break existing programs from a previous version if suddenly they became illegal to use as identifiers. If anyone happened to use Default or Property as a function or variable name, that needed to keep on working. (And besides, VB6 doesn't reserve Default or Property either.)
We did have to make
Class a reserved word. If Class is allowed as an identifier then you can get into this situation:
Sub Class(x)
End Sub
Class Foo
and it becomes very difficult to know whether you are calling the procedure or introducing a new class. Hopefully not very many people were using Class as a variable name, because I broke all of them.
Comments
- Anonymous
March 03, 2005
The comment has been removed - Anonymous
March 03, 2005
Ah, the good old days of Chicago... when the whole OS was 40MB.
Memphis (Win 98) was the best code name and the best easter egg (it involved finding both Memphis, Egypt and Memphis, TN on the world map). - Anonymous
March 03, 2005
For B, wouldn't it be fair to say that ADO, DAO and WMI belong together because they're COM-based, whereas ODBC is just a data access API?
Oh, and D; is it Pippen in English? I think in the Swedish translation he's Pippin. But I've never read TLOTR, so I could very well be wrong. I didn't know about Drogo for sure :-)
- Kim - Anonymous
March 06, 2005
Wasn't Daytona also the code name for SQL Server CE 2.0?