dynamic memory allocation in C++

dynamic memory allocation in C++

Assessment

Quiz

Computers

University - Professional Development

Practice Problem

Medium

Created by

noore ilahi

Used 54+ times

FREE Resource

Student preview

quiz-placeholder

10 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

The size of both stack and heap remains the same during run time.

True

False

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Dynamic memory in C++ is allocated from which type of memory?

Static

Heap

Stack

Program Code

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Functions and variables use _____ memory when created/accessed in C++.

Heap

Stack

Static

Program code

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Can we allocate memory for the objects dynamically in CPP?

Yes

No

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

In CPP, dynamic memory allocation is done using ______________ operator.

malloc

alloc

new

allocate

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following operator is used to release the dynamically allocated memory in CPP?

delete

remove

free

both b and c

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following is/are valid ways to allocate memory for an integer by dynamic memory allocation in CPP?

int *p = new int(100);

int *p; p = new int; *p = 100;

int *p = NULL; p = new int; *p=100;

Only 1,2

All of the above

Access all questions and much more by creating a free account

Create resources

Host any resource

Get auto-graded reports

Google

Continue with Google

Email

Continue with Email

Classlink

Continue with Classlink

Clever

Continue with Clever

or continue with

Microsoft

Microsoft

Apple

Apple

Others

Others

Already have an account?

Discover more resources for Computers