Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Q8: Vectors can be accessed like arrays using the D operation because: a. b. c.

ID: 3606202 • Letter: Q

Question

Q8: Vectors can be accessed like arrays using the D operation because: a. b. c. d. Class Vector inherit the class array They are both essentially the same data structure They both are able to have default arguments. Because the class vector overloads the Doperator to return the value at the requested index Q9: When a vector is implemented using an array: a. b. c. We cannot expand the size of the vector. We can only use it to store integers. Never possible. d. A new array of larger size needs to be created in order to dynamically change the size of the vector. Q10: An iterator is implemented for some containers in C++ to: a. b. c. d. Allow client class to access private variables of the container directly To change the address where data is stored in the container To query the size of the container To access individual elements of the container and to navigate through the container Q11: STL List and Vector provide return the Iterator placed at the first element in the container by using the: a. Head pointer b. Iterator) function c. Start() function d. begin) function 012: The Sequence container can be used as both an array and a List because a. b. c. d. It inherits the List class. It contains an array It always keeps its data sorted It provides functions that allow access to elements both by position and by index Q13: Each pass in a bubble sort algorithm: a. Places the largest element in a separate sequence b. Splits the sequence in two equal parts c. Places the median element in the middle d. Moves the largest element in its correct position in the sequence Q14: A general tree can have: a. More than one roots. b. Nodes that have two parents. c. External nodes that have children d. Nodes with any number of children. Q15: The depth of the root in a general tree is: a· the number of leaves on the tree b. list of all the root's children c. the number of descendants it has d. zero

Explanation / Answer

Q8 b. They are both essentially the same data structure

Q9 d. A new array of larger size needs to be created in order to dynamically change the size of the vector.

Q10 d. to access individual elements of the container and to navigate through the container.

Q11 d. begin() function

Q12 d. It provides functions that allow access to elements both by position and by index

Q13 d Moves the largest element in its correct position in the sequence

Q14 d Nodes with any number of children

Q15 c the number of descendents it has