Cosc 1437 ch10 (Q3)
After the following statement executes what value is stored in the variable num? num = atoi ("1000");
1000
To use the strlen function in a program, you must also write #include ________.
<cstring>
T/F: Although C++ provides ample library functions to handle numeric values, we must write all of our own functions to manipulate character values.
False
T/F: By being able to pass arrays as arguments, you can write your own functions for processing C-strings.
True
T/F: C++ introduces a function named to_string that converts a numeric value to a string object
True
T/F: The C++ library provides functions for converting a string representation of a number to a numeric data type and vice-versa.
True
T/F: The isdigit function will return a true if it's argument is a digit between 0 and 9
True
T/F: The itoa function is similar to atoi but it works in reverse.
True
You may use the <, >, <=, >=, ==, and != relational operators to compare string objects.
True
To test whether a character is a printable character, use this function.
isprint
This function will return true if its argument is a printable character other than a digit, letter, or space.
ispunct
The null terminator stands for this ASCII code
0
T/F: A test using the isupper function will return false if the argument is an uppercase character.
False
T/F: The C++ compiler performs strict array bounds checking when it encounters an array of characters.
False
This function accepts a C-string containing a number as its argument and returns the integer equivalent.
atoi
To define a C-string that will store students' last names of up to 25 characters in length, which is an appropriate statement?
char lastName[26];
This function concatenates the contents of one c-string with another c-string
strcat
This function accepts a C-string as an argument and converts the string to a long integer.
Atoi
To determine whether a character is white space, use this function
Isspace
What is the output of the following statement cout << tolower(toupper('Z')) << endl;
Lower case z
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];
The C-string company[12] can hold
eleven characters and the null terminator
This library function reverses the order of a C-string.
none of these
A library function that can find one C- string inside another is:
strstr
To change a lower case character to an upper case character use this function
toupper