CPP practice question 20 of 30

What happens when you attempt to compile and run the following code? #include #include #include #include using namespace std; bool identical(int a…

Choose your answer, then check it against the explanation.

What happens when you attempt to compile and run the following code? #include #include #include #include using namespace std; bool identical(int a, int b) { return b == 2*a?true:false; } int main() { int t[] = {1,2,3,2,3,5,1,2,7,3,2,1,10, 4,4,5}; int u[] = {2,4,6,4,6,10,2,4,14,6,4,2,20,8,8,5}; vector v1(t, t + 15); deque d1(u, u + 15); pair<deque::iterator, vector::iterator > result; result = mismatch(d1.begin(), d1.end(), v1.begin(), identical); //Line I if (result.first == d1.end() && result.second == v1.end()) {//Line II cout<<"Identical\n"; } else { cout<<"Not identical\n"; } return 0; } Program outputs:
Answer options
Question 20 of 30

Keep practicing

Take the free CPP practice test

Ten exam-style questions with answers and explanations, plus the exam facts and study guides.

Start the free practice test

More questions

Other CPP practice questions

Scroll to Top