adplus-dvertising
frame-decoration

Question

What is the output of this program?
    #include <iostream> 
    #include <algorithm>
    using namespace std;
    int main () 
    {
        int myints[] = {10, 20, 30, 30, 20, 10, 10, 20};  
        int* pbegin = myints;                      
        int* pend = myints + sizeof(myints) / sizeof(int);
        pend = remove (pbegin, pend, 20);      
        for (int* p = pbegin; p != pend; ++p)
            cout << ' ' << *p;
        return 0;
    }

a.

10, 20, 30, 30, 20, 10, 10, 20

b.

10, 30, 30, 10, 10

c.

10, 20, 20, 10, 10, 10, 20

d.

None of the mentioned

Answer: (b).10, 30, 30, 10, 10

Engage with the Community - Add Your Comment

Confused About the Answer? Ask for Details Here.

Know the Explanation? Add it Here.

Q. What is the output of this program?

Similar Questions

Discover Related MCQs

Q. What is the type of the first item in the heap?

Q. Pick out the correct library in the following choices.

Q. What kind of iteration does forward_list provide in C++?

Q. What does the size of the vector refers to in c++?

Q. Subsequent elements are moved in terms of _____ when an element in inserted in vector?

Q. What is the use of adapter in STL in c++?

Q. Which is used to iterate over container?

Q. What does the function objects implement?

Q. What are the two advantage of function objects than the function call?

Q. Which header is need to be used with function objects?

Q. Which are instances of a class with member function operator() when it is

Q. How many parameters does a operator() in a function object shoud take?

Q. How does a sequence of objects are accessed in c++?

Q. How many parameters are present in mismatch method in non-sequence modifying algorithm?

Q. What will happen in ‘all_of’ method if the range is empty?

Q. To what kind of elements does non-modifying sequence algorithm can be applied?

Q. Pick out the incorrect method in non-modifying sequence algorithm?

Q. What is the use of middle parameter in rotate method?

Q. What kind of object is modifying sequence algorithm?

Q. How the sequence of objects can be accessed?