100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached 4.6 TrustPilot
logo-home
Exam (elaborations)

CS225 FINAL MC EXAM QUESTIONS WITH COMPLETE ANSWERS

Rating
-
Sold
-
Pages
38
Grade
A+
Uploaded on
15-01-2026
Written in
2025/2026

CS225 FINAL MC EXAM QUESTIONS WITH COMPLETE ANSWERS ...

Institution
CS225
Course
CS225











Whoops! We can’t load your doc right now. Try again or contact support.

Written for

Institution
CS225
Course
CS225

Document information

Uploaded on
January 15, 2026
Number of pages
38
Written in
2025/2026
Type
Exam (elaborations)
Contains
Questions & answers

Subjects

Content preview

CS225 FINAL MC EXAM QUESTIONS WITH
COMPLETE ANSWERS


int main()

{

int p = 6;

int *q;

q = new int(p);

// here {{#line}}

delete q;

return 0;

}




Suppose that variable q has location 0xdeadbeef, variable p has location 0xcafebabe,and
the memory address of the new int is 0x00bae000.

What is the value of *q at line {{@line}}?




A. None of these.

B. 0xdeadbeef

C. 0x00bae000

D. [Correct Answer] [Your Answer] 6

E. The default value of an integer.

,F. 0xcafebabe - ANSWER D. 6




class Foo

{

public:

Foo();

private:

int bar;

};




Foo::Foo() { bar = 0; }

int main()

{

Foo *x = new Foo();

Foo *y = new Foo(12);

return 1;

}




What is the result when this code is compiled and run?

A. A run time error, because the proper constructor doesn't exist for the assignment to y.

B. No output

,C. A compiler error, because the proper constructor doesn't exist for the assignment to y.

D. The number 1 is printed to the screen.

E. A compiler error, because bar is private.

F. A run time error, because bar is private - ANSWER C. A compiler error, because the
proper constructor doesn't exist for the assignment to y.




What is one way that C++ enforces encapsulation?




A. By convention, the main function is put in a separate file.

B. Creating private member variables and public functions to alter the variables in a
controlled manner.

C. Compilation is orchestrated via a Makefile.

D. By using pointers, rather than - ANSWER B. Creating private member variables and
public functions to alter the variables in a controlled manner.




Suppose you have the following code:




class Milkshake

{

public:

bool awesome;

void setTogo();

, private:

char size;

bool togo;

};




void Milkshake::setTogo() { // code code code }

void serveShake() { // code code code }




int main()

{

Milkshake m;

return 0;

}




Where could the assignment awesome = true; occur?




A. In the setTogo function.

B. In the serveShake function.

C. None of the other options is correct.

D. Only in the constructor if we were to write one.

E. In the main function - ANSWER A. In the setTogo Function.

Get to know the seller

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
Zayla Liberty University
View profile
Follow You need to be logged in order to follow users or courses
Sold
82
Member since
2 year
Number of followers
13
Documents
9337
Last sold
1 month ago

3.4

10 reviews

5
4
4
0
3
3
2
2
1
1

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 tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right 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 aced it. It really can be that simple.”

Alisha Student

Frequently asked questions