0% found this document useful (0 votes)
382 views9 pages

CS201P Quiz For Finalterm by Danish Hanif-1

CS201P Quiz For Finalterm .Must do this to get full marks in final.

Uploaded by

asifnlcpress
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
382 views9 pages

CS201P Quiz For Finalterm by Danish Hanif-1

CS201P Quiz For Finalterm .Must do this to get full marks in final.

Uploaded by

asifnlcpress
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

CS201p Final Term Paper Quizzes 2023

LMS Handling Service Available


Premium Earning Classes Starting On My Website
hbdanish.me
Contact: 0323-1731413
Up-to-Date
03-07-2023
1. The statement `char arr[10];` is an example of a type of ____________ memory allocation.
Options:
a) Static
b) Dynamic
c) Null Value
d) Built-in

2. Which function is automatically called when an object of a class is initiated?


Options:
a) Destructor
b) Constructor
c) Friend function
d) Utility function

3. What will be the output of the following code?

```cpp

void sampleFunction(int = 5, float = 4.1, char = 'A');

int main() {
sampleFunction(50, 3.2);
}

void sampleFunction(int one, float two, char three) {


cout << one << ", " << two << ", " << three;
}
```
Options:
a) 50, 3.2, A
b) 5, 4.1, A
c) 50, 4.1, A
d) 5, 3.2, A

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

5. Which is not a preprocessor directive of C-language?


Options:
a) #endif
b) #if
c) #else
d) #startif

6. Representing logical depiction of the solution to the problem is known as a


______________.
Options:
a) Loop
b) Flowchart
c) Structure
d) Sequence

7. _________ is a user-defined data type.


Options:
a) Function
b) Class
c) Constructor
d) Pointer

8. In C++, the default constructor takes _______.


Options:
a) Only two arguments
b) Only one argument
c) No arguments
d) More than two arguments

9. A constructor with arguments is known as __________.


Options:
a) Default Constructor
b) Virtual Constructor
c) Parametrized Constructor
d) Destructor
MCQ 1:
Question: What will be the output of the following code?
```

void sampleFunction(int = 5, float = 4.1, char =

'A'); int main(){ sampleFunction(50, 3.2);

}
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

Correct option: 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>

using namespace std;

int main() {

int i; int &j = i; i = 123;

cout << "The value of i = " <<

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

D) Size of data type

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

D) Public and 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

B) Default and 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()

C) Outside the class

D) Inside the class

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

You might also like