Chapter - 3: Graduating to C++

State True or False :


A
Sections
1
Exercises

(a) In C++, a structure can contain data members, as well as functions that can operate upon the data members.
True.

(b) In C++, a union can contain data members, as well as functions that can operate upon the data members.
True

(c) If the function is defined before calling it, there is a need to mention its prototype.
True

(d) It is possible to create an array of references.
False: Array of pointers is possible but not array of references

(e) Once a reference is tied with a variable, it cannot be tied with another variable.
True

(f) A variable can be tied with several references.
True

(g) In a C++ program, re-definition is not allowed whereas re-declaration is allowed.
True

(h) In C++ a function call can occur even on the left-hand side of an assignment operator.
True: if returning a reference. False otherwise

(i) It is unsafe to return a local variable by reference
True.

(j) cin and cout are objects.
True

(k) C++ permits the use of anonymous structures.
False: C++ only supports anonymous unions and enums.

(l) A pointer to another type can be assigned to a void pointer without the need of typecasting.
True.

(m) The following two definitions are the same : enum grade g; grade g;
True

(n) The following two statements perform the same job:
int a = 10;
int a(10);
True.

(o) The following two statements perform the same job:
bool a;
BOOL a;
False: BOOL is not termed as any data type.

(p) The following three statements perform the same job:
cout << "\n";
cout << '\n';
cout << endl;
True.


© 2021 Garbage Valuegarbage value logo