Professional Documents
Culture Documents
E. Balagurusamy - True/False Questions Chapter 1 - Principles of Object-Oriented Programming
E. Balagurusamy - True/False Questions Chapter 1 - Principles of Object-Oriented Programming
1.15: State whether the following statements are TRUE or FALSE (10).
Ans:
a> FALSE
b> TRUE
c> TRUE
d> FALSE
e> FALSE
f> TRUE
g> TRUE
h> FALSE
i> TRUE
j> FALSE
2.1: State whether the following statements are TRUE or FALSE (6).
(a) Since C is a subset of C++, all C programs will run under C++ compilers.
(b) In C++, a function contained within a class is called a member function.
(c) Looking at one or two lines of code, we can easily recognize whether a program is written
in C or C++.
(d) In C++, it is very easy to add new features to the existing structure of an object.
(e) The concept of using one operator for different purposes is known as operator
overloading. (f) The output function printf() cannot be used in C++ programs.
Ans:
a> FALSE
b> TRUE
c> FALSE
*** most lines of codes are the same in C & C++
d> TRUE
e> TRUE
f> FALSE
Ans:
5.10: State whether the following statements are TRUE or FALSE (10).
Ans:
(a) FALSE
(b) TRUE
(c) FALSE
*A function designed as public can be accessed like any other ordinary functions from the
member function of same class.
(d) TRUE
(e) TRUE
(f) FALSE
(g) FALSE
(h) TRUE
(i) FALSE
(j) FALSE
Chapter 6 – Constructors and Destructors
6.10: State whether the following statements are TRUE or FALSE (5).
(a) Constructors, like other member functions, can be declared anywhere in the class.
(b) Constructors do not return any values.
(c) A constructor that accepts no parameter is known as the default constructor.
(d) A class should have at least one constructor.
(e) Destructors never take any argument.
Ans:
(a) FALSE
(b) TRUE
(c) TRUE
(d) TRUE
(e) TRUE
7.10: State whether the following statements are TRUE or FALSE (8).
(a) Using the operator overloading concept, we can change the meaning of an operator.
(b) Operator overloading works when applied to class objects only.
(c) Friend functions cannot be used to overload operators.
(d) When using an overloaded binary operator, the left operand is implicitly passed to the
member function.
(e) The overloaded operator must have at least one operand that is user-defined type.
(f) Operator functions never return a value.
(g) Through operator overloading, a class type data can be converted to a basic type data.
(h) A constructor can be used to convert a basic type to a class type data.
Ans:
(a) FALSE
(b) TRUE
(c) FALSE
(d) FALSE
(e) TRUE
(f) FALSE
(g) TRUE
(h) TRUE
8.16: State whether the following statements are TRUE or FALSE (8):
(a) Inheritance helps in making a general class into a more specific class.
(b) Inheritance aids data hiding.
(c) One of the advantages of inheritance is that it provides a conceptual framework.
(d) Inheritance facilitates the creation of class libraries.
(e) Defining a derived class requires some changes in the base class.
(f) A base class is never used to create objects.
(g) It is legal to have an object of one class as a member of another class.
(h) We can prevent the inheritance of all members of the base class by making base class
virtual in the definition of the derived class.
Ans:
(a) TRUE
(b) FALSE
(c) TRUE
(d) TRUE
(e) FALSE
(f) TRUE
(g) TRUE
(h) FALSE
10.16: State whether the following statements are TRUE or FALSE (7).
(a) A C++ stream is a file.
(b) C++ never truncates data.
(c) The main advantage of width() function is that we can use one width specification for
more than one items.
(d) The get(void) function provides a single-character input that does not skip over the white
spaces.
(e) The header file iomanip can be used in place of iostream.
(f) We cannot use both the C I/O functions and C++ I/O functions in the same program.
(g) A programmer can define a manipulator that could represent a set of format functions.
Ans:
(a) TRUE
(b) FALSE
(c) FALSE
(d) TRUE
(e) TRUE
(f) FALSE
(g) TRUE
11.15: State whether the following statements are TRUE or FALSE (10).
Ans:
(a) FALSE
(b) FALSE
* file pointer can be a synonym for current position.
(c) TRUE
(d) TRUE
(e) TRUE
(f) TRUE
(g) FALSE
(h) FALSE
* tell ( ) is for output file and tell g ( ) for input file
(i) TRUE
(j) FALSE
* fin.fail ( ) cau returns non-zero when an input or output operation on the file has failed.