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

c++ 1. Write a function named getColumnSum() that takes 1) a column index and 2)

ID: 3830245 • Letter: C

Question

 c++  1. Write a function named getColumnSum() that takes 1) a column index and 2) a two-dimensional array with 10 rows and 15 columns and returns the sum of the elements in the specified column.  2. What is the difference (if any) between the following? #include <filename> #include "filename"  3. Which methods in a class are automatically generated by the compiler if not specified and when is this acceptable?  4. What code (client code, class members, friends, main(), etc.) can access a private data member?  5. What code (client code, class members, friends, main(), etc.) can call a private method?  6. Members of a class are public by default. A) True B) False   7. Given the following definition: struct MyCollection{         int num1;         float num2;         double num3; };  write code that declares an array of 100 elements of MyCollection and prints out the num2 value of the 3rd element.  7. What is the effect of const when it precedes the declaration of an array in a function heading?  8. Abstraction focuses on _________.  9. What does abstraction NOT specify?  10. If an item is not in an unsorted list, when will that be discovered? A) Before iterating over the list B) On average, half way through the list C) After iterating through the entire list  11. What is the worst-case Big-O for insertion for a (unsorted) linked list (for n inputs)?  12. What is the worst-case Big-O for searching for an array-based sorted list (for n inputs)?  13. What is the worst-case Big-O for searching for a (unsorted) linked list (for n inputs)?  14. Given the following array of numbers:         Index   Value         0       21         1       32         2       38         3       48         4       49         5       59         6       60         7       63         8       88         9       90         10      94  and using binary search to look for the value 55, what is the index in the highlighted position?         Iter 1  2       3       4       5         ------- ------- ------- ------- ------- first    middle          ??????? last       15. Given the following code, what is on the stack and what is on the heap (if anything)? int main(){     int* ptr = new int;     ... }  16. What is the benefit of using a dummy (sentinel) head node?  17. Write code that dynamically allocates and deallocates an array of 100 doubles.  18. What is the benefit of using a doubly-linked list? A) It aligns the data structure with the object that it represents  19. Write code that demonstrates a memory leak.  20. Write code that demonstrates a dangling pointer.  21. Write the declaration for a copy constructor for a class "AwesomeClass".  22. List all of the times that a destructor is called. 

Explanation / Answer

6. Members of a class are public by default.

False, because by default in C++ members of class are private.

8. Abstraction focuses on elemnets or objects istead of irrelevent data.

14. Index of first =4,middle = 4,last=4

18. What is the benefit of using a doubly-linked list?

The main advantage of doubly linked list is we can traverse in any direction, forward or reverse and also delete a node with little worry, since we have pointers to the previous and next nodes.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote