CPP

CPP

Complex Number Type has 9 Questions

Which header file is used to declare the complex number?

complexnum
complex
complexnumber
None of the mentioned
How to declare the complex number?

(3,4)
complex(3,4)
(3,4i)
None of the mentioned
How many real types are there in complex numbers?

1
2
3
4
What is the output of this program?
  1.     #include 
  2.     #include 
  3.     using namespace std;
  4.     int main() 
  5.     {
  6.        complex<double> c1(4.0, 16.0), c2;
  7.        c2 = pow(c1, 2.0);
  8.        cout << c2;
  9.        return 0;          
  10.     }

(-240, 128)
(240, 128)
(240, 120)
None of the mentioned
What is the output of this program?
  1.     #include 
  2.     #include 
  3.     using namespace std;
  4.     int main()
  5.     {
  6.         complex<double> c_double(2, 3);
  7.         complex<int> c_int(4, 5);
  8.         c_double *= 2;
  9.         c_double = c_int;
  10.         cout << c_double;
  11.         return 0;
  12.     }

(2, 3)
(4, 5)
(8, 15)
None of the mentioned
What is the output of this program?
  1.     #include 
  2.     #include 
  3.     using namespace std;
  4.     int main ()
  5.     {
  6.         complex<double> mycomplex (20.0, 2.0);
  7.         cout << imag(mycomplex) << endl;
  8.         return 0;
  9.     }

2
20
40
None of the mentioned
Which of the following is not a function of complex values?

real
imag
norm
cartesian
What is the output of this program?
  1.     #include 
  2.     #include 
  3.     using namespace std;
  4.     int main()
  5.     {
  6.         complex<double> c1(4.0, 3.0);
  7.         complex<float> c2(polar(5.0, 0.75));
  8.         cout  << (c1 += sqrt(c1)) << endl;
  9.         return 0;
  10.     }

(4.0, 3.0)
(6.12132, 3.70711)
(5.0, 0.75)
None of the mentioned
What is the output of this program?
  1.     #include 
  2.     #include 
  3.     using namespace std;
  4.     int main()
  5.     {
  6.        complex<double> c1(4.0,3.0);
  7.        cout << "c1: " << c1;
  8.        complex<float> c2(polar(5.0,0.75));
  9.        cout << c1 + complex<double>(c2.real(),c2.imag());
  10.        return 0;
  11.     }

c1: (4,3)(7.65844,6.40819)
c1: (4,3)(7,6)
both a & b
None of the mentioned