100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached
logo-home
AP Computer Science A Unit 2 Exam Questions and Answers $10.49   Add to cart

Exam (elaborations)

AP Computer Science A Unit 2 Exam Questions and Answers

 7 views  0 purchase
  • Course
  • AP COMPUTER SCIENCE
  • Institution
  • AP COMPUTER SCIENCE

AP Computer Science A Unit 2 Exam Questions and Answers

Preview 1 out of 4  pages

  • July 30, 2024
  • 4
  • 2023/2024
  • Exam (elaborations)
  • Questions & answers
  • AP COMPUTER SCIENCE
  • AP COMPUTER SCIENCE
avatar-seller
millyphilip
AP Computer Science A: Unit 2 Exam Questions and Answers
Consider the following variable declarations.
int a = 5;
int b = 4;
double x = 5;
double y = 4;
Which of the following expressions would evaluate to the number, 1?
1. (int) x / y
2. a / b
3. a % b - Answer -All of them. (1 , 2, and 3)
Consider the following variable declarations.
1. double x = (int) 3.4
2. int y = (int) , 5
3. String z = new String(" ") - Answer -1 and 3
Consider String a below. Which of the following would create a new String with the value, "ram"?
String a = new String ("Java Program"); - Answer -String b = a.substring(9);
Better code will NOT type in a static number to produce words near the end of the String and instead, uses length. Which of the following will result in "ram" in a better way
than #2 did? - Answer -String b = a.substring(a.length()-3);
What special type of data is identified it has methods , unlike primitive data? Another giveaway that this is not primitive data is that variables of this type begin with a capital letter. - Answer -Objects
Consider the code segment below. What is the result that is printed on the screen?
String six = new String ("Question 6");
int find = six.indexOf("q");

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

Will I be stuck with a subscription?

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

Can Stuvia be trusted?

4.6 stars on Google & Trustpilot (+1000 reviews)

73314 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
$10.49
  • (0)
  Add to cart