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
New evidence can lead to a change in scientific knowledge.<br><br> A. True<br> B.False
lidiya [134]

ιт ιѕ (α.) тяυє ιf уσυ fιи∂ иєω киσωℓєgє σи ∂σмєтнιиg ιт ¢αи ¢нαиgє ѕ¢ιєи¢є

ℓιкє нσω тнєу υѕє∂ тσ вєℓινє тнє єαятн ωαѕ fℓαт,σя нσω тнє єαятн ωαѕ тнє ¢єитєя σf тнє υиινєяѕє

нσρє ι ¢συℓ∂ нєℓρ уσυ!!!!!!!!

3 0
3 years ago
Read 2 more answers
What is the Multiple Items tool?
Dmitry_Shevchenko [17]

Explanation:

when a form is created in Microsoft Access using the form tool it displays a single record at a time.To display multiple records and the form should be more customizable then in this case we use Multiple Items tool.

Creating a form using Multiple Items Tool:-

In navigation pane click query or table which contains the data that we want to see on the form.

On create tab,in the group Forms,click more Forms,then click Multiple Items.

6 0
3 years ago
Respond to the following in 2-5 paragraphs. Give an example of how you can demonstrate active listening.
nadezda [96]
Hey my name is ..... and this do the thesis
8 0
3 years ago
How has technology change in film?
Murljashka [212]
With digital technology, the storage method has changed and today it is much easier to handle and transport movies to theatres than in the past. Servers, hard disks and video tapes are being used to store movies and digital projectors are being used to screen them.
6 0
3 years ago
Read 2 more answers
Which of the following could be omitted from a company's AUP? A.Permissible lunchtime online activities B.Employees' home email
joja [24]

Answer:

i think the answer is D

Explanation:

a , b , and c are things customers need to know . but using common sense would let you know that you need to have a strong password so i think it's D! let me know if this helped!

3 0
3 years ago
Read 2 more answers
Other questions:
  • You can create a ____ partition to hold files that are created temporarily, such as files used for printing documents (spool fil
    11·1 answer
  • You are using a crimper to attach an RJ-45 connector to a Cat 6 UTP cable. You need to use the T568A standard to connect the ind
    6·1 answer
  • How many words fit on a double-spaced page?
    11·1 answer
  • Write a program which capitalize every character after full stopin a given sentence
    11·1 answer
  • Which components exist in the contextual tab for tables called Design? Check all that apply. Table Styles Export Table Data Prop
    11·2 answers
  • What is the point of brainy when other people have to answer your questions but not the cumputer
    9·1 answer
  • Which orientation style has more height than width?
    11·1 answer
  • Write a pseudocode algorithm that prompts the user to enter a three-digit number and outputs the hundreds, tens and units.
    6·1 answer
  • Identify the following verb by number and person by checking on the appropriate boxes.
    15·2 answers
  • What is the name of the method generated when you double-click a button named btnprocess in the form designer?
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!