‘TRUE’ OR ‘FALSE’ in C++

Written on:August 23, 2013
Comments are closed


1. C++ is a case-insensitive language.

2. Comments in C++ may be specified by /*..*/ or // or –.

3. The return statement in main() function is optional.

4. Comments can be nested in C++.

5. OOPs (Object Oriented Programming) is a programming approach implementable in C++.

6. A statement in C++ may be syntactically correct but semantically incorrect.

7. The Linker program generates the executable version of the source code.

8. All the library files and header files are searched, when you compile the source code.

9. The value of a local variable is accessible outside a block.

10. C++ supports low-level as well as high level programming.

11. In C++, it is not mandatory to specify a function prototype.

12. Variables may be declared at any place in a C++ program.

13. cin and cout statements may be concatenated.

14. You must define a function prototype if you invoke a function before defining it.

15. int x, y=x; is a valid C++ statement.

16. You can write more than one command in a line.

17. Procedural abstractions represent the objects on which the procedures are acting.

18. You can call standard ‘C’ library functions in a C++ program using an extern ‘C’ statement.

19. void is the default return type of main().

20. cout is extensible i.e. it can handle user defined data types.

21. You could use main as a variable name.

22. The return value of function main() is returned not to another part of the program but to the operating system.

23. Structure is similar to that of class except that it does not contain methods that operate on data members.

24. Variable names of arguments passed to a function are optional in function prototype.

25. An identifier must begin with an alphabet or underscore.

26. #include directive is an essential for each C++ code.

27. A variable needs to be defined before its usage.

28. cout << ‘\n’ ; and cout << “\n” are valid statements in C++.

29. Symbolic constants may be defined using const qualifier but not with #define.

30. By default all float values are casted implicitly to double data type.

31. Assigning a long value to a float can result in round-off error.

32. An array is passed by reference.

33. A constant member function can’t be overloaded with a non-constant object.

34. static and extern variables are created during compilation time before the main() function.

35. const identifiers may be initialized before their usage.

36. The minimum array size needed to hold a string “C++” is 3.

37. A structure declaration ends with a semicolon.

38. You can declare structure objects from main(), even if you don’t specify the tag name, while declaring it outside the main().

39. ‘C’ is an example of string constant.

40. It is not possible to obtain the size of a data type in C++.

41. pow() function finds the square of a number.

42. Unary arithmetic operators have higher precedence then the modulus operator.

43. Relational operators have lower precedence than logical operators.

44. Logical NOT operator has higher precedence than arithmetic operators.

45. A structure variable may be passed as a parameter to a function.

46. Assignment operator (=) may be used with structure variables to assign the value of one structure value to the other.

47. A structure is a user defined type build using data of other types.

48. Memory is allocated when you define a structure.

49. Structures must always be declared globally.

50. Global variables are always defined externally i.e. outside of main() and preceding it.

51. The result of the expression: 7 * 5 / 7 is 0.

52. exit(1) implies abnormal termination of the program.

53. while(condition) must follow the enclosed statement atleast once.

54. for(;;) is a valid looping construct i.e. initialization, conditional and update sections are optional.

55. A pointer variable stores the address of some other variable.

56. It is mandatory to specify break with each case statement in switch() construct.

57. continue is used for an unconditional transfer of control statement.

58. De-reference operator (*) references to the value of a variable following it.

59. In C++, a pointer with the value zero is called NULL pointer.

60. The return value is zero, if memory is not dynamically allocated using new operator.

61. new operator may be used to allocate memory dynamically and that too of any type.

62. x=x+1; is invalid for arrays as you can’t change the value of an array name.

63. Incrementing a pointer variable by 1, fetches the successive memory location irrespective of the data type.

64. Pointers can be compared using relational operators.

65. Pointer de-referencing operator (->) is used to access structure members created dynamically.

66. A static variable persist for the duration of a program.

67. While memory is allocated dynamically, initialization of variables is possible.

68. The return type of new operator is void.

69. for and do..while loops are entry condition loops.

70. If x1 is a variable, then x1+5; is a valid statement in C++.

71. If ptr[3]=5; then ptr[3]+=5; as well as *(ptr+3)+=5; will result in value 10.

72. The value of the k in the expression: int i=10, k=20*i; is 10.

73. The condition: if(y=5){x=1;} else {x=2;} will result in the value of x as 2 if y is 4.

74. Array initialization can be performed only at the time of array declaration.

75. Integer arrays by default are initialized with zero.

76. The default return type of a function is void.

77. Default arguments to functions may be specified in right to left fashion.

78. If structure is passed as function parameter, then the original value remains unchanged.

79. The scope of external variables is the entire program, whereas that of auto is block scope.

80. Macros end with a semicolon.

81. The ability of a function to call itself is recursion.

82. The preprocessor directive #include must be placed before the function main().

83. strstr() checks for the occurrence of a given substring in another string.

84. isupper() function is part of string.h header file.

85. long double data type allocates 10 bytes of memory on a particular machine.

86. If ans=5; cout<<ans++; will print 6 on the screen.

87. Post increment/decrement operators have higher precedence than pre increment/decrement operators.

88. A register declaration is a auto declaration.

89. The storage class needed for a variable x which is to be shared by the function in one file but hidden from other file is static global.

90. Both, structure tag name and structure variable may be omitted simultaneously.

91. Structures may be nested.

92. Functions can return structures.

93. An enumerated data type provides a way to name numbers in symbolic form.

94. enum ans{true, false}; declaration assigns value 1 to true and 0 to false.

95. The default value of variables in enum type may be changed explicitly by the user.

96. An enumerated type defined within a structure has to be accessed using a dot operator, as it is local to the structure.

97. int y=2,507; is an valid assignment statement in C++.

98. In C++, the logical operator AND is symbolized by symbol || and OR by &&.

99. In a switch construct, you cannot use comparison operators with the case clause.

100. C++ creates anonymous variables when you mismatch a variable to a reference.

101. Class member functions are also termed as class methods.

102. Functions defined in a class specification are automatically inline.

103. The member functions of a class must always be defined outside the class definitions.

104. Inline functions are invoked as normal functions.

105. A class can’t have an array as its member.

106. The default class scope is private.

107. A private data member of a class can only be accessed by its member function.

108. A class supports encapsulation, abstraction and data hiding features in C++.

109. Methods in a class can’t be declared as private.

110. A function defined outside a class must precede with inline qualifier to make it inline.

111. #define macro is similar to an inline function.

112. Inline functions are efficient but consume more memory.

113. Memory is allocated when a class is defined.

114. A friend function is a member function.

115. A function as well as a class may be friend of the other class.

116. Memory allocation takes place only when a class object is created.

117. A private data member is accessible to a friend function.

118. A friend function to a class can be listed in either part of a class.

119. The public or private distinction does not apply to friend functions.

120. The public member functions set the class interface.

121. Scope resolution operator defines a function which is not a member function.

122. It is upto the compiler whether to make any function inline or not even after defining it as inline.

123. A constructor function is called when a class object is created.

124. The default return type of constructor function is void.
125. Data members of a class can’t be initialized in the class definition.

126. A static data member must be defined outside the class definition.

127. A constructor function may have a name other than the class name.

128. A default constructor takes one argument.

129. A copy constructor initialize an object with the other one.

130. Constructors may be overloaded.

131. Constructors can only be defined inside a class definition.

132. A constructor function is not a member function.

133. A constructor function can only be defined as public.

134. By default, if no constructor is defined, a default constructor with no parameters is invoked.

135. Constructors may use default arguments.

136. The destructor is the class name preceded by a tilde (~).

137. A destructor is called immediately before the storage for the object is released.

138. A class constructor is called only once, irrespective of object definition.

139. Destructor functions may or may not receive arguments.

140. A destructor can have no return value.

141. Parameterized constructors accept arguments.

142. Constructor arguments are specified while creating class object.

143. A constructor function with default values of all the arguments is a default constructor.

144. Class destructors become necessary when class constructors use new.

145. You can have only one destructor per class.

146. If c1(int x) ; is a class constructor accepting an integer parameter, then c1 obj = 5; is a valid assignment in C++.

147. The fundamental (basic) data types don’t have constructors.

148. Constructors may be called implicitly or explicitly.

149. When an object is passed by value, a copy constructor is invoked.

150. Address of a constructor is not defined.

151. You cannot call a member function from within a constructor.

152. Destructor functions can be inherited.

153. The destructor function may be static.

154. The derived class inherits the constructor and destructor of the base class.

155. In C++, the class scope resolution operator can be used for selecting member functions of the base class as well as data members.

156. In C++, I/O operations are sensitive to data types.

157. Each overloaded function intended to be a friend must be explicitly declared as a friend of the class.

158. In a class, member objects are constructed in the order in which they are declared.

159. Scope resolution operator has the highest precedence.

160. const constructor may be declared for a class.

161. A class with default constructor can’t initialize a class with another object of the same class.

162. The order of destruction of objects is reversed as that of construction.

163. A friend function can’t use an object to invoke the function.

164. A friend class’s member functions can’t access another class’s private members.

165. You can have only one friend function with a particular name and signature per file.

166. If entire class is made a friend of some other class, then all the member functions of that class become friend functions.

167. A friend function can’t access protected members of a class.

168. The keyword friend appears in the prototype declaration of the function and in actual function definition.

169. A function may be a friend of more than one class.

170. Declaring a friend function in private section of a class rather than public alters its meaning.

171. A friend function operates upon the object(s) passed to it as arguments.

172. Telling the compiler in advance, class name defined later, is forward declaration.

173. The class name used in forward declaration may be different from the one actually defined.

174. Scope resolution operator (::) always refers to the file scope variable.

175. When you define a class, memory is allocated for data members as well as member functions.

176. For member functions, memory is allocated only once, i.e. when is class is defined.

177. The memory space is allocated for objects’ data members, only when the class objects are declared.

178. An object may be passed as an argument to a member function, a non-member function and a friend function.

179. A class may be declared as static.

180. A static data member is shared by all the objects of a class.

181. A static data member is visible only within the class.

182. A static data member is accessible outside the class, as its scope is entire program.

183. A static data member may be initialized while defining it.

184. A static data member function accesses only the static data members of a class.

185. Members of a class are public by default.

186. A friend function can’t invoke other friend function.

187. Class data members must always be private.

188. Member-wise assignment of data members of an object takes place through assignment operator.

189. A const member function can’t modify an object data member.

190. A friend function declared inside a class is invoked through class objects.

191. const static data members may be declared.

192. The argument may be passed by value to a copy constructor.

193. Function overloading results in faster execution of programs.

194. If two functions with same name have similar parameters but different return type, they are overloaded.

195. func1(int x) ; func2( unsigned int x1) ; results in compilation error.

196. The compiler looks for the nearest match through promotion in calling overloaded functions.

197. In C++, with default arguments, only the arguments from the right side can be defaulted.

198. A constructor function cannot be overloaded.

199. Function parameter is function signature.

200. Dynamic binding allows to handle class hierarchies in a very simple way.

201. You can’t redefine the minus operator so that it finds the sum of two double numbers instead of finding their difference.

202. You can violate the syntax rules for the original operator while overloading it.

203. You can alter operator precedence while overloading.

204. Scope resolution operator (::) cannot be overloaded.

205. You can’t define new operator symbols while overloading an operator.

206. Subscripting operator ([]) can be overloaded only through member function.

207. the int_array = str_array; statement of C++ is legal, if int_array is an array and str_array is a string.

208. We cannot provide a new definition of assignment by overloading the assignment operator(=).

209. Overloaded operators can be non-member functions.

210. sizeof and conditional operator cannot be overloaded.

211. Default arguments can be used to overload an operator.

212. The NULL pointer is defined in the standard header file stddef.h.

213. You can perform multiplication operation on pointers.

214. The unary operator new returns a pointer to a char type value.

215. The newly allocated memory can be initialized at the time of allocation itself.

216. The scope of an object created using new is entire program.

217. A reference is an alias name for a variable.

218. A function that returns reference can be placed on the left side of an assignment statement.

219. Pointers to different classes cannot be assigned to each other.

220. A function with a parameter that is a reference or pointer to constant invoking member function that has a constant invoking object may still be used with non-constant objects.

221. The value of a pointer to a constant cannot be changed.

222. A structure having a member element that refers to the structure itself is a self-referential structure.

223. A pointer can point to only public members of the class.

224. The unary indirection operator can be used on the left side of an assignment statement.

225. ‘this’ is an implicit pointer.

226. The static member functions may have a ‘this’ pointer.

227. The value of ‘this’ pointer cannot be changed.

228. You can cast a ‘this’ pointer to some other type.

229. Static member functions cannot be accessed by this pointer.

230. It is possible to pass a ‘this’ pointer to friend functions.

231. The dot operator is used to access the public members of the class with a pointer to an object.

232. In C++, functions may return reference.

233. Inheritance is often referred to as ‘is-a’ relationship.

234. A derived class can directly access the private data members of the base class.

235. A derived class can directly access the protected data members of the base class.

236. By default, private members are not inherited.

237. Constructors and Destructors could not be declared virtual.

238. Constructors may not be defined as virtual, but explicit destructors may be defined to be virtual.

239. A pure virtual function is a virtual function that has no implementation in its class.

240. Abstract classes can be instantiated.

241. An abstract class may have more than one virtual function.

242. An abstract base class essentially includes at least one pure virtual function.

243. The ofstream class defines a rich collection of unformatted input functions.

244. Increment operator (++) and decrement operator (–) can be overloaded for prefix as well as postfix form.

245. ** may be overloaded as an exponentiation operator.

246. In C++, input output operations are sensitive to the type of data.

247. this pointer is always implicitly used and can’t be used explicitly.

248. To derive a class from a base class, the default access level is public.

249. C++ views a file as a stream of bytes.

250. Static member functions cannot be accessed by ‘this’ pointer.

251. The <iomanip.h> header file contains information for formatted input/output with parameterized stream manipulators.

252. In C++, outputs to object cerr are unbuffered.

253. Member functions tellp and tellg return the current locations of the put and get pointers respectively.

254. C++ provides both unformatted I/O and formatted I/O operations.

255. Inheritance exhibits transitive nature.

256. When many subclasses inherit from a single base class, it is multiple inheritance.

257. The transitive nature of inheritance is reflected by hybrid inheritance.

258. When inheriting publicly, the derived class can access private members of the base class directly.

259. When inheriting privately, the public and protected members of the base class become private members of the derived class.

260. A privately inherited class may be inherited further.

261. Members intended to be inherited but not intended to be public, should be declared as private.

262. When an object of a derived class is created, the program first calls the constructor for base class and then of derived class.

263. You can pass parameters to a base class constructor through a derived class constructor.

264. You can selectively allow access to some of the base class members when deriving privately.

265. Derivation is friendship.

266. We cannot assign a base class pointer to a derived class pointer.

267. A virtual function can be a static member function.

268. A derived class object is converted to a base class object when used as an argument to a base class member function.

269. If you expect to redefine a function in derived classes, declare it as a virtual function in the base class.

270. The ios class represents general properties of a stream.

271. In C++, output to object clog is unbuffered.

272. The endl manipulator flushes the buffer and inserts a newline.

273. unsetf() member function reads current format flag’s value.

274. In C++, references are same as pointers.

275. A virtual function may be declared a function in another class.

276. An overloaded binary operator can be overloaded for ternary operation.

277. showpoint is an enumerated constant defined in the ios class definition.

278. setprecision is a part of <iomanip.h> header file.

279. precision() function has default value as 2.

280. In C++, << is insertion operator and >> is extraction operator.

Solution Set to TRUE or FALSE

(1) F (2) F (3) T (4) F (5) T
(6) T (7) F (8) T (9) F (10) T
(11) T (12) T (13) T (14) T (15) F
(16) T (17) F (18) T (19) F (20) T
(21) T (22) T (23) T (24) T (25) T
(26) F (27) T (28) T (29) F (30) T
(31) T (32) T (33) T (34) T (35) F
(36) F (37) T (38) F (39) F (40) F
(41) F (42) T (43) F (44) T (45) T
(46) T (47) T (48) F (49) F (50) T
(51) F (52) T (53) F (54) T (55) T
(56) T (57) F (58) F (59) T (60) T
(61) T (62) T (63) F (64) T (65) T
(66) T (67) T (68) T (69) F (70) T
(71) T (72) F (73) F (74) T (75) F
(76) F (77) T (78) F (79) T (80) F
(81) T (82) T (83) T (84) F (85) T
(86) F (87) T (88) T (89) T (90) F
(91) T (92) T (93) T (94) F (95) T
(96) T (97) F (98) F (99) F (100)T

(101) T (102) T (103) F (104) F (105) F
(106) T (107) T (108) T (109) F (110) T
(111) F (112) T (113) F (114) F (115) T
(116) T (117) T (118) T (119) T (120) T
(121) F (122) T (123) T (124) F (125) T
(126) T (127) F (128) F (129) T (130) T
(131) F (132) F (133) F (134) T (135) T
(136) T (137) T (138) F (139) F (140) T
(141) T (142) T (143) T (144) T (145) T
146) T (147) F (148) T (149) T (150) T
(151) F (152) F (153) F (154) F (155) T
(156) F (157) T (158) T (159) T (160) T
(161) F (162) T (163) T (164) F (165) T
(166) T (167) F (168) F (169) T (170) F
(171) T (172) T (173) F (174) T (175) F
(176) F (177) T (178) T (179) F (180) T
(181) T (182) F (183) T (184) T (185) F
(186) F (187) F (188) T (189) T (190) F
(191) T (192) F (193) T (194) F (195) F
(196) T (197) T (198) F (199) T (200) T

(201) T (202) F (203) F (204) T (205) T
(206) T (207) T (208) F (209) T (210) T
(211) F (212) T (213) F (214) F (215) T
(216) F (217) T (218) T (219) T (220) T
(221) T (222) T (223) T (224) T (225) T
(226) F (227) T (228) T (229) T (230) F
(231) F (232) T (233) T (234) F (235) T
(236) T (237) F (238) T (239) T (240) F
(241) T (242) T (243) F (244) T (245) F
(246) F (247) F (248) F (249) T (250) T

(251) T (252) T (253) T (254) T (255) T
(256) F (257) F (258) F (259) T (260) F
(261) F (262) T (263) T (264) T (265) F
(266) F (267) T (268) T (269) T (270) T
(271) F (272) T (273) F (274) F (275) F
(276) T (277) T (278) T (279) F (280) T

Sorry, the comment form is closed at this time.