C++ Questions. Passing a vector to a function is by-value unless you use an & af
ID: 3860208 • Letter: C
Question
C++ Questions.
Passing a vector to a function is by-value unless you use an & after the element type (like so: vector &). Given a vector declared as vector vec', answer each of the following: i) the vector contains ___ elements (how many? be exact!) ii) valid positions in the vector are in the range [__) iii) vec [5] represents the 5th element iv) vec represents the entire vector v) vec. front() represents the entire vector vi) the data type of vec[4] is ___ vii) the data type of the 4 used in subscript of #vi) is ___ viii) the data type of vec is ___ How does selection sort attempt to improve on bubble sort? They are both n^2 algorithms, what benefit might selection sort achieve? I can print any container by simply placing the container's name in a cout statement like this: coutExplanation / Answer
1) TRUE-The pass by refernce is done only by using &
2)
i)infinite elements
ii)vec(first_element,past_last_element)
iii)FALSE
iv)True
v)False vec.front represents only the following function.
vii)int
viii)vector
3)Number of writes by bubble sort will be high when compared to the number of writes as selection sort .
4)True - the container cannot be printed by thegiving them in the cout statement
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.