Programming  >  STUDY GUIDE  >  Unit 4: lesson 3; Loops and Strings (All)

Unit 4: lesson 3; Loops and Strings

Document Content and Description Below

Evaluate the following code segments and determine what the output would be when the segment were executed. If an error exists in the code segment, indicate with “error” and describe the reason ... for the error. 1. String word = "Wingardium Leviosa"; for(int x = 0; x<word.length(); x+=2) System.out.print( word.substring(x,x+1)); Answer: ______________________ 2. String word = "Expelliarmus"; for(int x = 0; x<=word.length(); x--) System.out.print( word.substring(x,x+1)); Answer: ______________________ 3. String word = "Alohomora"; for(int x = word.length()- 1; x >= 0; x--) System.out.print( word.substring(x,x+1)); Answer: ______________________ 4. String word = "Expecto Patronum"; String build = ""; for(int x = 0; x < word.length(); x++) { String let = word.substring(x,x+1); if (x % 2 == 1) build = build + let; } [Show More]

Last updated: 2 years ago

Preview 1 out of 2 pages

Buy Now

Instant download

We Accept:

Payment methods accepted on Scholarfriends (We Accept)
Preview image of Unit 4: lesson 3; Loops and Strings document

Buy this document to get the full access instantly

Instant Download Access after purchase

Buy Now

Instant download

We Accept:

Payment methods accepted on Scholarfriends (We Accept)

Reviews( 0 )

$6.00

Buy Now

We Accept:

Payment methods accepted on Scholarfriends (We Accept)

Instant download

Can't find what you want? Try our AI powered Search

179
0

Document information


Connected school, study & course


About the document


Uploaded On

Feb 08, 2023

Number of pages

2

Written in

All

Seller


Profile illustration for Book Worm, Certified
Book Worm, Certified

Member since 4 years

30 Documents Sold

Reviews Received
6
0
0
0
0
Additional information

This document has been written for:

Uploaded

Feb 08, 2023

Downloads

 0

Views

 179

Document Keyword Tags

More From Book Worm, Certified

View all Book Worm, Certified's documents »

Recommended For You

Get more on STUDY GUIDE »

$6.00
What is Scholarfriends

Scholarfriends.com Online Platform by Browsegrades Inc. 651N South Broad St, Middletown DE. United States.

We are here to help

We're available through e-mail, Twitter, Facebook, and live chat.
 FAQ
 Questions? Leave a message!

Follow us on
 Twitter

Copyright © Scholarfriends · High quality services·