Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I know the answers for the following questions but I\'m not really sure how to g

ID: 3555773 • Letter: I

Question

I know the answers for the following questions but I'm not really sure how to give reasons for these.. Need help with the reasons on why is it true or false.. ............

TRUE/FALSE

TRUE/FALSE

     1.   True/False: Whereas object-oriented programming centers around the object, procedural programming centers around functions.

ANS: T

     2.   True/False: Class objects can be defined prior to the class declaration.

ANS: F

     3.   True/False: The constructor function may not accept arguments.

ANS: F

     4.   True/False: A destructor function can have zero to many parameters.

ANS: F

     5.   True/False: More than one constructor function may be defined for a class.

ANS: T

     6.   True/False: More than one destructor function may be defined for a class.

ANS: F

     7.   True/False: Object-oriented programming is centered around the object, which encapsulate together both the data and the functions that operate on the data.

ANS: T

     8.   True/False: You must declare all data members of a class before you declare member functions.

ANS: F

     9.   True/False: You must use the private access specification for all data members of a class.

ANS: F

   10.   True/False: A private member function is useful for tasks that are internal to the class, but is not directly called by statements outside the class.

ANS: T

   11.   True/False: If you do not declare a destructor function, the compiler will furnish one automatically.

ANS: T

   12.   True/False: When an object is defined without an argument list for its constructor, the compiler automatically calls the object's default constructor.

ANS: T

   13.   True/False: One purpose that constructor functions are often used for is to allocate memory that will be needed by the object.

ANS: T

   14.   True/False: One purpose that destructor functions are often used for is to free memory that was allocated by the object.

ANS: T

Explanation / Answer

1.   True/False: Whereas object-oriented programming centers around the object, procedural programming centers around functions.

ANS: T (Yes, true)

     2.   True/False: Class objects can be defined prior to the class declaration.

ANS: F (class declaration is like the definition of the class, we cannot create objects before defining it)

     3.   True/False: The constructor function may not accept arguments.

ANS: F (in OOP, we can always define constructor functions with arguments)

     4.   True/False: A destructor function can have zero to many parameters.

ANS: F (destructor function has no parameter, it is automatically invoked by the compiler when an object is destructed to clean up dynamically allocated memory)

     5.   True/False: More than one constructor function may be defined for a class.

ANS: T (Yes, we can define any no. of constructors)

     6.   True/False: More than one destructor function may be defined for a class.

ANS: F (No, we can have only 1 destructor without any arguments, it is automatically invoked by the compiler when an object is destructed to clean up dynamically allocated memory)

     7.   True/False: Object-oriented programming is centered around the object, which encapsulate together both the data and the functions that operate on the data.

ANS: T (Object-oriented programming is about hiding sensitive data and details and only make public what is needed and safe to use for users, others are private)

     8.   True/False: You must declare all data members of a class before you declare member functions.

ANS: F (No ordering is defined as per C++ syntax)

     9.   True/False: You must use the private access specification for all data members of a class.

ANS: F (When we don't use any specifier, it means by default private)

   10.   True/False: A private member function is useful for tasks that are internal to the class, but is not directly called by statements outside the class.

ANS: T (Yes)

   11.   True/False: If you do not declare a destructor function, the compiler will furnish one automatically.

ANS: T (Yes , there is default destructor function for every class)

   12.   True/False: When an object is defined without an argument list for its constructor, the compiler automatically calls the object's default constructor.

ANS: T (Yes, true)

   13.   True/False: One purpose that constructor functions are often used for is to allocate memory that will be needed by the object.

ANS: T (Yes, we can dynamically allocate arrays, etc. in constructors, and need to dynamically delete them in destructor to avoid memory leaks)

   14.   True/False: One purpose that destructor functions are often used for is to free memory that was allocated by the object.

ANS: T (Yes, previous question )

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote