C++ Question
1:Consider using bubble sort to process the following list of numbers into ascending order
(smallest to largest), where we make passes from the right (the end) back to the left
(beginning):
5 4 1 2 3
What would be the order of the numbers after making only the two passes through the list?
2:create a general-purpose Date class:
Date( int theMonth = 3, int theDay = 11, int theYear = 2022) { month = theMonth; day = theDay; year = theYear; }
how many different ways can we call the constructor How many [ 0 . . 5 ] of the options below would compile and run and call the constructor above?
I. Date aDate();
II. Date aDate = {5, 3, 2022};
III. Date aDate(5, 3, 2022);
IV. Date aDate(5);
V. Date aDate(5, 3);
3:Which of the following options is not an advantage an array has over a linked list? a) It uses less memory
b) Accessing an array entry is typically faster than accessing a list element
c) An element can be inserted in the middle without having to shift other elements
d) We can use memory arithmetic to jump to a particular part
4:Assume you have a Node class and pHead is a pointer to the head of the following list of Nodes:
class Node { public: int data; Node *pNext; };
11 9 7 5 3 1
What is the output from the statement? cout << pHead->pNext->pNext->pNext->data;
5:hat advantage does a linked list have over an array?
a) Linked lists take up less space in memory
b) We typically know the size of a linked list when the program is compiled
c) Traversing a linked list to find a value in a node is faster than finding a value in an array
d) It takes less computation time to insert a new node in the middle of a linked list than it does to insert a new value into the middle of an array.
6. Consider implementing a doubly linked list, such as the one below. Which two options below would be a benefit for such a list? For example, if you think the answer is E and F, put E and F.
look at the attached picture.
a) It is easier to traverse the list forwards and backwards
b) When removing a node, you only have to modify one of its pointers
c) You do not have to use recursion to reverse the list
d) When inserting a new node only pHead needs to be updated
Collepals.com Plagiarism Free Papers
Are you looking for custom essay writing service or even dissertation writing services? Just request for our write my paper service, and we'll match you with the best essay writer in your subject! With an exceptional team of professional academic experts in a wide range of subjects, we can guarantee you an unrivaled quality of custom-written papers.
Get ZERO PLAGIARISM, HUMAN WRITTEN ESSAYS
Why Hire Collepals.com writers to do your paper?
Quality- We are experienced and have access to ample research materials.
We write plagiarism Free Content
Confidential- We never share or sell your personal information to third parties.
Support-Chat with us today! We are always waiting to answer all your questions.
