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
What is incorrect about the following code? Suggest a possible revision of the code to correct the error.
Ad libitum [116K]
This is really cool but no one cares
5 0
2 years ago
Which of the following tasks requires you to use the Tabs option?
Monica [59]
Indenting a paragraph :)
7 0
3 years ago
The Quake, One of the first fully 3D games was released in the year? 1986 1996 1995​
kipiarov [429]
It was released in 1996
5 0
3 years ago
Which of the following is true about ISO___________.
Svetach [21]

Answer:

The answer is "Option d".

Explanation:

In the given question in option b and option c, there is some typing mistake, but all the options are correct.

ISO is an organization, that is based on Geneva, which is a member of Switzerland. It provides one of the major guidelines for developing entities, that provides technical suggestions on frameworks for data communication.

  • It is used to optimize products with businesses across ranges.
  • The primary aim was to facilitate trade, but in several ways, it focus on enhancing procedures, safety, and quality.
3 0
2 years ago
Which of these is a historic real-world simulation game?
harkovskaia [24]

Answer:

B. Archery

Explanation:

the art, practice, or skill of shooting with bow and arrow

7 0
2 years ago
Other questions:
  • Write a program that takes in a line of text as input, and outputs that line of text in reverse. The program repeats, ending whe
    12·1 answer
  • What is the slide sorter view used for?
    11·1 answer
  • In Java
    6·1 answer
  • Consider the following code which deletes all the nodes in a linked list. void doublyLinkedList::destroy() { nodeType *temp; //p
    14·1 answer
  • Where do players resurrect if they have been destroyed in a game?
    13·1 answer
  • Name:
    11·1 answer
  • It is a data being transported on a network​
    13·1 answer
  • In English there are five vowel letters in the alphabet: A, E, I, O, U. For the purposes of this exercise we won't count Y as a
    5·1 answer
  • Convertbinary(111100)to decimal​​​​
    13·2 answers
  • The users, groups, and roles that have access to a server are called ______________________________.
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!