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
Document preview thumbnail
Preview 4 out of 67 pages
Exam (elaborations)

Palomar College CSCI 222 Quiz_ Final Exam (MC option) Questions_ 2025/26.

Document preview thumbnail
Preview 4 out of 67 pages

Palomar College CSCI 222 Quiz_ Final Exam (MC option) Questions_ 2025/26.

Content preview

Final Exam (MC option)
Started: May 22 at 3:12pm

Quiz Instructions





Canvas Support
This test is open book and open notes. You have 6 hours to complete the exam in one sitting.
Once you start the exam, the clock on Canvas will start clicking, so make sure that you allocated
a continuous 6-hour block for the exam.

You may use your textbook, homework, labs, lectures, etc.. Exam is due back via Canvas before





midnight May 27, 2025.

This test is all multiple choice.


Question 1 1 pts
Which of the following hides the implementation details of the data members and member functions
within a class?

Virtualization


Inheritance


Abstraction


Encapsulation

Question 2 1 pts
How can you traverse from one node to another in a list<string> ?

By using a pointer to a list<string> object


By using an integer index


By using an iterator


By using a pointer to a node<string> object


Question 3 1 pts

Given a class Name with member functions get_first and get_last , which of the following functions
overloads < < so that one can print a name as

, stream << name << endl;



void operator<<(ostream& out, const Name& name)
{
out << name.get_first() << " " << name.get_last();





}




Canvas Support
ostream& operator<<(ostream& out, const Name& name)
{
return out << name.get_first() << " " << name.get_last();
}





ostream& operator<<(const Name& name, ostream& out)
{
return out << name.get_first() << " " << name.get_last();
}




ostream& operator<<(ostream& out, const Name& name)
{
return cout << name.get_first() << " " << name.get_last();
}



Question 4 1 pts
What is the correct function prototype to implement an equals comparison operation for a class such as
Time ?

bool operator==(Time a, Time b)


bool ==(Time a, Time b)


void ==(Time a, Time b)


void operator==(Time a, Time b)


Question 5 1 pts

What is the problem with the following code snippet, which is attempting to locate the first element in the
list names ?

list<string> names;
...
string first = names[1];

,You need to first check that the size of names is at least 2.


It is not legal to use the [] operator with a list<string> object.





There is no problem with the code snippet.




Canvas Support
The first element will be located by using names[0] .

Question 6 1 pts





What is the output of the following code snippet?

class Building
{
public:
void set_height(double count);
void get_data() const;

private:
double height;
};
void Building::get_data() const
{
cout << height << endl;
}
void Building::set_height(double count)
{
height = count;
}
int main()
{
Building blg1, blg2;
blg1.set_height(150);
blg2.set_height(100);
blg1.get_data();
blg2.get_data();
return 0;
}




150

100



100

150

, 150

250





Canvas Support
150

150


Question 7 1 pts





What operator must be overloaded if you want to use the standard library sort with a class such as
Time ?


>


==


All of these


<


Question 8 1 pts
How can you locate the ninth node in a doubly-linked list named items ?

Start at the first node and follow pointers to the next node in the list until the ninth node is located.


items[9]


items[10]


items[8]


Question 9 1 pts

Which is true about the following operator < < function intended to read in a Time object as in

Time t; stream >> t;
istream& operator>>(istream& in, Time a)
{
int hours, minutes;
char separator;
in >> hours;
in.get(separator); // Read : character
in >> minutes;
a = Time(hours, minutes);

Document information

Uploaded on
November 8, 2025
Number of pages
67
Written in
2025/2026
Type
Exam (elaborations)
Contains
Only questions
$11.79

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

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.
MindCraft
3.8
(49)
Sold
381
Followers
9
Items
2818
Last sold
8 hours ago



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

Working on your references?

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

Working on your references?

Frequently asked questions