temp.re = this?

What happens when you attempt to compile and run the following code? #include <iostream> #include <string> using namespace std; class complex{ double re, im; public: complex() : re(1),im(0.4) {} complex operator+(complex &t); void Print() { cout << re << " " << im; } }; complex complex::operator+ (complex &t){ complex...

July 3, 2023 No Comments READ MORE +

obj?

Which code, inserted at line 5, generates the output "ABC"? #include <iostream> using namespace std; class A { public: //insert code here }; class B:public A { public: void Print(){ cout<< "B"; } }; class C:public B { public: void Print(){ cout<< "C"; } }; int main() { A ob1;...

July 3, 2023 No Comments READ MORE +

What happens when you attempt to compile and run the following code?

What happens when you attempt to compile and run the following code? #include <iostream> using namespace std; class complex{ double re; double im; public: complex() : re(0),im(0) {} complex(double x) { re=x,im=x;}; complex(double x,double y) { re=x,im=y;} void print() { cout << re << " " << im;} }; int...

July 3, 2023 No Comments READ MORE +

Which of the following can be checked in a switch?case statement?

Which of the following can be checked in a switch?case statement?A . char B.int C.enum D.doubleView AnswerAnswer: A,B,C

July 3, 2023 No Comments READ MORE +

What happens when you attempt to compile and run the following code?

What happens when you attempt to compile and run the following code? #include <iostream> using namespace std; int main(int argc, char *argv[]) { char *s = "ABCDEF"; cout << s+2; return 0; }A . It prints: CDEF B.It prints: ABCDEF C.It prints: BCDEF D.None of theseView AnswerAnswer: A

July 3, 2023 No Comments READ MORE +

What happens when you attempt to compile and run the following code?

What happens when you attempt to compile and run the following code? #include <cstdlib> #include <iostream> using namespace std; float* sum(float a,float b); float* sum(float a,float b) { float *f = new float; *f = a+b; return f; } int main() { float a,b,*f; a = 1.5; b = 3.4;...

July 3, 2023 No Comments READ MORE +

What happens when you attempt to compile and run the following code?

What happens when you attempt to compile and run the following code? #include <iostream> using namespace std; int main (int argc, const char * argv[]) { int x,y; union t { char tab[2]; int i; }; union t u; u.tab[0] = 1; u.tab[1] = 2; u.i = 0; x =...

July 2, 2023 No Comments READ MORE +

Which of the following statements are correct about an array?

Which of the following statements are correct about an array? int tab[10];A . The array can store 10 elements. B.The expression tab[1] designates the very first element in the array. C.The expression tab[9] designates the last element in the array. D.It is necessary to initialize the array at the time...

July 2, 2023 No Comments READ MORE +

What happens when you attempt to compile and run the following code?

What happens when you attempt to compile and run the following code? #include <iostream> using namespace std; class complex{ double re; double im; public: complex() : re(0),im(0) {} complex(double x) { re=x,im=x;}; complex(double x,double y) { re=x,im=y;} void print() { cout << re << " " << im;} }; int...

July 2, 2023 No Comments READ MORE +

What happens when you attempt to compile and run the following code?

What happens when you attempt to compile and run the following code? #include <iostream> using namespace std; int main() { int i=2; switch(i) { case 1: cout<<"Hello"; case 2: cout<<"world"; case 3: cout<<"End"; } return 0; }A . It prints: Hello B.It prints: world C.It prints: worldEnd D.It prints: EndView...

July 1, 2023 No Comments READ MORE +