Vu All Subjects Assignment Quiz GDB Handouts Available here
1. Aslam U Alaikum!
Dear Students,
Quiz No 3 will be opened from
Friend function are used in cases where one class is ____ to another class
Independent
2. For casting, we normally declare a pointer of type ____________.
We are going to use…….confirm
3. Constructor is special type of function
Which has no return type…..confirm from net
4. Class can be defined as
A class includes both objects and structures
5. The object code of our program is combined with the _________.
Object code of the library function….confirm
6. I+=2 is equivalent to ________.
I= i+2….confirm
7. For accessing data members we use _____________ operator.
(Dot.)….confirm
8. The _________ is called automatically when an object destroys
destructor
9. The function overloading requires _______.
The argument list to be the same….confirm
10. With user data type variables (objects) self assignment can produce
Logical error……confirm from net
11. Constructor is a special type of function
Which has no return type……confirm from net
12. Look at the statement given below int & a; and tell what will happen
Compiler will generate an error: a declared as reference but not initialized….confirm from net
13. Macros are categorized into ___________type(s)
Two…..confrim
14. If the memory in the free store is not sufficient ____________.
Malloc function returns NULL pointer…confirm from net
15. A reference cannot be Null it has to point a data type
True…..confirm
16. The friend function of a class can have access __________.
To the private data members….confirm
17. #define CIRCUMFERENCE(X) (2*PI*R) is a.
Definition of a macro…..confirm from net
18. Which of the following is unary operator
i--, i++, ++i…..all options…confirm
19. For overloading a void type pointer ptr into integer type, the correct syntax is
(int*)ptr……confirm
20. Ternary operator is shown as ___________.
?;
21. If we do not write our own assignment operator then which of the following problem may occur?
Dangling pointer
22. Getche() is a __________ function and defined in _________ header file.
Built in function, conio.h……confirm from net
23. Core must be taken about the correct _________ of operator while overloading.
Both semantic and complexity
24. Which function is used to delete the allocated memory space?
Free()……confirm from net
25. Friend functions are ________.
Private……confirm
26. Which one of the following is the correct statement about operator overloading?
Arithmetic operators can be overloaded only
27. Once we have defined a symbolic constant value using #define, that value ______ during program execution.
Cannot be changed……confirm from net
28. Consider the following code segment. Which of the following will be called while executing code at line 2? String s1, s2; s1 = s2
Assignment Operator
29. The concept of _______ allows us to separate the interface from the implementation of the class.
Encapsulation…….confirm
30. In overloading the assignment (=) operator, which object will be passed as an argument(s) in the operator function?
Left object of the assignment operator
31. In overloading the assignment (=) operator, which object(s) will call operator function?
Left object of the assignment……confirm from net
32. Class can be defined as:
A class includes both data members as well as functions to manipulate that data
33. Constructor has ________.
The same name as of class…….confirm
34. We can _________ pointer
Reassign, decrement, increment…….All options correct
35. The constructor contains ____________.
No return type
36. ____________ will return the number of bytes reserved for a variable or data type
Sizeof operator…….confirm from net
37. In C++ the region of available memory is called __________.
Free store
38. The only operator that the compiler overloads for user define data type by default is
Assignment (=) operator….confirm from net
39. Functions declared with the _______________ specifier in a class member list are called friend functions of that class.
friend
40. Public or private keywords can be ____________
written multiple times in the class or structure declaration
41. The friend keyword provides access _____________.
in one direction only
References cannot be uninitialized. Because it is impossible to _______________
reinitialize a reference
42. new operator can be used for ______________.
integer , float, char and double data types……confirm
10. The destructor is used to ______________.
deallocate memory
43. Reference is not really an address it is ______________.
a synonym
44. If we want to allocate memory to an array of 5 integers dynamically, the syntax will be _____________.
int *iptr ; iptr = new int[5] ;
45. Memory allocated from heap or free store _____________________.
cannot be returned back unless freed explicitly using free and delete operators
46. Operator overloading is to allow the same operator to be bound to more than one implementation, depending on the types of the _________.
Operands
47. The operator to free the allocated memory using new operator is ________________.
delete
48. Public or private keywords can be _________.
written multiple times in the class or structure declaration …….confirm from net
49. A class can be declared as a ____________ of other class
Friend class…..confirm
50. In C++ operators, which of the following operator cannot be overloaded __________.
?;
51. We can _________ references.
None of the given options…..confirm from net
52. Being a concise language, C needs something for its __________.
Enhancement…..confirm
53. The compiler gets the modified ______________
source code file…..confirm
54. When we write __________ this somefile is ordinary text file of C code.
#include….confirm
55. The line where we write the ________ statement is replaced by the text of that file.
#include…..confirm
56. All of the preprocessor directives start with __________.
# sign……confirm
57. There are _______ ways to use #include.
Two……confirm
58. ‘h’ stands for ________
header files…..confirm
59. We can include files anywhere in the code but it needs to be _______and at the ___________.
Logical, proper position…….confirm
60. The _________of function must be declared before its usage
Prototype…..confirm
61. The ___________ of compilation will be successful.
first parse…..confirm
62. After the _______ of the compiler, it converts the source code into object code
First phase…..confirm
63. ___________ is machine code but is not re-locateable executable.
Object code……confirm
64. The __________ of our program is combined with the object code of the library functions.
object code……confirm
65. The __________ performs this task while the compiler includes the name and arguments.
Linker…..confirm
66. For checking the _______ of the functions, the compiler needs to know the definition of the function or at least the prototype of the function.
Validity…….confirm
67. The preprocessor will search for the file “myHeaderFile.h” in the current working directory. It will be written as
#include “myHeaderFile.h……confirm
68. ______ is a universal constant and has a value of _______.
Pi, 3.1415926…….confirm
69. Be sure that the value of_________ can not be changed.
Pi……confirm
70. All the preprocessor directives start with the sharp sign.
(#)…….confirm
71. Macros are classified into ______ categories.
Two……confirm
72. The first type of macros can be written using ___________.
#define…….confirm
73. The second type of macros takes arguments. It is also called a _________.
parameterized macros…….confirm
74. Being a _______, it does not require any semicolon at the end.
non-C code…..confirm
75. The__________ will be replaced by the actual macro definition including the entire parenthesis in the code before compilation.
CIRCLEAREA……..confirm
76. A symbol cannot be redefined without________ it first.
Undefining…….confirm
77. The __________ directives help in debugging the program
Conditional compilation……confirm
78. _______ variable names starting with underscore.
Do not declare……confirm
79. Always use _________ while defining macros that takes arguments.
Parenthesis……confirm
80. So an ordinary _______ is actually a C code.
English poem…….confirm
81. Earlier, whenever we declared arrays, the size of the arrays was_________.
Predefined…..confirm
82. It is better to compare both the ________ and ______ allocation methods to understand the benefits of the usage of dynamic memory allocation.
Static , dynamic……..confirm
83. Static allocation is also called _______
Compile time allocation…..confirm
84. A pointer ptr of type void is declared as under
void *ptr ;…..confirm
85. The syntax of the calloc function is as follows.
void *calloc (size_t n, size_t el_size)……confirm
86. The ______ function takes one argument i.e. the number of bytes to be allocated
Malloc……confirm
87. The syntax of the malloc function is as follows
void * malloc (size_t size) ;…..confirm
88. #undef is used for
Making a symbol undefined…..confirm
89. Let suppose a = b = c. In such situation, it is necessary to return a reference of an object from assignment operator function.
True
90. Which one of the following is the declaration of overloaded pre-increment operator implemented as member function?
Class-name operator ++()…..confirm
91. A class is a user defined data type it takes _________.
No space in memory unless we create an object from it……..confirm
92. The heap memory structure __________.
Constantly changes in size…….confirm
93. Which of the following permits function overloading in C++
Both type and arguments……confirm from net
94. The data members of the class are initialized ________.
At runtime…..confirm
95. ___________ operators are the ones that require two operands on both sides of the operator.
Binary……confirm
96. _________ operators are the ones that require only one operator to work to the left of the operand
Unary……..confirm
97. Which one of the following is mandatory preprocessor directive for c++?
#include <iostream>……confirm from net
98. Functions declared with the _________ specifier in a class member list are called friend functions of that class
Friend
99. Default constructor takes _________.
No parameters…..confirm
100. The members of a class declared without any keyword are _____ by default
Private…….confirm from net
101. In a class we can have ______ constructor(s).
Many…..confirm
102. _________ for parameters is also done for inline functions.
Automatic type checking…..confirm
103. An address is a ______, while a pointer is a ___________.
Constant, Variable …… confirm from net
104. The compiler generates _________ automatically
Constructors
105. When an operator function is defined as member function for a binary Plus (+) operator then the number of extra arguments it takes is/are
Two….confirm from net
106. Date+=1 is equivalent to _________.
Date + 1 ……confirm
107. Windows operating system may itself takes memory from __________.
Heap….confirm from net
108. Identify the correct method of adding two strings s1 and s2
Strcat (s1, s2)
109. Name the function whose definition can be substituted at a place where its function call is made ___________.
Inline function……confirm from net
110. If class A is a friend of class b, and class B is a friend of class C, if class A wants class C to be a friend _________.
It has to declare, class C as a friend….confirm
111. Separate the interface and ________.
Implementation…..confirm
112. Constructor has the same name as of ______.
Class…..confirm
113. Initializing the data members in the definition of the class is a __________.
Syntax error…..confirm
114. The new operator automatically determines the size of memory required to store that object, so it does not need _________.
Sizeof operator…..confirm
115. Object code is machine code but it is not _________ and __________.
Relocateable, executable…….confirm
116. While using ______ operator we do not need to supply number of bytes allocated
New……confirm
117. The operator to free the allocated memory using ______ operator is _________. So whenever we use new to allocate memory.
New, delete…..confirm
118. The _______ operator frees the allocated memory that is returned back to free store for usage ahead.
Delete……confirm
119. The memory allocation functions return a chunk of memory with a pointer of type _________.
Void……confirm
120. The syntax of declaration of a function that returns the reference to an integer is ________.
Int & myfunc();……confirm
121. For console input and output we use _______.
Conia.h header file…..confirm
122. A pointer is _________.
A variable for storing address…….confirm
123. For the joining of two strings in string class, we may use ‘+’ operator, can we use ‘-’ operator the same way for subtracting strings?
No
124. A friend function of a class is a function defined __________.
Outside that class and that has the right access protected members of the class only
125. The reference data types are used as _______ variables without any ______ operator
Ordinary , deference……confirm
126. Operator overloading is to allow the same operator to be ______ to more than one implementation, depending on the types of the operands.
Bound…….confirm
127. The concept of friend function negates the concept of ________.
Encapsulation……confirm
128. Overloaded assignment operator must be
Member function of class
129. Header files provide ______ so the program running on one operating system can run without an error on the other system.
Portability……confirm
130. Once an object is declared as a friend ________.
It has access to all non-public members as if they were public….confirm from net
131. If text is a pointer of type string then what will be the functionality of following statement?
Creates array of 5 objects dynamically
132. A __________ function of a class is defined outside that class scope, but it can access all private and protected members of the class.
Friend
133. For binary member operators operands on the ______ drives (calls) the operation
Left
134. A class is a user defined data type it takes ______________.
No space in memory unless we create an object from it
135. We cannot increment ___________.
Reference…….confirm from net
136. To prevent dangling reference the functions returning reference should be used with _______.
Static and global variables…..confirm from net
137. free function is available in _________ header file.
Stdlib.h
138. Assignment operator is used to initialize a newly declared object from existing object
True……confirm
139. The dynamic memory allocation uses _______ whereas static memory allocation uses ______.
Heap, stack….confirm from net
140. C++ offers _______ levels of data access control inside a class
Three
141. The members of a class declared with the keyboard struct are __________ by default.
Public…..confirm
142. __________ is a special type of pointer we have to cost it before we use it.
Void
143. Encapsulation means __________.
That the data of a class cannot be accessed from outside……confirm
144. The friend keyword provides access ________.
In one direction only …….. confirm
145. Reference variables must __________.
Be initialized after they are declared……confirm
146. Reference is not really an address it is ______.
A synonym……confirm from net
147. C++ was developed by ________
Bjarne Stroustrup……confirm
148. Which of the following syntax is best used to delete an array of 5 objects named ‘string’ allocated using new operator.
Delete []string;
149. if we have a program that writes the output data(numbers) to the disc, and if we collect the output data and write it on the disc in one write operation in the above situation the area where we will gather the number is called.
Buffer…..confirm
150. Consider the following code, the printed value will be converted into
int n = 10;
cout<<oct<<n;
base 8
151. When new operator is overloaded at global level then corresponding built-in new operator will also be visible to whole of the program.
False…..confirm
152. When new operator is overloaded at global level then corresponding built-in new operator will not be visible to whole of the program.
True….confirm
153. To avoid dangling reference, don’t return ___________.
The reference of a local variable from the function…….confirm
154. Reference is a thing by which we can create __________ of any data type
Synonym……confirm from net
155. Reference cannot be uninitialized. Because it is impossible to ________.
Reinitialize a reference……confirm from net
156. _________ must be included to use stream manipulator in your code
Iostream
157. Let suppose int a, b, c, d, e; a=b=c=d=e=42; This can be interpreted by the compiler as
a = (b=(c=(d=(e=42))));
158. What is meant by the following statement? String str[5] = {string(“Programming”), string(“CS201”)};
Parameterized constructor will call for first 2 objects and default constructor for remaining objects…….confirm from net
159. Overloaded member operator function is always called by ______.
Compiler…….confirm from net
160. The default visibility for the data members of the class is
Private……confirm
161. The operator to free the allocated memory using new operator is ________.
delete……confirm
162. Bugs can occur due to ______________.
Uninitialized data…..confirm
163. When the compiler overloads the assignment ( = ) operator by default then
Compiler does member wise assignment……..confirm from net
164. In functions, that returns reference use ___________.
Global or static variables
165. Look at the program code and identify the error. #include<iostream> using namespace std; #define PI 3.1415926; main() { int radius =5; cout<< “Area of circle with radius”<< radius<< ‘ =’ <<PI * radius * radius;}
Error exist in line number 2. Semi colon is not allowed with define directive
166. Destructor ____________.
Cannot be overloaded and have no return type……confirm
167. __________ data isn’t accessible by non-member functions or outside classes
Private…..confirm
168. If the request of new operator is not fulfilled due to insufficient memory in the heap ______.
The operator returns 0…….confirm
169. Symbolic constant PI can be defined as;
#define PI 3.14…….confirm from net
170. Data+=1 is equivalent to ________.
Date+1…….confirm
171. ____________ operators are the ones that require only one operator to work.
Unary……confirm
172. If B is designated as friend of A, B can access A’s non-public members.
A can access non-public members of B……confirm
173. Operator overloading is to allow the same operator to be bound to more than one implementation, depending on the types of the ________.
Operands…..confirm
174. What will be the output of the following c++ code?
#include<iostream.h>
#define max 100
Main()
{
#ifdef max
cout<< “Hellow”;
}
Error……confirm from net
175. While using __________ operator we do not need to supply number of bytes allocated.
New
176. The ________ data type always represents an empty set of values in C++.
Void……confirm
More Important Quiz File
We are here to provide Latest Virtual University Assignment Solutions, GDB Solutions, Quiz Solution, Midterm Past Papers, and Final term Past Papers in this website.
Thanks everone