By C++ definition, a “default constructor” is a constructor that accepts how many parameters?

Difficulty: Easy

Correct Answer: no

Explanation:


Introduction / Context:
Terminology around constructors can be confusing. The C++ standard defines a default constructor in a very specific way. This question checks whether you know that definition.



Given Data / Assumptions:

  • We are speaking about the standard term “default constructor”.
  • We distinguish it from user-provided, trivial, or implicitly-declared constructors.
  • Parameters with default values may still allow default construction.



Concept / Approach:
A default constructor is one that can be called with no arguments. Most simply, it has no parameters. A constructor with parameters all of which have default values also counts as a default constructor because it can be invoked with zero arguments. MCQs usually distill this to “no parameters”.



Step-by-Step Solution:
1) struct T { T(); }; → default constructor with zero parameters.2) struct U { U(int x = 0); }; → still default-constructible because it can be called with no arguments.3) The essence is callability with zero arguments.4) Thus, choose “no”.



Verification / Alternative check:
Instantiate T t; and U u; to confirm that both forms allow default construction.



Why Other Options Are Wrong:
one/two/three: incorrect by the standard definition.“Any number if all have defaults”: while nuanced, the canonical MCQ answer emphasizes that a default constructor takes no arguments.



Common Pitfalls:
Confusing “default constructor” with “compiler-generated constructor”. A class may or may not get an implicitly declared default constructor depending on other user-declared constructors.



Final Answer:
no


Discussion & Comments

No comments yet. Be the first to comment!
Join Discussion