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
What is the difference between coding with html and coding with python
dsp73

Answer:

Python is an object-oriented programming language that is designed to be accessible and simple for all users, HTML is a web language and is used globally to define the structure of web pages by using various tags. HTML is not a programming language it's a markup language which is used to formatting web pages. Python is a general purpose scripting language which can be used to develop a wide range of programs.

5 0
2 years ago
Linda is the owner of Souvenirstop, a chain of souvenir shops. One of the shops is located at the City Centre Mall. Though the s
Klio2033 [76]

Answer:

attraction and attention

6 0
3 years ago
Which of the following is applicable during a hostile act:
Elanso [62]
Your question has been up too long, a moderator may have to delete it.
we will contact moderators to find your question and remove it, and hopefully, they will refund the points, which is not up to me.
<span>thank you for using brainly.</span>
3 0
2 years ago
Which of the following statements best compares and contrasts the role of editors in a television news room and editors at a new
nexus9112 [7]

Answer: It is A

Explanation:

7 0
2 years ago
What's the biggest security issue with using social networking sites to market your listings?
Savatey [412]

The biggest security issue with using social networking sites to market your listings is Criminals may use social networking sites to identify your personal data.

<h3>What is a social marketing site?</h3>

A social marketing site is a site where people from around the world are connected in one place and share their thoughts and photos and other data.

The social sites are on the internet and there is a chance of stealing data and it identity theft, phishing, online predators, internet fraud, and other cybercriminal attacks are also some risks.

Thus, the largest security concern with using social networking sites to sell your listings is that thieves could use these sites to find personal information about you.

To learn more about social marketing sites, refer to the link:

brainly.com/question/15051868

#SPJ4

6 0
1 year ago
Other questions:
  • What is the difference between pulse code modulation and delta modulation? Provide examples.
    11·1 answer
  • _________ is critical to Amazon's success.<br><br> SCM<br><br> JIT<br><br> ERP<br><br> VMI
    9·1 answer
  • 2. Use inheritance to create a hierarchy of Exception classes -- EndOfSentenceException, PunctuationException, and CommaExceptio
    6·1 answer
  • What are computer crimes?​
    14·1 answer
  • Set screw compression and indenter are all types of
    13·2 answers
  • Im lonnnelllly........................who want to date
    11·1 answer
  • Help asap dont answer with a link​
    11·1 answer
  • Computer Hardware can consist of a
    13·1 answer
  • Can anyone figure this out???? I need help ASAP!
    8·1 answer
  • You must configure a certificate authority on your network to use EFS. True or False?
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!