When and where did this convention originate? [...] or does it predate Microsoft's original BASIC interpreter?
I would put Time-Shared BASIC as the first, but that's just an educated guess due to HP Time-Shared BASIC being not only extremely influential to later implementations (*1), but also being one of the first interpreter based BASIC, which is the important part here, as Dartmouth BASIC and all direct successors (Super Basic, etc.) were compilers.
[Maury Markowitz checked the TSB manuals and it does not show up, so it must be later.]
It was that introduction of interactive interpreters that led to the "invention" of the question mark command. Or better, shortcut, as it's really all about less typing for interactive queries. Usability in program source is more of a side effect.
Why was the question mark in particular chosen, and not some other character that happened to be unused by the language? [...] Did whoever originally chose the question mark give any rationale for this decision?
It seems, at least to me, rather obvious. The meaning of "?" isn't really "Print ...", but to ask the interpreter about something. Think of it as "Tell me ..." or "What is ...", as in "what is 2+2", or "What is (the content of variable) A".
This usage became possible the moment BASIC was no longer a compiled language, but interpreted. This enabled two new and very convenient use cases for/with BASIC:
- Using BASIC as a pocket ... well, desktop, calculator to solve expressions.
- Stopping a BASIC program at arbitrary locations and inspecting state/content of variables. (*2)
Both are based on simply printing the result of an expression, so use of PRINT
as interactive command (*3) came quite naturally. Except that it's 5 characters plus a space - not really what anyone would love to type over and over. Having a single stroke replacing five would be welcome, and using a punctuation character may even avoid typing the space.
So, what punctuation, available in 7 bit ASCII, would you choose to ask the computer for something?
*1 - Most notable with microcomputer BASICs that followed HP's style of string handling by indexing, like Wozniak's Integer BASIC, Atari-BASIC or Sinclair BASIC.
*2 - This may be surprising to young folks only accustomed to interpreters, but in ye-goode-olde-time(tm) of compiled BASIC one had to use a machine monitor to inspect memory once a program was STOPed. That is, if the environment allowed this at all. :))
*3 - Interpreters also mark the point when BASIC instructions became directly executable. With compilers such as Dartmouth BASIC, only editing was interactive. Heck, even INPUT
was only added two years later with the Third Edition in 1966.