Chapter 10 - C++

Ace your homework & exams now with 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>

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

A) a symbol such as $ or & C) an alphabetic character Correct Response D) both A and C

"Whitespace" encompasses which of the following?

A) tab B) space C) newline D) All of these

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

A) tolower B) toupper D) A or B

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

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

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

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

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 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 C-string.

strcat

This function accepts a pointer to a string as an argument, and it returns the length of the string (not including the null terminator).

strlen

This function accepts pointers to two strings and an integer argument, which indicates how many characters to copy from the second string to the first.

strncpy

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

strstr

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

toupper

To change a lower case character to an upper case character, 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'


Related study sets

Life policy Provisions, Riders and Options

View Set

6th Grade Language Arts 2nd Semester

View Set

NSCI 175: Brain Rhythms and Sleep

View Set

1.2 Levels of Structural Organization and Body Systems

View Set

Chapter 5 Legal and Ethical Issues

View Set

Chapter 2 Intro to Forensics (Crime scene investigation)

View Set

REAL 2.2.3: Seller's Agents Responsibilities and Negotiation Strategies

View Set

Securities Industries Essentials Exam (SIE)

View Set