QUESTIONS AND ANSWERS | 2026
UPDATE | 100% CORRECT - FSU.
DOMAIN 1: LANGUAGE FUNDAMENTALS
(Questions 1-10)
1. What are the three components of an object in C++?
A) Data, functions, and inheritance
B) Name, member data, and member functions
C) Public, private, and protected sections
D) Constructors, destructors, and copy constructors
Correct Answer: B
Rationale: According to Myers' class materials, an object has three
components: Name, Member data, and Member functions . This is a
fundamental concept emphasized in the course.
2. According to Mr. Myers, what is the most important rule stressed
almost every day in class?
A) Always comment your code
B) DECLARE BEFORE USE
C) No global variables
D) Use meaningful variable names
Correct Answer: B
Rationale: The most important rule emphasized is "DECLARE BEFORE USE,"
meaning you must define something BEFORE you can use it later in your
program . This is a critical C++ principle.
3. What are the four things every class has in C++?
A) Constructor, Destructor, Copy Constructor, Assignment Operator
B) Constructor, Destructor, Friend functions, Inline functions
C) Public, Private, Protected, Static members
D) Virtual functions, Pure virtual functions, Overloaded operators, Templates
Correct Answer: A
Rationale: Every class in C++ has a constructor, destructor, copy
, constructor, and assignment operator (overload operator=) . If not explicitly
defined by the programmer, the compiler will generate default versions.
4. Which of the following functions will the compiler automatically
generate if you do not write them?
A) Default constructor only
B) Copy constructor only
C) Assignment operator only
D) All of the above
Correct Answer: D
Rationale: If the programmer does not write them, the compiler will
automatically generate a default constructor, copy constructor, and
assignment operator for the class .
5. What is the correct prototype for the assignment operator
overload member function in a class called Table?
A) Table& operator=(const Table &);
B) Table& operator=(const Table &) const;
C) Table& operator=(Table &, const Table &);
D) Table =(Table &);
Correct Answer: A
Rationale: The correct prototype for the assignment operator overload
member function is Table& operator=(const Table &); . It returns a reference to
the calling object (by reference) to enable cascading and takes a constant
reference parameter.
6. What is the declaration format for a copy constructor?
A) typename copy(const typename &);
B) typename(const typename);
C) typename(const typename &);
D) typename operator=(const typename &);
Correct Answer: C
Rationale: The copy constructor is declared with the format: typename(const
typename &); . For example: Fraction(const Fraction &);
7. In the D.D.U. method (Declare, Define, Use), which files
correspond to each step?
A) Declare: Main program; Define: Header; Use: Implementation
B) Declare: .h header file; Define: .cpp implementation file; Use: main driver
program
C) Declare: .cpp implementation; Define: .h header; Use: main
D) Declare: main program; Define: header; Use: implementation