100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached 4.6 TrustPilot
logo-home
Exam (elaborations)

CPP Advanced Programming in C++ Cisco Chapter 2 Assessment

Rating
-
Sold
-
Pages
29
Grade
A+
Uploaded on
02-09-2022
Written in
2021/2022

CPP Advanced Programming in C++ Cisco Chapter 2 Assessment

Institution
Course

Content preview

[CPP] Chapter 2 Assessment
 Due No due date




 Points 28




 Questions 28




 Time Limit 40 Minutes




 Allowed Attempts 2


Instructions
Welcome to chapter 2 assessment
This test will help you evaluate what you have learned in chapter 2. You will have 40 minutes to
answer 28 questions. You will not be able to see the correct answers. If you are not satisfied with
your result, you can re-take the test once. Good luck!

Attempt History
Attempt Time Score

KEPT Attempt 2 14 minutes 25 out of 28

, Attempt Time Score

LATEST Attempt 2 14 minutes 25 out of 28

Attempt 1 34 minutes 23.5 out of 28
Correct answers are hidden.
Score for this attempt: 25 out of 28
Submitted Dec 22 at 1:11pm
This attempt took 14 minutes.

Question 1
pts
What happens when you attempt to compile and run the following code? Choose all that apply.

#include <iostream>
#include <set>
#include <vector>
#include <functional>
using namespace std;

int main(){
int mynumbers[] = { 3, 9, 0, 2, 1, 4, 5 };
vector<int> v(mynumbers, mynumbers+7);
set<int> set1(v.begin(),v.end());
set<int, greater<int> > set2(v.begin(), v.end()); //LINE I
for(set<int, int>::iterator i=set2.begin();i!= set2.end(); i++)
cout<<*i<<" ";
for(set<int>::iterator i=set1.begin();i!= set1.end(); i++)
cout<<*i<<", ";
cout<<endl;
return 0;
}




program outputs: 9 5 4 3 2 1 0 0, 1, 2, 3, 4, 5, 9,



program outputs: 0 0 1 2 3 4 5 9, 1, 2, 3, 4, 5, 9,



compilation fails due to error in line I



code compiles and executes successfully

, program outputs: 9 5 4 3 2 1 0, 1, 2, 3, 4, 5, 9,



IncorrectQuestion 2
pts
What happens when you attempt to compile and run the following code? Choose all that apply.

#include <iostream>
#include <set>
#include <vector>
using namespace std;
int main(){
int mynumbers[] = { 3, 9, 0, 2, 1, 4, 5 };
vector<int> v(mynumbers, mynumbers+7);
set<int> s1(v.begin(),v.end());
s1.insert(v.begin(),v.end());
s1.insert(10);
s1.erase(s1.lower_bound(4),s1.upper_bound(6));
s1.insert(v.begin(),v.end());
for(set<int>::iterator i=s1.begin();i!= s1.end(); i++)
cout<<*i<<", ";
return 0;
}




the size of the s1 set is 7



program outputs: 0, 1, 2, 3, 4, 5, 9,



program outputs: 0, 1, 2, 3, 4, 5, 9, 10,



the size of the s1 set is 8



program outputs: 0, 1, 2, 3, 4, 5, 10,

Written for

Course

Document information

Uploaded on
September 2, 2022
Number of pages
29
Written in
2021/2022
Type
Exam (elaborations)
Contains
Questions & answers

Subjects

$5.49
Get access to the full document:

100% satisfaction guarantee
Immediately available after payment
Both online and in PDF
No strings attached

Get to know the seller
Seller avatar
arviemontemayor

Also available in package deal

Get to know the seller

Seller avatar
arviemontemayor AMACC
Follow You need to be logged in order to follow users or courses
Sold
-
Member since
3 year
Number of followers
0
Documents
39
Last sold
-

0.0

0 reviews

5
0
4
0
3
0
2
0
1
0

Trending documents

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Frequently asked questions