Object Oriented Programming Using C++ Questions

Practice Object Oriented Programming Using C++ MCQs with answers and explanations. Page 2 of 3.

Category
Computer Science
Topic
Object Oriented Programming Using C++
Page
2 / 3
Mode
Practice

Questions

Open any question to view the answer and explanation.

In C/C++, why might you define a struct (structure) type at global scope rather than repeating its definition inside each function that uses it?
Open
View answer
In object-oriented analysis and design, the practice of focusing on essential properties while deliberately ignoring inessential details is known as what?
Open
View answer
In standard C++ file I/O, which header file must be included to use input and/or output file streams such as std::ifstream and std::ofstream?
Open
View answer
In C++ class design, to expose a data member to outside code (so client code can access it directly), the member must be declared in which access section of the class?
Open
View answer
In C/C++, an array name in an expression most naturally represents what concept at the language level?
Open
View answer
In C++ iostream formatting, how can format flags (such as std::ios::hex, std::ios::showbase) be combined when setting multiple formatting options?
Open
View answer
In object-oriented design, does adding a new derived class typically require fundamental changes to the existing base class interface and implementation?
Open
View answer
Language paradigms: can C++ be used both as a procedural (structured) programming language and as an object-oriented language, depending on how you design your code?
Open
View answer
Generic container classes: if container classes are carefully constructed, these tools are available to work with data structures that are not what (i.e., they do not need to be tied to a single concrete type)?
Open
View answer
In C++ object-oriented programming, what do we call the special member function that is invoked automatically each time an object's lifetime ends (for example, when it goes out of scope or is deleted)?
Open
View answer
In C++ parameter passing, when you pass a variable by ________, only the current contents (a copy of the value) are sent to the receiving function.
Open
View answer
In C++, when the compiler cannot distinguish between two overloaded constructors (or functions) based on their parameter lists, the overload set is said to be what?
Open
View answer
C++ class templates: if you instantiate a class template once with int and again with double, how do you call the same member function on those different instantiations?
Open
View answer
In software design, which form of coupling between modules is considered best (i.e., most desirable) for maintainability and reuse?
Open
View answer
In modular programming terminology, sending a copy of data to a program module (so the callee receives only the current value) is called what?
Open
View answer
C/C++ literals: which of the following characters are valid inside a numeric literal token (as part of the literal itself) in standard C++?
Open
View answer
C++ string literals: select the single option that is an <em>invalid</em> string constant (i.e., not a valid string literal) while others are valid strings.
Open
View answer
C++ One Definition Rule (ODR): can you define the same non-inline function more than once in the same program (across translation units)?
Open
View answer
Overloading in C++: overloaded functions are required to meet which condition?
Open
View answer
In C++ input and output using iostreams, which statement correctly allows the user to enter (read) a value from the keyboard into the variable named currentPay?
Open
View answer

Practice smarter

Solve a few questions daily and revisit weak topics regularly to improve accuracy.