• Wrong document? Swap it for free
  • Written by students who passed
  • Immediately available after payment
  • Read online or as PDF
Sell
Where do you study
Your language
Document preview thumbnail
Preview 2 out of 7 pages
Exam (elaborations)

Problem set 11 - ubc 2023 - cpsc 110

Document preview thumbnail
Preview 2 out of 7 pages

Problem set 11 - ubc 2023 - cpsc 110

Content preview

UBC 2024-CPSC 121 Review
Study online at https://quizlet.com/_gabqt9
1. Which among the following statements will produce this output on screen?
Select all that apply.

Tell me who your friends are,
and I'll tell you mine!

a) cout << "Tell me who your friends are," << endl << "and I'll tell you mine!";
b) cout << "Tell me who your friends are";
cout << "and I'll tell you mine!";
c) cout << "Tell me who your friends";
cout << "are,\nand I'll tell you mine!";
d) cout << "Tell me who your friends are," << endl;
cout << "and I'll tell you mine!";: a, c, d
2. Why does the code below fail to compile?

#include <iostream>
using namespace std;
int main ()
{
cout << "\"I'm here", John said" << endl;
return 0;
}

The code's expected output is shown below:
"I'm here", John said

Select one:
a) The " after the word here in the code incorrectly terminates the string.
b) There are no errors in the code and it produces the expected output.
c) The \" before the word I'm in the code in unnecessary.
d) The " after the word said in the code needs to be escaped (replace with \")
to properly terminate the string.: a
3. Identify the type of literal below.

"algorithm": string literal
4. Identify the type of literal below.

'Z': character literal

1/7

, UBC 2024-CPSC 121 Review
Study online at https://quizlet.com/_gabqt9
5. Identify the type of literal below.

"121": string literal
6. Identify the type of literal below.

121: integer literal
7. Identify the type of literal below.

2018.09: floating-point literal
8. Identify the type of literal below.

5: integer literal
9. Why is the identifier below identify a C++ variable name? Select all that
apply.

4th_Section#2

Select one or more:
a) It starts with a number.
b) It contains uppercase characters.
c) It contains a # symbol.
d) It contains a _ symbol.: a, c
10. What will be the result of the following relational operation? Assume that
age is 20.

age >= 18

Select one:
a) true
b) false: a
11. Identify whether the following statements perform promotion or demotion.

cout << 4.0/3 << endl;: promotion
12. Identify whether the following statements perform promotion or demotion.

double cash = 1000;: promotion
13. Identify whether the following statements perform promotion or demotion.

int age = 15.6;: demotion
2/7

Document information

Uploaded on
December 6, 2025
Number of pages
7
Written in
2025/2026
Type
Exam (elaborations)
Contains
Questions & answers
$11.99

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.
eduustudent
3.0
(4)
Sold
21
Followers
0
Items
1767
Last sold
1 week 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