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
Wittaler [7]
3 years ago
14

Nested if-else structures can contain many blocks of code. How many of those blocks of code might be executed?

Computers and Technology
1 answer:
dezoksy [38]3 years ago
7 0

Answer:            

A nested if else structure is defined as using one if-else inside another one. It is used when you want a take a decision by checking several conditions. Nested if can contain many block of codes with each block executing if the certain condition is met for each of that block.

The number of blocks of code, that might be executed depends on the condition that is intended to be met, in order to take a certain decision based on that condition. Let suppose if the desired condition is met in the very first block of code then only one block of code is executed. For example consider the following code:

if(number<5)

{  if(number==1)  {

  cout<<"number is 1"<<number; }

 else

 {       cout<<"number is greater than 1"<<number; } }

       else

      {         cout<<"number is greater than 5";}

Suppose the number entered is 1. So the first nested if condition is true and number is 1 will be displayed. So none of the else blocks has to be executed.

Number of code blocks that might be executed also relies on the number of block present in the code.

The execution also depends on the number of blocks that are true or false. If you want to execute a block for true condition, nested if else looks through every block until the block with the true desired condition is reached but if you want false condition to be checked to display the block of code when condition gets false then it will look through all the blocks until it gets the block with that false part.

For example consider the following code:

if ( number > 0)

   {        cout << "its a positive number: " << number;    }

   else if (number < 0)

   {         cout<<"its a negative integer: " << number;    }

   else     {

            cout << "its a 0";   }

Suppose the number is 0 and the program has to sequentially checks for each condition. It will check number>0 which is not what we need, then it will check else if statement for number<0 which is again not desired and finally it will display the block "its a 0" which matches the desired condition.

You might be interested in
When an ethernet nic has been configured by os to use half-duplex, the transmit pair of the twisted-pair cable uses?
Maurinko [17]
Simplex, simplex, and half duplex.

Hope this helps!!
8 0
3 years ago
Keystroke loggers are stealth software packages that are used to monitor keyboard activities. Which is the best location to plac
irina [24]

Answer: Keyboard hardware & the operating system

Explanation:Keystroke loggers is also referred as the monitoring system which is a for the inspection of the every key pressed on an operating system. This technology monitors the activities of keypad devices such as smart phones etc. It is also used for the surveillance of the unauthorized activities that are done by the hackers or criminals.

Thus the correct option is keyboard hardware and the operating system is the location of the placement of the key loggers.

7 0
3 years ago
A loop that will output every other name in the names list.
Nuetrik [128]

Answer:

names = ['Peter', 'Bruce', 'Steve', 'Tony', 'Natasha', 'Clint', 'Wanda', 'Hope', 'Danny', 'Carol']

numbers = [100, 50, 10, 1, 2, 7, 11, 17, 53, -8, -4, -9, -72, -64, -80]

for index, element in enumerate(names):

if index % 2 == 0:

 print(element)

for num in numbers:

 if num >= 0:

   print(num, end = " ")

count = 0

for i in numbers:

 count += i

avg = count/len(numbers)

print("sum = ", count)

print("average = ", avg)

for num in numbers:

 if num % 2 != 0:

   print(num, end = " ")

Explanation:

I'm stuck on the last two.. I have to do those too for an assignment.

4 0
3 years ago
Match the image to its type.
boyakko [2]

Warm Colors:

  • <em>Red</em> flowers
  • Oranges

Cool Colors:

  • <em>Blue </em>skies
  • <em>Purple</em> butterflies

Neutral Colors:

  • <em>Brown</em> wood
  • <em>White</em> birds

Reds, oranges, and yellows are considered warm, and greens, teals, blues, and purples are considered cool. Colors such as white, black, brown, or gray are all neutral.

3 0
3 years ago
A newspaper publishes a negative editorial on how local politicians are dragging their feet in building a new bridge. Select the
jeka57 [31]
Your answer would be
A. The editorial is data.
I just took this test :)
6 0
3 years ago
Read 2 more answers
Other questions:
  • A _____________ is a method of controlled entry into a facility and provides access to secure areas such as a research lab or da
    10·1 answer
  • John would like to move from the suburbs into the city, but the rent in the city is very high. John has found an apartment he re
    13·1 answer
  • What can be entered in a search box to find data? data size a name relevance purpose
    5·2 answers
  • Okay so remember that page I was advertising? At: fol ? Now it's deleted. And idk why because I was doing everything the right w
    7·1 answer
  • In a Windows environment, __________ is a powerful tool that enables security administrators to share user and group definitions
    10·1 answer
  • Complete the sentence to identify advantages of top-down programming design. Choose all that apply.
    15·2 answers
  • print out the last even number from an array of integers, if there is no even number, then print out a sentence indicating so.
    5·1 answer
  • Which of the following is not a key way that a LAN shares
    15·1 answer
  • DO NOT ANSWER FOR JUST POINTS
    8·2 answers
  • There is a file of a few Sean Connery movies on the internet. Each entry has the following form:
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!