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)
template
template
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: vectorkeys; ... }
Group of answer choices
template
template
template
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
templateT ThreeD ::get_x() const { return T x;}
templateT ThreeD::get_x() const { return x;}
templateThreeD ::get_x() const { return x;}
templateS 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]; . . . }; Matrixa; 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
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started