Exam 8: Strings and Vectors

arrow
  • Select Tags
search iconSearch Question
  • Select Tags

Using the resize member function alone, you can increase the capacity of an STL vector.

Free
(True/False)
4.8/5
(35)
Correct Answer:
Verified

True

If a vector named numbers has 20 elements in it, what is the result of executing the following statement? Numbers.resize10);

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

C

Vectors can have any type as the base type

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

True

What is the c-string function to determine the number of characters in a c-string?

(Short Answer)
4.9/5
(43)

You can explicitly use the vector member function resize to increase the capacity of a vector.

(True/False)
4.9/5
(42)

Which of the following would correctly read an entire line from an input file stream named fin into a string variable named line.

(Multiple Choice)
4.8/5
(34)

Using the [i] on a string variable does not check for illegal values of i.

(True/False)
4.8/5
(36)

What is the difference between strcmp and strncmp?

(Multiple Choice)
4.8/5
(35)

A character array terminated with the null character is most correctly called

(Multiple Choice)
4.8/5
(36)

What is the value of numbers.size) after the following code? Vector<float> numbers;

(Multiple Choice)
4.8/5
(41)

What is the code to print out the third character in a string variable named str?

(Short Answer)
4.8/5
(41)

How do you call the function to read a whole line of inputup to 80 characters) from the keyboard into a c-string named str?

(Short Answer)
4.9/5
(34)

Which of the following are correct statements about vector member functions studied in this chapter?

(Multiple Choice)
4.7/5
(30)

If v is a vector and i is an int variable, then in the following the value of i can be any nonnegative int value: v[i] = i;

(True/False)
4.8/5
(44)

To change the space already allocated for a vector, one uses the ______________ member function.

(Short Answer)
4.8/5
(41)

To convert an integer to a variable of type string one can use the C++11 function _____________.

(Short Answer)
4.9/5
(45)

What is the name of the function to convert from a c-string that contains only digits to an integer?

(Short Answer)
4.9/5
(35)

A vector v will automatically increase the allocated size when more than v.size ) elements are inserted with v.push_back newElement).

(True/False)
4.9/5
(37)

What is the value of numbers.size) after the following code? Vector<float> numbers; Numbers.reserve100)

(Multiple Choice)
4.8/5
(38)

Vector assignment is well behaved.

(True/False)
4.8/5
(39)
Showing 1 - 20 of 69
close modal

Filters

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