Chp 10

Ace your homework & exams now with Quizwiz!

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>

True/False: Although C++ provides ample library functions to handle numeric values, we must write all of our own functions to manipulate character values.

F

This library function reverses the order of a C-string.

None

True/False: If a C-string that cannot be converted to a numeric value is passed to the atoi function, the function's behavior is undefined by C++.

T

True/False: The C++ library provides functions for converting a string representation of a number to a numeric data type, and vice-versa.

T

True/False: When using the strcat function, you must be careful not to overwrite the bounds of an array.

T

True/False: You may use the <, >, <=, >=, ==, and != relational operators to compare string objects.

T

Look at the following statement. if (!isdigit(var1)) The expression being tested by this statement will evaluate to true if var1 is:

a symbol such as $ or & an alphabetic character

Which 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

The C-string company[12] can hold ________.

eleven characters and the null terminator

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

This function will return true if its argument is a printable character other than a digit, letter, or space.

ispunct

To determine whether a character is whitespace, use this function.

isspace

What is the output of the following statement? cout << tolower(toupper('Z')) << endl;

lower case z

In C++, a C-string is a sequence of characters stored in consecutive memory, terminated by a ________.

null character

"Whitespace" encompasses which of the following?

space

This function concatenates the contents of one C-string with another C-string.

strcat

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

To change a lower case character to an upper case character, use this function.

toupper

The statement: char var1 = tolower('A'); will result in:

var1 storing the ASCII value for lower case 'a'.


Related study sets

CS253 Midterm 2 set, CS 253 Midterm the Ultimate Quizlet 1.1

View Set

write alternative terms for each of the following integumentary system

View Set

Life Insurance Policies 8% 12 questions

View Set

Chapter 8 - Inventory Management

View Set

FIS 100 - Chapters 6 to 10 - REVIEW QUESTIONS FOR FiNALS

View Set