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
You put $500 in an interest bearing bank account that pays 2% per year but has a fee of $2 per month. Are you getting ahead?
MA_775_DIABLO [31]
The answer is b) No

2% of 500 is 10.
$10 interest per year.

There are 12 months in a year. $2 per month
2 * 12 = 24
$24 a year is the fee. 

So, if you have a $10 interest per year, but are paying $24 per year on a fee, you are not getting ahead. 


Hope this helps you! (:
-Hamilton1757
4 0
3 years ago
Read 2 more answers
Which computers were the first PCs with a GUI<br> MS-DOS <br> Linux<br> Windows<br> Mac
sergeinik [125]

Answer:

The first computer with a GUI were linux, microsoft and apple.

Explanation:

I think this is right. Hope it helped <3

8 0
3 years ago
Read 2 more answers
What is the primary purpose of the destination address?
ehidna [41]

Answer:

The answer to this question is given below is the explanation section.

Explanation:

"A" option is correct

    It helps the router know where to send the packet.

4 0
3 years ago
Which of the following is not a method of the history object?
Volgvan

Answer:

replace()

Explanation:

The history object in javascript corresponds to browsing history.

It has the following methods for navigating through the history list:

back(): Go back in the history list

forward(): Go forward in the history list

go() : Navigate to the currently pointed url in the history list. It takes a parameter which can either be a numeric index or a string which is matched with the history list content.

replace() is not a method in the history object.

7 0
3 years ago
You work as a network technician for uCertify Inc. You have erased data saved in your laptop. You still have many device configu
zloy xaker [14]

Answer:

Data remanence

Explanation:

Data remanence is the retention of erased data on a magnetic medium. Sensitive detection systems can pick up the residue (remnants) from previously recorded data even though the area has been rewritten.

This is not a simple procedure; however, it is employed if the <u>missing information</u> is related to national defense or some other critical situation

7 0
3 years ago
Other questions:
  • To view the results of a saved query, right-click the query in the Navigation Pane and click ____ on the shortcut menu.
    7·1 answer
  • The smallest unit of time in music called?
    6·2 answers
  • Someone please help me with the right answer please
    13·1 answer
  • Write qbasic code for given pattern<br><br>NEPAL<br>. EPA<br>. P​
    12·1 answer
  • Which event most led to a reduction in the size and cost of computers? a. invention of the Bessemer converter b. development of
    8·2 answers
  • Write a program that declares constants to represent the number of inches, feet, and yards in a mile. Name the constants INCHES_
    6·1 answer
  • Tawni made some changes to her file and wants to save the changes in a document with a different title. How can she do this?
    14·2 answers
  • If opening capital is ks 70000 and closing capital is ks 90000 what is the amount of profit or loss​
    14·1 answer
  • Instruction: weird I know (~ ̄³ ̄)~
    5·1 answer
  • Your connection to this site is not secure how to fix.
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!