ExamVeda
Login
Home
41
What will be the output of the following C++ code?
#include <iostream>
#include <complex>
using namespace std;
int main()
{
   complex<double> c1(4.0,3.0);
   cout << "c1: " << c1;
   complex<float> c2(polar(5.0,0.75));
   cout << c1 + complex<double>(c2.real(),c2.imag());
   return 0;
}
Discuss
Answer & Solution
Answer: Option A
No explanation is given for this question. Let's Discuss on Board
42
What will be the output of the following C++ code?
#include <iostream>
using namespace std;
int main()
{
    int x;
    int *p;
    x = 5;
    p = &x;
    cout << *p;
    return 0;
}
Discuss
Answer & Solution
Answer: Option A
No explanation is given for this question. Let's Discuss on Board
43
What will be the output of the following C++ code?
#include <iostream>
using namespace std;
int main()
{
    int i;
    enum month 
    {
        JAN,FEB,MAR,APR,MAY,JUN,JUL,AUG,SEP,OCT,DEC
    };
    for (i = JAN; i <= DEC; i++)
        cout << i;
    return 0;
}
Discuss
Answer & Solution
Answer: Option A
No explanation is given for this question. Let's Discuss on Board
44
How many approaches are used for operator overloading?
Discuss
Answer & Solution
Answer: Option C
No explanation is given for this question. Let's Discuss on Board
45
What will be the output of the following C++ code?
#include <iostream>
using namespace std;
int main()
{
    int a, b;
    int* c;
    c = &a;
    a = 200;
    b = 200;
    *c = 100;
    b = *c;
    cout << *c << " " << b;
    return 0;
}
Discuss
Answer & Solution
Answer: Option D
No explanation is given for this question. Let's Discuss on Board
46
Pick out the correct statement.
Discuss
Answer & Solution
Answer: Option A
No explanation is given for this question. Let's Discuss on Board
47
What will be the output of the following C++ code?
#include <iostream>
#include <string>
using namespace std;
 
class A
{
	static int a;
 
   public:
	void change(int i){
		a = i;
	}
	void value_of_a(){
		cout<<a;
	}
};
 
int main(int argc, char const *argv[])
{
	A a1 = A();
	a1.change(5);
	a1.value_of_a();
	return 0;
}
Discuss
Answer & Solution
Answer: Option C
No explanation is given for this question. Let's Discuss on Board
48
What is the syntax of overloading operator + for class A?
Discuss
Answer & Solution
Answer: Option A
No explanation is given for this question. Let's Discuss on Board
49
What will be the output of the following C++ code if the string entered by the user is "Hello World"?
#include <iostream> 
#include <string>
using namespace std; 
int main(int argc, char const *argv[])
{
	string str;
	cin>>str;
	cout<<str;
	return 0;
}
Discuss
Answer & Solution
Answer: Option B
No explanation is given for this question. Let's Discuss on Board
50
What will be the output of the following C++ code?
#include <iostream>
using namespace std;
int main()
{
    double a = 21.09399;
    float b = 10.20;
    int c ;
    c = (int) a;
    cout << c ;
    c = (int) b;
    cout << c ;
    return 0;
}
Discuss
Answer & Solution
Answer: Option A
No explanation is given for this question. Let's Discuss on Board