Question
Question 1 (1 point) If the capacity of a vector named names is 20 and the size of names is 19, which of the following
Question 1 (1 point)
If the capacity of a vector named names is 20 and the size of names is 19, which of the following statements are legal?
Question 1 options:
names.push_back('myName'); | |
names[18]='myNmae'; | |
all of the above | |
none of the above |
Save
Question 2 (1 point)
Which of the following would correctly read an entire line from an input file stream named fin into a string variable named line.
Question 2 options:
getline(fin, line); | |
fin.getline(line); | |
fin.getline(line,' \'); | |
fin.getline(line,80); |
Save
Question 3 (1 point)
strcmp(first, second) returns
Question 3 options:
| |
true if first=second, false otherwise | |
nothing, it's a void function | |
>0 if first second, |
Save
Question 4 (1 point)
A character array terminated with the null character is most correctly called
Question 4 options:
a c-string | |
a character array | |
a string | |
none of the above |
Save
Question 5 (1 point)
If the name of a file to open is in the string variable name fileName, which of the following will correctly open the file for output?
Question 5 options:
out_file.open(fileName); | |
out_file.open('fileName'); | |
fileName.open(outfile); | |
out_file.open(fileName.c_str()); |
Save
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started