Question: 51. What is the proper function header for the function body below which swaps array a[] elements at indicies j and k? //insert header here:

51. What is the proper function header for the function body below which swaps array a[] elements at indicies j and k?

//insert header here: ______________________________ { T temp = a[k]; a[k] = a[j]; a[j] = temp; }

Group of answer choices

template void swap(T a[], int j, int k)

void swap(T a[], int j, int k)

template void swap(T a[], T j, T k)

template void swap(T a[], int j, int k)

52. What is the proper class header for the template below which creates a map-like data structure of keys and values?

//insert header here: ______________________________ { public: MyMap(); MyMap(T key, U val); U get_val(T key) const; void insert(T key, U val); . . . private: vector keys; ... }

Group of answer choices

template class MyMap

template class MyMap

template class MyMap

class MyMap

53. For the following class template, which is the correct get_x () function?

. . . class ThreeD { public: ThreeD(T a, T b, T c); T get_x() const; T get_y() const; T get_z() const; private: T x; T y; T z; };

Group of answer choices

template T ThreeD::get_x() const { return T x;}
template T ThreeD::get_x() const { return x;}
template ThreeD::get_x() const { return x;}
template S ThreeD::get_x() const { return x;}

54. When you define a template for a matrix class of varying data types with varying numbers of rows and columns, what is the missing line from the top of the following?

________//Line missing here ___ class Matrix { Matrix(int ROWS, int COLUMNS); . . . private: T data[ROWS][COLUMNS]; . . . }; Matrix a; Matrix b;

Group of answer choices

template

template

template

template

57. How can you locate the ninth node in a doubly-linked list named items?

Group of answer choices

Start at the first node and follow pointers to the next node in the list until the ninth node is located.

items[8]

items[9]

items[10]

58. What does the following declaration establish?

list::iterator pos;

Group of answer choices

a variable named pos that is a list holding values of type double

a variable named iterator that is a list that can hold values of type double

a variable named pos that marks a position in a list holding values of type double

a variable named pos that is a pointer to values of type double

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!