In C, how do we indicate - in an expression - that we which to use the integer code associated with a given character?
By preceding the character with a backslash.
By surrounding the character in single quotes.
By surrounding the character with double quotes.
By simply using the character - nothing else is needed.
What are "escape sequences"?
A means of exiting a function or program by other than the normal means - for instance, if a division by zero were detected, this would invoke and escape sequence.
Strings of ASCII characters that begin with ASCII code 27 (dec) - the ESC characters.
Sequences of characters that are interpreted by the display device as special commands.
Ways of indicating characters that either can't be typed directly or that might might be interpreted as something other than a character by the compiler.
How many so-called "alphabetic" escape sequences are there in the C Standard language?
5
6
7
8
Which of the following C expressions will set the value of k equal to the ASCII code of the backslash character?
k = '\';
k = '\/';
k='\\';
k=\;
What affect does the "new line" character have of the display device?
Erases the contents of the next line.
Locates the active position to the beginning of the next line.
Erases the contents of the present line and moves the active position to the beginning of the present line.
Scrolls the text on the display up one line.
A character constant formed by following a backslash with up to three octal digits is known as an "octal escape sequence". What code does such a sequence translate to?
The character that represents the first digit.
The integer represented by the sequence of octal digits.
The control code whose upper byte is the first digits and whose lower byte is given by the second two digits.
The corresponding upper case character.
If the value of k is an integer between 0 and 10, which statement below will print the correct character on the display device?
putc( k, stdout);
putc( 'k', stdout);
putc( 'k+10', stdout);
putc( k + '0', stdout);
Given that k is the ASCII code for a lower case character, which expression will evaluate to the ASCII code of the corresponding upper case character?
k - 'a' + 'A'
k - 'A' + 'a'
'A' - k +'a'
'a' - k + 'A'
Which of the following represents the correct way to check if a character (whose ASCII code is stored in k) is the letter Q or q?
if ( k == 'Q' || 'q' )
if ( ( k == 'Q' ) || ( k == 'q' ) )
if ( k == 'Q' && 'q' )
if ( ( k == 'Q' ) && ( k == 'q' ) )
You ask the user to provide a Y or N response and want to issue a message if they don't enter one of those two characters. Their response is stored in the variable ans. Which of the following statements will accomplish this?
if ( ans != 'Y' || 'N' ) /* Output Message */
if ( ( ans != 'Y' ) || ( ans != 'N' ) ) /* Output Message */
if ( ( ans != 'Y' ) && ( ans != 'N' ) ) /* Output Message */
if ( ( ans == 'Y' ) && ( ans == 'N' ) ) /* Output Message */