M Chapter 10

Lakukan tugas rumah & ujian kamu dengan baik sekarang menggunakan Quizwiz!

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

To use the strlen function in a program, you must also write #include ________.

<cstring>

A practical application of this function is to allow a user to enter a response of 'y' or 'Y' to a prompt. toupper tolower A or B ignorecase

A or B

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

False

True/False: The ftoa function converts a floating-point value to an ASCII value

False

This library function reverses the order of a C-string. backward reversit strrev reverstr None of these

None of these

True/False: C++ 11 introduces a function named to_string that converts a numeric value to a string object.

True

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++.

True

True/False: If an uppercase character is passed as an argument to toupper, the result will be an uppercase character.

True

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

True

True/False: The isdigit function will return a true if its argument is a digit between 0 and 9.

True

True/False: The itoa function is similar to atoi, but it works in reverse

True

True/False: The string class's front and back member functions were introduced in C++ 11.

True

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

True

This is the escape sequence representing the null terminator

\0

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

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

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 & 9 an alphabetic character both A and C Correct! None of these

both A and C

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];

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

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

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

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

A library function that can find one C- string inside another is:

strstr

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

to change a character argument from lower to upper case, use this function.

toupper

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'.


Set pelajaran terkait

Lab 3 Cnidaria and Ctenophora - EVERYTHING

View Set

Macroeconomics Final Study guide

View Set

Surge Tech Chapter 3 Test review

View Set

LA Commercial Insurance Test Practice

View Set

Accounting Chapter 1 Pearson MyLab

View Set