ExamVeda
Login
Home
81
Which of the following is not a modifier function in string class?
Discuss
Answer & Solution
Answer: Option B
No explanation is given for this question. Let's Discuss on Board
82
In the case of friend operator overloaded functions how many maximum object arguments a unary operator overloaded function can take?
Discuss
Answer & Solution
Answer: Option A
No explanation is given for this question. Let's Discuss on Board
83
What will be the output of the following C++ code?
#include <iostream>
#include <complex>
using namespace std;
int main()
{
    complex<int> i(2, 3);
    i = i * 6 / 3;
    cout << i;
    return 0;
}
Discuss
Answer & Solution
Answer: Option A
No explanation is given for this question. Let's Discuss on Board
84
What will be the output of the following C++ code?
#include <iostream>
using namespace std;
class sample
{
    public:
    sample() 
    {  
        cout << "X::X()" << endl; 
    }
    sample( sample const & ) 
    {  
        cout << "X::X( X const & )" << endl;
    }
    sample& operator=( sample const & )
    { 
        cout << "X::operator=(X const &)" << endl;
    }
};
sample f() 
{
    sample tmp;
    return tmp;
}
int main() 
{
    sample x = f();
    return 0;
}
Discuss
Answer & Solution
Answer: Option C
No explanation is given for this question. Let's Discuss on Board
85
Which of the following operators can't be overloaded?
Discuss
Answer & Solution
Answer: Option A
No explanation is given for this question. Let's Discuss on Board
86
Which of the following statements is NOT valid about operator overloading?
Discuss
Answer & Solution
Answer: Option B
No explanation is given for this question. Let's Discuss on Board
87
What will be the output of the following C++ code?
#include <iostream>
using namespace std;
int main ()
{
    int a, b, c;
    a = 2;
    b = 7;
    c = (a > b) ? a : b;
    cout << c;
    return 0;
}
Discuss
Answer & Solution
Answer: Option B
No explanation is given for this question. Let's Discuss on Board
88
What will be the output of the following C++ code?
#include <iostream>
using namespace std;
class Distance
{
    private:
    int feet;
    int inches;
    public:
    Distance()
    {
        feet = 0;
        inches = 0;
    }
    Distance(int f, int i) 
    {
        feet = f;
        inches = i;
    }
    Distance operator()(int a, int b, int c)
    {
        Distance D;
        D.feet = a + c + 10;
        D.inches = b + c + 100 ;
        return D;
    }
    void displayDistance()
    {
        cout  << feet <<  inches << endl;
    }
};
int main()
{
    Distance D1(11, 10), D2;
    cout << "First Distance : ";
    D1.displayDistance();
    D2 = D1(10, 10, 10);
    cout << "Second Distance :";
    D2.displayDistance();
    return 0;
}
Discuss
Answer & Solution
Answer: Option A
No explanation is given for this question. Let's Discuss on Board
89
What will be the output of the following C++ code?
#include <iostream>
#include <string>
using namespace std;
class A
{
	int a = 5;
    public:
	void change(int i){
		a = i;
	}
	static void value_of_a(){
		cout<<a;
	}
};
 
int main(int argc, char const *argv[])
{
	A a1 = A();
	a1.change(10);
	a1.value_of_a();
	return 0;
}
Discuss
Answer & Solution
Answer: Option B
No explanation is given for this question. Let's Discuss on Board
90
Where does the object is created?
Discuss
Answer & Solution
Answer: Option A
No explanation is given for this question. Let's Discuss on Board