Question
#include <iostream>
#include <functional>
#include <vector>
#include <algorithm>
#include <string>
using namespace std;
int main ()
{
vector <string*> numbers;
numbers.push_back ( new string ("one") );
numbers.push_back ( new string ("two") );
numbers.push_back ( new string ("three") );
vector <int> lengths ( numbers.size() );
transform (numbers.begin(), numbers.end(), lengths.begin(),
mem_fun(&string :: length));
for (int i = 0; i < 3; i++)
{
cout << lengths[i];
}
return 0;
}
a.
335
b.
225
c.
334
d.
224
Posted under Object Oriented Programming Using C++
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. Which are instances of a class with member function operator() when it is
View solution
Q. How many parameters does a operator() in a function object shoud take?
View solution
Q. How does a sequence of objects are accessed in c++?
View solution
Q. How many parameters are present in mismatch method in non-sequence modifying algorithm?
View solution
Q. What will happen in ‘all_of’ method if the range is empty?
View solution
Q. To what kind of elements does non-modifying sequence algorithm can be applied?
View solution
Q. Pick out the incorrect method in non-modifying sequence algorithm?
View solution
Q. What is the use of middle parameter in rotate method?
View solution
Q. What kind of object is modifying sequence algorithm?
View solution
Q. How the sequence of objects can be accessed?
View solution
Q. How many kind of operation can be applied to transform method in c++?
View solution
Q. What operator is used to remove the dupplicates in the range?
View solution
Q. What is meant by sequence point?
View solution
Q. Pick out the correct statement about sequence point.
View solution
Q. In sequence point, how will the overloaded operators behave like?
View solution
Q. What do input and output objects support?
View solution
Q. What kind of execution does sequence point allow?
View solution
Q. When does the next sequence point start?
View solution
Q. What is meant by heap?
View solution
Q. Which value is pointed out first in heap?
View solution
Suggested Topics
Are you eager to expand your knowledge beyond Object Oriented Programming Using C++? We've curated a selection of related categories that you might find intriguing.
Click on the categories below to discover a wealth of MCQs and enrich your understanding of Computer Science. Happy exploring!