Home » C++ Programming » Questions and Answers » Question
  1. What is the output of this program?
    #include <iostream>
    #include <algorithm>
    #include <vector>
    #include <utility>
    using namespace std;
    bool mypredicate (int k, int L)
    {
    return (k == L);
    }
    int main ()
    {
    vector<int> num;
    for (int k = 1; k < 6; k++)
    num.push_back (k * 101);
    int Array[] = {101, 202, 303, 404, 2022};
    pair<vector<int> :: iterator, int*> Pair;
    Pair = mismatch (num.begin(), num.end(), Array);
    cout << *Pair.first<<'\n';
    cout << *Pair.second << '\n';
    ++Pair.first; ++Pair.second;
    return 0;
    }
    1. 505
      2022
    2. 101
      202
    3. 404
      303
    4. 2022
      505
    5. None of these
Correct Option: A

In this program, We are finding the elements which are mismatching in both the variables.



Your comments will be displayed only after manual approval.