PLEASE ANSWER THE 3 QUESTIONS CORRECTLY 1) Consider this prototype for a templat
ID: 3581215 • Letter: P
Question
PLEASE ANSWER THE 3 QUESTIONS CORRECTLY
1) Consider this prototype for a template function:
template <class Item>
void foo(Item x);
Which is the right way to call the foo function with an integer argument named i?
A) int i = 5;
foo( i );
B) foo<Item>( i );
C) foo(<int> i );
D) int i = 5;
foo<int>( i );
2) The std::binary_search function will test if a value exists in sorted sequence. It returns true if any element in the range [first,last] is equivalent to that value, and false otherwise.
A) True
B) False
3) Consider the following graph:
In what order are the vertices visited for a depth-first search that starts at v0?
A) 0, 4, 1, 6
B) 0, 1, 3, 6, 5, 4
C) 0, 1, 3, 5, 6, 4, 2
D) 0, 2, 1, 3, 5, 6
Explanation / Answer
Answer :
1) Consider this prototype for a template function:
template <class Item>
void foo(Item x);
Which is the right way to call the foo function with an integer argument named i?
A) int i = 5;
foo( i );
B) foo<Item>( i );
C) foo(<int> i );
D) int i = 5;
foo<int>( i );
Answer :
A) int i = 5;
foo( i );
Explanation :
foo(i); is the right way to call the foo function with an integer argument named i.
..............
2) The std::binary_search function will test if a value exists in sorted sequence. It returns true if any element in the range [first,last] is equivalent to that value, and false otherwise.
A) True
B) False
Answer :
A) True
................
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.