100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached
logo-home
COP 2258 EXAM 2 Question and answers rated A+ 2024 $13.49   Add to cart

Exam (elaborations)

COP 2258 EXAM 2 Question and answers rated A+ 2024

 4 views  0 purchase
  • Course
  • COP
  • Institution
  • COP

COP 2258 EXAM 2 Question and answers rated A+ 2024 COP 2258 EXAM 2 After the execution of the following code, what will be the value of num if the input values are 0? (Assume that console is a Scanner object initialized to the standard input device.) int num = Int(); if (num > 0) n...

[Show more]

Preview 2 out of 12  pages

  • September 6, 2024
  • 12
  • 2024/2025
  • Exam (elaborations)
  • Questions & answers
  • COP
  • COP
avatar-seller
flyhigher329
COP 2258 EXAM 2
After the execution of the following code, what will be the value of num if the
input values are 0? (Assume that console is a Scanner object initialized to the
standard input device.)




int num = console.nextInt();


if (num > 0)
num = num + 13;
else
if (num >= 3)
num = num + 15; - correct answer ✔0


What is the output of the following Java code?




int x = 0;
if (x > 0)
System.out.println("positive ");
System.out.print("zero ");
System.out.println("negative"); - correct answer ✔zero negative


What is the output of the following Java code?

, int x = 57;
int y = 3;


switch (x % 9)
{
case 0:
case 1:
y++;
case 2:
y = y - 2;
break;
case 3:
y = y + 2;
case 4:
break;
case 5:
case 6:
y = y + 3;
}


System.out.println(y); - correct answer ✔5


! - correct answer ✔not


&& - correct answer ✔and
p and q true

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 flyhigher329. Stuvia facilitates payment to the seller.

Will I be stuck with a subscription?

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

Can Stuvia be trusted?

4.6 stars on Google & Trustpilot (+1000 reviews)

75057 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.49
  • (0)
  Add to cart