CS3376 Strings
The null terminator stands for this ASCII code.
0
After the following statement executes, what value is stored in the variable num? num = atoi("1000");
1000
The C-string company[12] can hold
11 characters and the null terminator
To use the strlen function in a program, you must also write #include ___
<cstring>
This is the escape sequence representing the null terminator.
\0
The expression being tested by if (!isdigit(var1)) will evaluate to true if var1 is:
an alphabetic character or a symbol such as & or $
This function accepts a C-string containing a number as its argument and returns the integer equivalent.
atoi
This function converts a C-string to an integer and returns the integer value.
atoi
This statement converts the string "10" to the integer value 10.
atoi("10")
This function accepts a C-string as an argument and converts the string to a long integer.
atol
Which of the following lines of code defines an array of C-strings that will hold 49 characters and the null terminator?
char str[50];
To determine whether a character entered is a letter of the alphabet, use this function.
isalpha
To test whether a character is a numeric digit character, use this function.
isdigit
To test whether a character is a printable character, use this function.
isprint
What is the output of cout << tolower(toupper('Z')) << endl; ?
lowercase Z
This library function reverses the order of a C-string.
none of the above
This function concatenates the contents of one C-string with another C-string.
strcat
This function accepts a pointer to a C-string as an argument, and it returns the length of the C-string (not including the null terminator).
strlen
This function accepts pointers to two C-strings and an integer argument, which indicates how many characters to copy from the second C-string to the first.
strncpy
A library function that can find one C- string inside another is:
strstr
"Whitespace" encompasses which of the following?
tab, newline, space
In C++, a C-string is a sequence of characters stored in consecutive memory, terminated by
the null character
To change a character argument from lower to upper case, use this function.
toupper
To change a lower case character to an upper case character, use this function.
toupper
A practical application of this function is to allow a user to enter a response of 'y' or 'Y' to a prompt.
toupper or tolower
The strcpy function's arguments are:
two addresses
The statement char var1 = tolower('A'); will result in:
var1 storing the ASCII value for lower case 'a'.