Computer Science - Object Oriented Programming Using C++

21.
The #ifndef directive tests to see whether ________
a class has been defined
a variable has been given a value
a class has no variable definitions
any objects of the class have been instantiated
Answer: Option
Explanation:

#ifndef checks whether the given token has been #defined earlier in the file or in an included file; if not, it includes the code between it and the closing #else or, if no #else is present, #endif statement. #ifndef is often used to make header files idempotent by defining a token once the file has been included and checking that the token was not set at the top of that file.


22.
Which of the following statements is false?
A function is a block of code that performs a specific task
Functions allow programmers to break large and complex problems into small and manageable tasks
Functions allow programmers to use existing code to perform common tasks
Functions can be called, or invoked, only once in a program
Programmer-defined functions can be either value-returning or void
Answer: Option
Explanation:
No answer description is available. Let's discuss.

23.
The generic type in a template function
must be T
can be T
cannot be T for functions you create, but may be for C++'s built-in functions
cannot be T
Answer: Option
Explanation:
No answer description is available. Let's discuss.

24.
When a child class function is called, the compiler looks first for a matching function name in the _____
class of the object using the function name
immediate ancestor class
base class
descendant class
Answer: Option
Explanation:
No answer description is available. Let's discuss.

25.
A function that is called automatically each time an object is destroyed is a
constructor
destructor
destroyer
terminator
Answer: Option
Explanation:
No answer description is available. Let's discuss.