100% tevredenheidsgarantie Direct beschikbaar na je betaling Online lezen of als PDF Geen vaste maandelijkse kosten 4,6 TrustPilot
logo-home
Tentamen (uitwerkingen)

CPP Advanced Programming in C++ Cisco Chapter 2 Assessment

Beoordeling
-
Verkocht
-
Pagina's
29
Cijfer
A+
Geüpload op
02-09-2022
Geschreven in
2021/2022

CPP Advanced Programming in C++ Cisco Chapter 2 Assessment

Instelling
Vak

Voorbeeld van de inhoud

[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,

Geschreven voor

Vak

Documentinformatie

Geüpload op
2 september 2022
Aantal pagina's
29
Geschreven in
2021/2022
Type
Tentamen (uitwerkingen)
Bevat
Vragen en antwoorden

Onderwerpen

$5.49
Krijg toegang tot het volledige document:

100% tevredenheidsgarantie
Direct beschikbaar na je betaling
Online lezen of als PDF
Geen vaste maandelijkse kosten

Maak kennis met de verkoper
Seller avatar
arviemontemayor

Ook beschikbaar in voordeelbundel

Maak kennis met de verkoper

Seller avatar
arviemontemayor AMACC
Volgen Je moet ingelogd zijn om studenten of vakken te kunnen volgen
Verkocht
-
Lid sinds
3 jaar
Aantal volgers
0
Documenten
39
Laatst verkocht
-

0.0

0 beoordelingen

5
0
4
0
3
0
2
0
1
0

Populaire documenten

Recent door jou bekeken

Waarom studenten kiezen voor Stuvia

Gemaakt door medestudenten, geverifieerd door reviews

Kwaliteit die je kunt vertrouwen: geschreven door studenten die slaagden en beoordeeld door anderen die dit document gebruikten.

Niet tevreden? Kies een ander document

Geen zorgen! Je kunt voor hetzelfde geld direct een ander document kiezen dat beter past bij wat je zoekt.

Betaal zoals je wilt, start meteen met leren

Geen abonnement, geen verplichtingen. Betaal zoals je gewend bent via Bancontact, iDeal of creditcard en download je PDF-document meteen.

Student with book image

“Gekocht, gedownload en geslaagd. Zo eenvoudig kan het zijn.”

Alisha Student

Veelgestelde vragen