Exam 12: More on C-Strings and the String Class

arrow
  • Select Tags
search iconSearch Question
flashcardsStudy Flashcards
  • Select Tags

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

Free
(True/False)
4.9/5
(37)
Correct Answer:
Verified

False

To access the last character of a string class object str you can use the expression

Free
(Multiple Choice)
4.8/5
(34)
Correct Answer:
Verified

D

To declare a C- string, you should use the type expression string *.

Free
(True/False)
4.7/5
(40)
Correct Answer:
Verified

False

The function accepts a C- string as an argument and returns the length of the string (not including the null terminator).

(Multiple Choice)
4.9/5
(41)

To declare an array that will store students' last names of up to 25 characters in length, which is an appropriate statement?

(Multiple Choice)
4.8/5
(43)

A good way to convert a string such a "572" to an equivalent integer such as 572

(Multiple Choice)
4.7/5
(45)

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

(Multiple Choice)
4.8/5
(35)

The string class member function returns the C- string value of the string object.

(Multiple Choice)
4.7/5
(40)

The library function reverses the order of a character array.

(Multiple Choice)
4.8/5
(32)

The proper expression to compare the first characters of two string objects str1 and str2 is

(Multiple Choice)
4.8/5
(36)

A C- string can be assigned to an variable whose type is the string class.

(True/False)
5.0/5
(31)

The string class overloads the += operator to perform

(Multiple Choice)
4.9/5
(44)

By being able to pass arrays as arguments, you can write your own functions for processing C- strings.

(True/False)
4.8/5
(28)

A C- string is a sequence of characters stored in consecutive memory, terminated by a

(Multiple Choice)
4.7/5
(37)

The strcpy function's arguments are

(Multiple Choice)
4.8/5
(34)

To use the ostringstream class, you must include the memstringstream header file.

(True/False)
4.9/5
(40)

A library function that looks for the occurrence of one string inside another is

(Multiple Choice)
4.8/5
(46)

It is possible to implement a string class by using a dynamically allocated array of characters.

(True/False)
4.8/5
(32)

When using the strcatfunction, you must be careful not to overflow the bounds of the array allocated for the target string.

(True/False)
4.8/5
(33)

Assume that str1 and str2 are variables of type C- string. The proper expression to use when comparing them for equality is

(Multiple Choice)
4.9/5
(40)
Showing 1 - 20 of 38
close modal

Filters

  • Essay(0)
  • Multiple Choice(0)
  • Short Answer(0)
  • True False(0)
  • Matching(0)