hamburger menu
All Coursesall course arrow
adda247
reward-icon
adda247
    arrow
    arrow
    arrow
    Which of the following statements about the main() function in C++ is incorrect?
    Question



    Which of the following statements about the main() function in C++ is incorrect?

    A.

    main() is the entry point of a C++ program.

    B.

    A C++ program can have more than one main() function.

    C.

    The return type of main() is always int.

    D.

    Command-line arguments can be passed to main().

    E.

    None of the above

    Correct option is B

    In C++, the main() function serves as the entry point of a program, and there can only be one main() function per program. Having multiple main() functions would result in a compilation error.
    Important Key Points:
    1. The main() function must have a return type of int and return a value (usually 0 for successful execution).
    2. Command-line arguments can be passed using int argc and char* argv[] parameters in the main() function.
    3. The program execution starts and ends with the main() function.
    Knowledge Booster:
    · Overloading main(): Not allowed; only one main() function is permitted.
    · Command-Line Arguments: Provide input to the program via the terminal during execution.
    · void main(): Although used in some compilers, it is not a standard in modern C++.

    Free Tests

    Free
    Must Attempt
    Video Solutions

    RBI Assistant Pre 2026 Full Mock Test -01

    languageIcon English
    • pdpQsnIcon100 Questions
    • pdpsheetsIcon100 Marks
    • timerIcon60 Mins
    languageIcon English
    Free
    Must Attempt
    Video Solutions

    RBI Asst Prelims 2026 : Reasoning Section Test 01

    languageIcon English
    • pdpQsnIcon35 Questions
    • pdpsheetsIcon35 Marks
    • timerIcon20 Mins
    languageIcon English
    Free
    Must Attempt
    Video Solutions

    RBI Asst Prelims 2026 : Quant Section Test 01

    languageIcon English
    • pdpQsnIcon35 Questions
    • pdpsheetsIcon35 Marks
    • timerIcon20 Mins
    languageIcon English
    test-prime-package

    Access ‘IBPS RRB SO IT Officer (Scale-II)’ Mock Tests with

    • 60000+ Mocks and Previous Year Papers
    • Unlimited Re-Attempts
    • Personalised Report Card
    • 500% Refund on Final Selection
    • Largest Community
    students-icon
    368k+ students have already unlocked exclusive benefits with Test Prime!
    Our Plans
    Monthsup-arrow