Question
Please help this is for C++ this is my last question I have until my month renews I need this the class ends today. Thank
Please help this is for C++ this is my last question I have until my month renews I need this the class ends today. Thank you so much.
How many recursive calls are made to the function NumSeries()?
1)
#includeusing namespace std; int NumSeries(int num) { if (num == 1) cout << num << " "; else { NumSeries(num / 2); cout << num << " "; } } int main() { NumSeries(5); return 0; }
Group of answer choices
2
3
4
5
2)
What will FindNumber(2,3) return?
int FindNumber(int x, int y) { if (y == 1){ return 0; } else { return x + FindNumber(x, y - 1); } }
Group of answer choices
2
4
5
6
3)
Which statement uses buffer manipulators to immediately display the following on the screen? Good morning
Group of answer choices
cout << "Good morning";
cout <<"Good" << endl << "morning";
cout << "Good morning ";
cout << "Good" << endl << "morning" << flush;
4)
The following code generates an error. Why?
#include#include using namespace std; int main() { ofstreamoutFS; if (!outFS.is_open()) { cout << "Could not open file myfile.txt." << endl; return 1; } outFS << "Hello" << endl; outFS << "1 2 3" << endl; outFS.close(); return 0; }
Group of answer choices
outFS.close(); is not used correctly
The file 'myfile.txt' has not been opened
The code is missing a header
Data cannot be directly fed into ofstream using outFS <<
5)
Which line in the below code causes an error?
#include#include using namespace std; int main() { vector idNums(5); idNums.at(1) = 60; idNums.at(2) = 70; idNums.at(3) = 82; idNums.at(4) = 90; idNums.at(5) = 92; cout << "Size: " << idNums.size() << endl; idNums.push_back(2); cout << "New size: " << idNums.size() << endl; return 0; }
Group of answer choices
cout << "Size: " << idNums.size() << endl;
cout << "New size: " << idNums.size() << endl;
return 0;
idNums.at(5) = 92;
6)
Which XXX statement correctly assigns the data member runTime with the value of the argument t?
#includeusing namespace std; class Duration { private: int runTime; public: void setTime (int t) { XXX } void print() { cout << "x = " << runTime << endl; } }; int main() { Duration set1; int t = 11; set1.setTime(t); set1.print(); return 0; }
Group of answer choices
this->runTime = t;
this->t = runTime;
runTime-> t;
this.runTime = t;
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