I was having trouble with the built-in example sketch ASCIITable (on an Arduino UNO R4 WiFi, no electronics connected other than the USB cable to a PC; Boards Package v. 1.4.1; sketch was compiled and uploaded using Arduino IDE v. 2.3.4), when after quite a bit of time wasted on troubleshooting, I finally came across this helpful thread, which made it clear that on the R4 WiFi (and presumably also on other boards without native USB), there is no available method for ensuring that the USB connection is established before using Serial methods.
This explains why the ASCII table does not start at ! (=33), and why the first line printed in the Serial Monitor contains gibberish instead of the expected table title (ASCII Table ~ Character Map):
As these example sketches are intended for neophytes who are trying to learn Arduino programming, it would be sensible to include some documentation (within the sketch itself, and certainly in the official documentation for this sketch) to warn users that the sketch will not actually work as advertised if using an Arduino UNO R4 (or similar) board that does not have native USB support.
There are several other sketches (even under the category "Examples for Arduino UNO R4 WiFi") that will fail in similar ways, for the same reasons.
If you press the reset switch, you will see all the output. Also, add a delay after the serial. begin, or do a wait for keypress with a msg of course. I am off to bed but will drag out the R4 and give it a try tomorrow to see what's up.
FYI: It does not matter if the serial monitor was open during the upload or not. Closing and opening the serial monitor a second time gets rid of the rubbish.
I had assumed that the Arduino project as a whole was an educational project for making microcontrollers and electronics accessible to a wide base of individuals (who may have interest in these topics, but have a great variety in background experience and learning styles). And in particular, my post here was based on the assumptions that the built-in tutorials were intended to help users learn the basics, not to thwart them.
So the Arduino project is actually just a screening tool for employers, allowing them to test prospective job candidates' problem solving abilities by publishing tutorials that intentionally don't work? Crafty!
The final disposition of the ticket that I opened for this issue is that the behavior observed is related to a known bug that Arduino devs are "actively working to resolve".
The suggested work-arounds are to introduce a 1–2 second delay, or to press the Reset button.
The documentation for the ASCIITable example sketch has unfortunately not (yet) been revised, even though an earlier communication from the Support Team implied that this would be done ("I will escalate this to the content team so they can review the Arduino Docs and update the ASCIITable example by adding a warning regarding the UNO R4 WiFi...").