Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

Genomes And Databases On The Internet A Practical Guide To Functions And Applications

Authors: Paul Rangel

1st Edition

189848631X, 978-1898486312

More Books

Students also viewed these Databases questions

Question

What is a digital wildfire?

Answered: 1 week ago

Question

friendliness and sincerity;

Answered: 1 week ago