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
To maintain audience interest in a multimedia presentation, use animations or transition features to control when objects or tex
ira [324]

Answer:

True

Explanation:

A "multimedia presentation" refers to a presentation that uses <em>texts, images, audios, animations, photographs and the like </em>in order to help a particular set of audience understand. The presenter's ideas become clear because the audience can deeply grasp the meaning through different graphics and colors presented.

So, <em>the answer above is definitely true</em> because using animations or transitions figures to control when objects or texts appear can <u>prevent boredom</u> on the end of the audience. This will spark interest on their end.

However, it is important not to overdo it because this will cause further distraction that will divert your audience's attention. It should also be <u>conservative and consistent.</u>

4 0
3 years ago
Find the double word-length 2's complement representation of each of the following decimal numbers:a. 3874
miss Akunina [59]

Answer:

-3874₁₀ = 1111 1111 1111 1111 1111 1111 1101 1110₂

Explanation:

2's complement is a way for us to represent negative numbers in binary.

To get 2's complement:

1. Invert all the bits

2. Add 1 to the inverted bits

Summary: 2's complement = -N = ~N + 1

1. Inverting the number

3874₁₀ = 1111 0010 0010₂

~3874₁₀ = 0000 1101 1101₂

2. Add 1 to your inverted bits

~3874₁₀ + 1 = 0000 1101 1101₂ + 1

= 0000 1101 1110₂

You can pad the most signigicant bits with 1's if you're planning on using more bits.

so,

12 bits                          16 bits

0000 1101 1110₂  = 1111 0000 1101 1110₂

They asked for double word-length (a fancy term for 32-bits), so pad the left-most side with 1s' until you get a total of 32 bits.

           32 bits

= 1111 1111 1111 1111 1111 1111 1101 1110

7 0
3 years ago
Which of the following does NOT help a user navigate through a document?
FromTheMoon [43]

Answer:

Navigation Tabs

Explanation:

Navigation tab is used to switch between different pages that are shown in navigation tab. It is not used to navigate through the document.

Scroll bar is used to navigate through the document line by line. It has been shown on the right side of the document to move up and down the page.

Next page and previous page button used to navigate between pages of the documents.

7 0
3 years ago
Nikki sent flyers in the mail to all houses within the city limits promoting her computer repair service what type of promotion
Jlenok [28]

Direct marketing (APEX)


6 0
3 years ago
Read 2 more answers
Show how to define a view tot_credits (year, num_credits), giving the total number of credits taken by students in each year
andreev551 [17]

Hi! I'm a Digital Marketer Intern at hotels.ng and I have a moderate knowledge on programming.

First, your  question is not very explanatory. The term "view" is often used in back-end web development. A view is simply a Python function that takes a Web request and returns a Web response.

But I'm not sure this is what you want, so I'll just go ahead and write a python function involving class to return the total number of credits taken by a student.

I'll answer this question using Python.

class student(object):  

    credits = None

    year = None

    def num_credits(self):


       #get credit value

       self.credits = input("Enter the total number of credits: "  )


       pass

    def getYear(self):

        self.year = input("Enter current year: ")

        pass

    def tot_credits(self):

          TotalCredits = tempTotalCredits + self.num_credits

           print "Your  total credits are :"+" "+str(TotalCredits)




3 0
3 years ago
Other questions:
  • Click to move a stacked object to the top of the stack?
    8·1 answer
  • Design and implement your own simple class to represent any household item of your choice (toaster, fan, hair dryer, piano ...)
    11·1 answer
  • Use a VLOOKUP function in cell I5 to identify and calculate the federal withholding tax. Use the tax rates from the range D21:E2
    15·1 answer
  • Write a program that calculates the amount of money the salesperson will earn from selling discount cards. java program
    8·1 answer
  • How are programs and algorithms related? A program is a part of an algorithm. They are not connected at all. An algorithm is a p
    12·1 answer
  • The act of illegally copying software, music,or movies that are copied protect?
    7·2 answers
  • I need help so bad it’s the entire test for EdHesive python coding Test 2
    5·1 answer
  • AYUDAAA ESPARA HOYYY
    14·2 answers
  • How to stop sharing location without them knowing imessage.
    7·1 answer
  • Which actions represent parody?
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!