I recall a DSP class where there was an exam with a question like (not exactly this):
> What does the following code print?
> `printf("Hello, world!");`
If you responded with:
> Hello, world!
...which - of course - the whole class did, you got the question wrong.
If you responded with:
> "Hello, world!"
...which is actually not what that would print, you got the question right.
A small band of us went to the professor and noted that, in fact, `printf("Hello, world!")` does not print the quotes. But he wanted us to show that it printed a string, and we denote strings by quotes.
This was something that we learned to do just for him - all strings had to be enclosed by quotes, to denote that they were strings. As far as I'm concerned, it served no practical purpose; we never had to differentiate strings like "Hello" from ['H', 'e', 'l', 'l', 'o', 0] or other representations.
A better example of how this could go - and not one that had anywhere near the same stakes - was a question on the entrance exam for my college radio station:
> What is the airspeed velocity of an unladen swallow?
I got this question right by answering, "Ni!"
(edit: formatting)
But... it does not print a string, a string goes into it but what comes out of the function is not that programmatic feature we call a string in any way shape or form, what comes out depends on the output device specified, it may be ink on paper, lit phosphors, or a stream of bytes. none of which can you use in your program as a string.
sprintf being a notable exception of course. there you do get a string out of it.
Update: language is weird and the more I read my statement the weirder it gets, all I can do is add this cryptic note. "When you print a string it does not produce a string", this usually means I am wrong about something.
Double quotes are a syntax sugar for string literals in source code, in a particular language, to avoid writing `string.from_byte_array([97, 98, 99])` or `new String({97, 98, 99});` or whatever. Strings are single quoted not double quoted in Dyalog APL, there's several different strings in SWI Prolog depending on using double quotes or backticks and how the flags are set.
stdout is an untyped byte stream which could go to a printer or Braille terminal or anything as you say, but could be terminal control codes, image data, or whatever. The OS doesn't tend to have a 'string type' ... but in PowerShell `write-output "a"` will write a .NET System.String to the output stream, but it won't use "printf()".
Your statement makes no sense in the context you're answering to.
Lectures that came straight from the book I could have read, recitations and problem reviews done by grad students, and tests that were little more than variations on homework problems of varying difficulty.
Maybe they were getting paid for research, but I dunno. At the liberal arts college, I actually received an education instead of bootstrapping it myself from a syllabus.
After midterm, during every other lecture at least, the professor would sound a refrain: “An orbital is not a house! An electron does not live in a house!”
Final exam had a small number of complex problems to work out with pen and paper, tough stuff, lots of calculus. But the last question ended with “where does the electron live?”
That final problem, if you ignored the end wording, was super easy, something almost trivial to do with Helium iirc. The class had about 25 students in it; about 5 of us independently had the same thought: “this is a trick question, ‘the orbital is not a house in which the electron lives!’” And, independently, that’s how we five answered.
And we got marked wrong, all our course grades dropped to B+/- because of that one damn question.
Over a lunch or whatever, we discovered our shared experience and approached the professor as a group. He listened patiently and said: “Ah, right, I did insist on that idea, it’s understandable why you would think it’s a trick question and answer that way. But I still consider your answers wrong, grades stay as they are.” Some in the group even went to the dean and, to my understanding, he said it’s best to consider it a life lesson and move on.