Numbers


  1. What is the output of this program?
    #include <iostream>
    #include <complex>
    using namespace std;
    int main()
    {
    complex<double> Comp_double(4, 6);
    complex<int> Comp_int(7, 8);
    Comp_double *= 2;
    Comp_double = Comp_int;
    cout << Comp_double;
    return 0;
    }











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: A

    We are just copying the value of Comp_int into Comp_double, So it’s printing as (7,8).


  1. What is the output of this program?
    #include <iostream>
    #include <complex>
    using namespace std;
    int main()
    {
    complex<double> Comp1(3.0, 9.0), Comp2;
    Comp2 = pow(Comp1, 2.0);
    cout << Comp2;
    return 0;
    }











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: D

    In this program, we are finding the square of the complex number.



  1. How many real types are there in complex numbers?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: B

    There are three real types in complex numbers. They are float complex, double complex, long double complex.


  1. How to declare the complex number?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: A

    We can declare the complex number by using complex(5,6) where 5 is a real number and 6 is imaginary part.



  1. Which header file is used to declare the complex number?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: C

    complex