CS201P Quiz For Finalterm by Danish Hanif-1
CS201P Quiz For Finalterm by Danish Hanif-1
```cpp
int main() {
sampleFunction(50, 3.2);
}
4. In C++, the name of the _________ is the same as that of a class with a preceding tilde
(~) sign. Options:
a) Destructor
b) Constructor
c) Friend function
d) Utility function
}
void sampleFunction(int one, float two, char three) {
cout << one << ", " << two << ", " << three;
}
```
Options:
A) 50, 4.1, A
B) 5, 4.1, A
C) 5, 3.2, A
D) 50, 3.2, A
MCQ 2:
Question: If the memory in the free store is not sufficient enough to fulfill the request,
`malloc()` function returns ________.
Options:
A) 0
B) 1
C) -1
D) NULL
MCQ 3:
Question: In the following code, what will be the output of `i`?
```
#include<iostream>
int main() {
i;
}
```
Options:
A) 012345
B) x
C) 123
D) 321
MCQ 4:
Question: In C++, `sizeof` operator is used to determine ____________.
Options:
A) Number of words
B) Length of string
C) Length of words
MCQ 5:
Question: The data members that are visible only from inside the class and hidden from the
outside are known as:
Options:
A) Public
B) Friend
C) Private
MCQ 6:
Question: Where can we declare a friend function in the class?
Options:
A) Nowhere
B) Main()
C) Anywhere
D) Void
MCQ 7:
Question: Which function is automatically called in C++ if we do not define it in a class?
Options:
A) Parametrized Constructor
C) Inline function
D) Default Constructor
MCQ 8:
Question: Where to put inline function during the frequent calling inside the program from
multiple source files?
Options:
A) Header File
B) Main()
MCQ 9:
Question: Data encapsulation can be achieved through ________.
Options:
A) Pointers
B) Structures
C) Arrays
D) Classes
MCQ 10:
Question: _________ is a user-defined data type.
Options:
A) Function
B) Constructor
C) Class
D) Pointer