ExamVeda
Login
Home
51
Which of the following operator can be overloaded?
Discuss
Answer & Solution
Answer: Option D
No explanation is given for this question. Let's Discuss on Board
52
How to store the large objects in c++ if it extends its allocated memory?
Discuss
Answer & Solution
Answer: Option A
No explanation is given for this question. Let's Discuss on Board
53
What will be the output of the following C++ code?
#include <iostream>
#include <string>
using namespace std;
int main ()
{
    string str ("microsoft");
    string::reverse_iterator r;
    for (r = str.rbegin() ; r < str.rend(); r++ )
        cout << *r;
    return 0;
}
Discuss
Answer & Solution
Answer: Option C
No explanation is given for this question. Let's Discuss on Board
54
How to declare the complex number?
Discuss
Answer & Solution
Answer: Option B
No explanation is given for this question. Let's Discuss on Board
55
Given the following C++ code. How would you define the < operator for Box class so that when boxes b1 and b2 are compared in if block the program gives correct result?
#include <iostream>
#include <string>
using namespace std;
class Box
{
    int capacity;
    public:
    Box(){}
    Box(double capacity){
        this->capacity = capacity;
	}
};
int main(int argc, char const *argv[])
{
    Box b1(10);
    Box b2 = Box(14);
    if(b1 < b2){
	cout<<"Box 2 has large capacity.";
    }
    else{
	cout<<"Box 1 has large capacity.";
	}
    return 0;
}
Discuss
Answer & Solution
Answer: Option A
No explanation is given for this question. Let's Discuss on Board
56
What will be the output of the following C++ code?
#include <iostream>
using namespace std;
class sample
{
    public:
    sample(int i) : m_i(i) { }
    public:
    int operator()(int i = 0) const 
    { 
        return m_i + i; 
    }
    operator int () const   
    { 
        return m_i; 
    }
    private:
    int m_i;
    friend int g(const sample&);
};
int f(char c)
{
    return c;
}
int main()
{
    sample f(2);
    cout << f(2);
    return 0;
}
Discuss
Answer & Solution
Answer: Option B
No explanation is given for this question. Let's Discuss on Board
57
What will be the output of the following C++ code?
#include <iostream>
#include <string>
using namespace std;
int main ()
{
  string str ("example.");
  str.front() = 'E';
  cout << str << endl;
  return 0;
}
Discuss
Answer & Solution
Answer: Option B
No explanation is given for this question. Let's Discuss on Board
58
Which container in c++ will take large objects?
Discuss
Answer & Solution
Answer: Option C
No explanation is given for this question. Let's Discuss on Board
59
How many types of models are available to create the user-defined data type?
Discuss
Answer & Solution
Answer: Option B
No explanation is given for this question. Let's Discuss on Board
60
Which concepts does the Pre Increment use?
Discuss
Answer & Solution
Answer: Option B
No explanation is given for this question. Let's Discuss on Board