Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Other

CS 2 Exam Review

Rating
-
Sold
-
Pages
3
Uploaded on
06-12-2025
Written in
2025/2026

CS 2 Exam Review Notes

Institution
Module

Content preview

1. You are asked to design a function that removes duplicates from a
singly linked list. In plain English describe how you could break this
problem down into simpler subtasks before writing code.
2. The definition of the ‘new’ operator
3. Which XXX will avoid a memory leak:

#include <iostream>

Using namespace std;

Class myClass{

Public:

myClass();

int value;

private:

int* ptr;

};

myClass::myClass(){

ptr = new int;

*ptr = 0;

Delete ptr;

}

Int main(){

Int value = 100;

Int* ptr = new int;

///XXX

Ptr1 = &value;

4. Which statement properly frees the dynamically allocated array below:
a. Musketeer* musketeers = new Musketeer[8];
5. You have the following doubly-linked list. Each node has a data(char),
as well as prev and next Node pointers. Create a new Node with the
value ‘z’ and replace thisNode with your new Node. For this exercise,
you will not overwrite thisNode’s data. Instead, you will connect your

Written for

Institution
Module

Document information

Uploaded on
December 6, 2025
Number of pages
3
Written in
2025/2026
Type
OTHER
Person
Unknown

Subjects

£7.09
Get access to the full document:

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Get to know the seller
Seller avatar
susie3

Get to know the seller

Seller avatar
susie3 Utrgv
Follow You need to be logged in order to follow users or courses
Sold
-
Member since
6 months
Number of followers
0
Documents
1
Last sold
-

0.0

0 reviews

5
0
4
0
3
0
2
0
1
0

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their exams and reviewed by others who've used these revision notes.

Didn't get what you expected? Choose another document

No problem! You can straightaway pick a different document that better suits what you're after.

Pay as you like, start learning straight away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and smashed it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions