1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
sashaice [31]
3 years ago
9

What is stored in str after the following code executes?

Computers and Technology
1 answer:
uranmaximum [27]3 years ago
6 0

Answer:

"CoCoComputer Science"

Explanation:

First let's understand how the loop works, then we'll see what it does.

The variable i is initialized to value 0.  Then inside the loop, it's incremented by 2 in each loop passage, while i < 8, so the loop will be processed with the following values of i: 0, 2, 4 and 6.  It will run a total of 4 times.

Let's examine the actions done during the FIRST loop:

(str equals "Computer Science", so indexOf('m') = 2, i = 0)

- if the index of 'm' within the string is < i  (index = 2, i = 0, FALSE)

does nothing

increases value of i by 2 (now i = 2)

Let's examine the actions done during the SECOND loop:

(str equals "Computer Science", so indexOf('m') = 2, i = 2)

- if the index of 'm' within the string is < i  (index = 2, i = 2,  FALSE)

does nothing

increases value of i by 2 (now i = 4)

Let's examine the actions done during the THIRD loop:

(str equals "Computer Science", so indexOf('m') = 2, i = 4)

- if the index of 'm' within the string is < i  ( index = 2,  i = 4, TRUE)

then str becomes "CoComputer Science"

increases value of i by 2 (now i = 6)

Let's examine the actions done during the FOURTH loop:

(str equals "CoComputer Science", so indexOf('m') = 4, i = 6)

- if the index of 'm' within the string is < i  (index = 4,  i = 6, TRUE)

then str becomes "CoCoComputer Science"

increases value of i by 2 (now i=8)

Loop ends because i = 8 (i < 8 becomes false)

You might be interested in
Original documents or objects used during Internet research are known as
S_A_V [24]
Tbh i think its primary
8 0
3 years ago
Read 2 more answers
Can someone please help me with this
inessss [21]

the first question answer is true

the second question answer is true

please brainliest me i just took the test so i know those 2 answers are correct!

3 0
3 years ago
In<br>6) which device can not be shared<br>network?​
SCORPION-xisa [38]

Answer:

mouse cannot be shared on network

6 0
3 years ago
Plz I’ll mark Brainliest
artcher [175]

Answer:

It's B cuz if somehow the power went off your work won't be saved. So it's best to save your work frequently.

6 0
3 years ago
when the programmers embed a javascript code within html code they place the javascript code between​
taurus [48]
<h3>When the programmers embed a javascript code within html code they place the javascript code between</h3>

Answer: They place the javascript code between a pair of <script> and </script> tags, inside HTML documents.

\textit{\textbf{Spymore}}​

3 0
3 years ago
Read 2 more answers
Other questions:
  • When you right-click a spreadsheet object, what command should you select to activate the sheet?
    6·2 answers
  • What was the treaty of the Meter
    13·1 answer
  • If a method writes to a file it should start out like (fill out the blank, what should you write after the parameters in the met
    12·1 answer
  • If you use the ___ template, as opposed to a formatted theme, you must make all design decisions?
    15·1 answer
  • Why might you need to convert a file to another file type?
    14·1 answer
  • A persons decision to take action without being asked is
    9·1 answer
  • A type of backlight technology most commonly used in modern laptop devices is called____________.
    9·1 answer
  • What are the correct steps to find the system specifications such as the amount of RAM or system type?
    13·1 answer
  • Write a VB program to convert a temperature from Celsius to Fahrenheit and vice versa.
    15·1 answer
  • Catherine purchased dried herbs from the grocery store. Which structure would she use if wanted to create a mixture of powdered
    8·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!