Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

11. Suppose that fis a function with a prototype like this: void f If Precondition: head ptr is a head pointer for a linked list.

image text in transcribed
11. Suppose that fis a function with a prototype like this: void f If Precondition: head ptr is a head pointer for a linked list. I Postcondition: The function fhas done some manipulation of / the linked list, and the list might now have a new head node. head ptr): What is the best data type for head ptr in this function? 3 points) A. node B. node& C. node* D. node 12. Suppose that the bag class is efficiently implemented with a fixed array with a capacity of 4000, as in Chapter 3 of the class text. Choose the best description of b's member variables after we execute these statements: (3 points) bag bi b.insert (5) b.insert (4) b.insert (6) What will be the values of b.used and b.data after the statements? A. b.used is 3, b.data[0] is 4, b.data I1] is 5, and b.data[2] is 6 B. b.used is 3, b.data [0) is 5, b.data [1] is 4, and b.data [2] is 6 C. b.used is 3, b.data [0] is 6, b.data [1] is 4, and b.data [2) is 5 D. b.used is 3, b.data (01] is 6, b.data[1] is 5, and b.data [2] is 4 13. Which situation does not use the copy constructor? (3 points) A. Calling a function with a reference parameter B. Calling a function with a value parameter C. Declaring a variable to be a copy of another existing object D. Returning a value from a function E. All of the above situations use the copy constructor 14. Suppose that foo is a new class and you want to declare an array of 10 foo objects. Which constructor will be used to initialize the 10 foo components of the array? 3 points) A. Only the copy constructor can be used. B. Only the default constructor can be used C. Any constructor can be used

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Spatial Databases A Tour

Authors: Shashi Shekhar, Sanjay Chawla

1st Edition

0130174807, 978-0130174802

More Books

Students also viewed these Databases questions