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

Exam (elaborations)

cs 161 Exam 2|Questions with Correct Verified Answers

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

cs 161 Exam 2|Questions with Correct Verified Answers

Preview 3 out of 24  pages

  • September 7, 2024
  • 24
  • 2024/2025
  • Exam (elaborations)
  • Questions & answers
  • Cs 161
  • Cs 161
avatar-seller
KenAli
cs 161 Exam 2|Questions with Correct
Verified Answers

Mistakes that allow a program to run, but cause it to produce erroneous results are called
a) logic errors.
b) syntax errors.
c) linker errors.
d) compiler errors.
e) none of the above. - ANSWER A


#include <iostream> is an example of a(n)
a) I/O statement.
b) stream directive.
c) comment.
d) preprocessor directive.
e) compiler option. - ANSWER D



Suppose str = " Hello There. ". The output of the
statement cout << str.size() << endl;
is ____.

a) 11
b) 12
c) 13

,d) 14 - ANSWER D


Before a variable in C++ is used, it must be
a) created
b) initialized
c) used in some expression
d) begin with a capital letter

e) contain only letters, digits and underscores - ANSWER A


A function prototype is ____.
a) a definition, but not a declaration
b) a declaration and a definition
c) a declaration, but not a definition
d) a comment line
e) None of the above - ANSWER C


What is the output of the following C++ code?
count = 1;
num = 25;
while (count < 25)
{
num = num - 1;
count++;
}
cout << count << " " << num << endl;
a) 24 0
b) 24 1

, c) 25 0
d) 25 1
e) None of the above - ANSWER D


Assume this code fragment is embedded in an otherwise correct and complete program. What

should be the output from this code segment?
int main() {

for( int i = 0; i < 10; i++)
{

cout << "hello" << endl;
}
cout << i << endl;

return 0;
}
a) 10
b) 9
c) 0
d) The variable i is undefined in this scope, so this should not compile - ANSWER D


Which control construct repeats a sequence of statements one or more times?
a) while statement
b) do-while statement
c) switch statement
d) if-else statement
e) none of the above - ANSWER B


Which of the following is not true of the || operator?

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)

79271 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