Skip to content
main-logo
  • +91 637-050-2482
  • santuitreturns@gmail.com
Menu
Menu
  • Home
  • Income Tax
    • Income From Salary
    • Profit or gain from Business/Profession.
    • Capital Gain
    • Income From Other Sources
    • 80C to 80U
    • TDS & TCS
    • ITR FORMS
  • International Taxation
    • Transfer Pricing
    • Non-Resident Taxation
    • Foreign Tax Credit (FTC)
    • Model Tax Convention
    • Base Erosion and Profit Shifting (BEPS)
  • GST
  • Accounting
  • MCQs
    • NEET
    • NEET QUIZ TEST
    • NEET PG MCQ’s
    • NEET PG QUIZ TEST
    • Civil Engineering
    • Mechanical Engineering MCQs
    • CHSL EXAM
      • Logical Reasoning
  • Others
    • Job Tips
  • CA Courses
    • CA Inter/IPCC

10+ TOP C++ MCQs on Complex Number Type

Posted on September 24, 2023

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

A. complexnum
B. complex
C. complex number
D. complexarg

View Answer

Answer: B

Explanation: 

 <complex> header file is used for declaring a complex number in C++.

2. How to declare the complex number?

A. (3, 4)
B. complex(3, 4)
C. (3, 4i)
D. (3, 4g)

View Answer

Answer: B

Explanation:

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

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

A. 1
B. 2
C. 3
D. 4

View Answer

Answer: C

Explanation:

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

4. What will be the output of the following C++ code?

    #include 
    #include 
    using namespace std;
    int main() 
    {
       complex c1(4.0, 16.0), c2;
       c2 = pow(c1, 2.0);
       cout << c2;
       return 0;          
    }

A. (-240, 128)
B. (240, 128)
C. (240, 120)
D. (240, -122)

View Answer

Answer: A

Explanation:

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

5. What will be the output of the following C++ code?
    #include 
    #include 
    using namespace std;
    int main()
    {
        complex c_double(2, 3);
        complex c_int(4, 5);
        c_double *= 2;
        c_double = c_int;
        cout << c_double;
        return 0;
    }

A. (2, 3)
B. (4, 5)
C. (8, 15)
D. (8, 10)

View Answer

Answer: B

Explanation:

 We are just copying the value of c_int into c_double, So it’s printing as (4,5).

6. What will be the output of the following C++ code?
    #include 
    #include 
    using namespace std;
    int main()
    {
        complex i(2, 3);
        i = i * 6 / 3;
        cout << i;
        return 0;
    }

A. (4, 6)
B. (2, 3)
C. (6, 12)
D. (6, 15)

View Answer

Answer: A

Explanation:

 We are multiplying the complex number by 2.

7. What will be the output of the following C++ code?

    #include 
    #include 
    using namespace std;
    int main()
    {
       complex c1(4.0,3.0);
       cout << "c1: " << c1;
       complex c2(polar(5.0,0.75));
       cout << c1 + complex(c2.real(),c2.imag());
       return 0;
    }

A. c1: (4,3)(7.65844,6.40819)
B. c1: (4,3)(7,6)
C. both c1: (4,3)(7.65844,6.40819) & c1: (4,3)(7,6)
D. c1: (5,3)(7,6)

View Answer

Answer: A

Explanation:

We are adding the two complex numbers and printing the result.

8. What will be the output of the following C++ code?
    #include 
    #include 
    using namespace std;
    int main()
    {
        complex c1(4.0, 3.0);
        complex c2(polar(5.0, 0.75));
        cout  << (c1 += sqrt(c1)) << endl;
        return 0;
    }

A. (4.0, 3.0)
B. (6.12132, 3.70711)
C. (5.0, 0.75)
D. (5.0, 3.75)

View Answer

Answer: B

Explanation:

 In this program, we are adding both complex number and finding the square root of it.

9. Which of the following is not a function of complex values?

A. real
B. imag
C. norm
D. cartesian

View Answer

Answer: D

Explanation:

 Real is used for returning real part, imag for imaginary part and norm for calculating norm of a complex number. There is no such function Cartesian in complex header file.

10. What will be the output of the following C++ code?
    #include 
    #include 
    using namespace std;
    int main ()
    {
        complex mycomplex (20.0, 2.0);
        cout << imag(mycomplex) << endl;
        return 0;
    }

A. 2
B. 20
C. 40
D. 30

View Answer

Answer: A

Explanation:

imag part will return the imaginary part of the complex number.

    You May Also Like...

  • 10+ TOP C++ MCQs on OOPs Concept – 4
  • 10+ TOP MCQs on C++ vs C
  • 10+ TOP MCQs on C++ Concepts
  • 10+ TOP MCQs on C++ Concepts -2
  • 10+ TOP C++ MCQs on Sizes
  • 10+ TOP C++ MCQs on Void
  • 10+ TOP C++ MCQs on Declaration
  • 10+ TOP C++ MCQs on Pointer to Void

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Quick Links

  • Home
  • About Us
  • Privacy Policy
  • Terms of Use
  • Disclaimer
  • Contact Us

Categories

  • Income Tax
  • International Taxation
  • GST
  • MCQs
  • Others
  • CA Courses

Latest Posts

  • Five changes in ITR forms of FY 2024-25 (AY 2025-26)
  • Form 10-IEA: Option to Choose Old Tax Regime
  • What is Section 54EC of the Income Tax Act?
  • What is Section 54F of the Income Tax Act?
©2025 Online Solves. All rights Reserved | Developed by AlgoPage IT Solutions Pvt. Ltd.
We use cookies on our website to give you the most relevant experience by remembering your preferences and repeat visits. By clicking “Accept All”, you consent to the use of ALL the cookies. However, you may visit "Cookie Settings" to provide a controlled consent.
Cookie SettingsAccept All
Manage consent

Privacy Overview

This website uses cookies to improve your experience while you navigate through the website. Out of these, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may affect your browsing experience.
Necessary
Always Enabled
Necessary cookies are absolutely essential for the website to function properly. These cookies ensure basic functionalities and security features of the website, anonymously.
CookieDurationDescription
cookielawinfo-checkbox-analytics11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Analytics".
cookielawinfo-checkbox-functional11 monthsThe cookie is set by GDPR cookie consent to record the user consent for the cookies in the category "Functional".
cookielawinfo-checkbox-necessary11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookies is used to store the user consent for the cookies in the category "Necessary".
cookielawinfo-checkbox-others11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Other.
cookielawinfo-checkbox-performance11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Performance".
viewed_cookie_policy11 monthsThe cookie is set by the GDPR Cookie Consent plugin and is used to store whether or not user has consented to the use of cookies. It does not store any personal data.
Functional
Functional cookies help to perform certain functionalities like sharing the content of the website on social media platforms, collect feedbacks, and other third-party features.
Performance
Performance cookies are used to understand and analyze the key performance indexes of the website which helps in delivering a better user experience for the visitors.
Analytics
Analytical cookies are used to understand how visitors interact with the website. These cookies help provide information on metrics the number of visitors, bounce rate, traffic source, etc.
Advertisement
Advertisement cookies are used to provide visitors with relevant ads and marketing campaigns. These cookies track visitors across websites and collect information to provide customized ads.
Others
Other uncategorized cookies are those that are being analyzed and have not been classified into a category as yet.
SAVE & ACCEPT