M6 CSE240

0.0(0)
studied byStudied by 0 people
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/14

encourage image

There's no tags or description

Looks like no tags are added yet.

Last updated 6:56 PM on 2/6/26
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai

No analytics yet

Send a link to your students to track their progress

15 Terms

1
New cards

What are the key features of object orientation in programming languages? Select all that apply.

Encapsulation of state and Dynamic memory allocation

2
New cards

C++ allows a programmer to create an object through ___________ (Select all that apply)

the "new" operation during execution.

declaration in compilation phase.

3
New cards

Using the principle of information hiding in OOP, in an array-implemented queue class, what members should be declared as “public” members?

enqueue and dequeue functions

4
New cards

The purpose of the scope resolution operator is to allow a function to be

placed outside the class.

5
New cards

What is the key difference between a static variable and a global variable?

They have different visibility.

6
New cards

If a function calls another function, the local variables in these two functions use the memory from

different stack frames.

7
New cards

How is Java's garbage collection implemented?

It uses a reference counter to indicate if an object is still referenced by any variable.

8
New cards

Which C/C++ operations will acquire memory from heap? Select all that apply.

new and malloc

9
New cards

Given the snippet of code:

int x = 5;
int bar(int j) { 
  int *k = 0, m = 5;
  k = &m;
  return (j+m);
}
void main(void) { 
  static int i =0;
  i++;
  i = bar(i) + x; 
}

Which variables obtain their memory from the stack? Select all that apply.

k, m, j

10
New cards

Assume that you want to delete the entire linked list pointed to by head. Which of the following deletion operation will cause the most garbage of memory?


head = NULL;

11
New cards

What is the best way of deleting a linked list of objects in C++?

Use a loop to delete every object in the linked list.

12
New cards

A piece of memory must be explicitly garbage-collected, if it comes from

heap

13
New cards

We need to write a destructor for a class, if 

heap memory is used in the constructor of the class.

14
New cards

What memory must be garbage-collected by a destructor?

heap memory created in the constructors in the same class

15
New cards

What is the best way of deleting all the nodes in a binary tree pointed to by the root pointer?

raverse the tree and delete each node individually.