100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached
logo-home
cs 161Final Exam Study Questions with Correct Verified Answers $13.24   Add to cart

Exam (elaborations)

cs 161Final Exam Study Questions with Correct Verified Answers

 1 view  0 purchase
  • Course
  • Cs 161
  • Institution
  • Cs 161

cs 161Final Exam Study Questions with Correct Verified Answers

Preview 3 out of 27  pages

  • September 7, 2024
  • 27
  • 2024/2025
  • Exam (elaborations)
  • Questions & answers
  • Cs 161
  • Cs 161
avatar-seller
KenAli
cs 161Final Exam Study Questions with
Correct Verified Answers
Three primary activities of a program are:
A. Variable definitions, operators, lists of key words
B. Lines, statements, punctuation
C. Input, processing, output
D. Integer, floating-point, character definitions - ANSWER C. input, processing, output


A variable's __________ is the part of the program that has access to the variable.
A. Scope
B. Value
C. Data type
D. Assignment - ANSWER a.scope


What is the output of the following statement?


cout << (float) (5 * (9 % 4) / 2) + 2.5 << endl;


A. 5
B. 15
C. 2.5
D. 4.5 - ANSWER D. 4.5

,What will be the output after the following lines of code execute?
bool choice;
choice = true;
cout << "Your choice is " << choice << endl;
A. true
B. Your choice is true
C. Your choice is 1
D. Your choice is choice - ANSWER C. Your choice is 1


A character literal is __________, whereas a string literal is __________.

A. enclosed in quotation marks, enclosed in brackets
B. enclosed in brackets, enclosed in quotation marks

C. enclosed in double quotation marks, enclosed in single quotation marks

D. enclosed in single quotation marks, enclosed in double quotation marks - ANSWER
D.enclosed in single quotation marks, enclosed in double quotation marks


Which of the following is not a valid C++ identifier?
A. April2019
B. employee_num
C. _2user
D. 2user - ANSWER d. 2user


Given that x = 2, y = 1, z = 0, what will the following cout statement display?
cout << "answer = " << (x && y && !z) << endl;
A. answer = 0

B. answer = 1

, C. answer = 2
D. answer = (x && y && !z) - ANSWER B. Answer = 1


When a variable is assigned a number that is too large for its data type, it
A. underflows
B. overflows
C. reverses
D. converts - ANSWER b. overflows


After the following code executes, what is the value of my_value if the user enters 3?
cin >> my_value;
if (my_value > 2)
my_value = my_value + 5;
else if (my_value > 5)

my_value = my_value + 10;
else
my_value = my_value + 20; - ANSWER c. 8


What is the output of the following segment of code if the value 4 is input by the user?

int num;
int total = 0;
cout << "Enter a number from 1 to 10: ";
cin >> num;
switch (num) {
case 1:
case 2: total = 5;
case 3: total = 10;

The benefits of buying summaries with Stuvia:

Guaranteed quality through customer reviews

Guaranteed quality through customer reviews

Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.

Quick and easy check-out

Quick and easy check-out

You can quickly pay through credit card or Stuvia-credit for the summaries. There is no membership needed.

Focus on what matters

Focus on what matters

Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!

Frequently asked questions

What do I get when I buy this document?

You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.

Satisfaction guarantee: how does it work?

Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.

Who am I buying these notes from?

Stuvia is a marketplace, so you are not buying this document from us, but from seller KenAli. Stuvia facilitates payment to the seller.

Will I be stuck with a subscription?

No, you only buy these notes for $13.24. You're not tied to anything after your purchase.

Can Stuvia be trusted?

4.6 stars on Google & Trustpilot (+1000 reviews)

80364 documents were sold in the last 30 days

Founded in 2010, the go-to place to buy study notes for 14 years now

Start selling
$13.24
  • (0)
  Add to cart