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 was Ada Lovelace's contribution to computer science?
Alika [10]

Answer:

She made the first computer.

Explanation:

Augusta Ada King, Countess of Lovelace (née Byron; 10 December 1815 – 27 November 1852) was an English mathematician and writer, chiefly known for her work on Charles Babbage 's proposed mechanical general-purpose computer, the Analytical Engine.

8 0
2 years ago
Read 2 more answers
"what do you perform when you want to recall specific records from a database"
Ivan
A select query


select column1, column2, columnN
from table
where condition
order to be pretty;
5 0
3 years ago
A security administrator is reviewing the following information from a file that was found on a compromised host: Which of the f
Roman55 [17]

Answer:

C. Trojan

Explanation:

In Cybersecurity, vulnerability can be defined as any weakness, flaw or defect found in a software application or network and are exploitable by an attacker or hacker to gain an unauthorized access or privileges to sensitive data in a computer system.

This ultimately implies that, vulnerability in a network avail attackers or any threat agent the opportunity to leverage on the flaws, errors, weaknesses or defects found in order to compromise the security of the network.

In this scenario, a security administrator is reviewing the following information from a file that was found on a compromised host: "cat suspiciousfile.txt."

Some of the ways to prevent vulnerability in a network are;

1. Ensure you use a very strong password with complexity through the use of alphanumerics.

2. You should use a two-way authentication service.

3. You should use encrypting software applications or services.

8 0
2 years ago
Which argument forces a writer to return to and change the input before resolving a “UnicodeError”?
garri49 [273]

Answer:

B

Explanation:

3 0
3 years ago
Q: Why can't I log in to Brainly
algol13

Answer:

yes you are probably on a school Chromebook

Explanation:

5 0
3 years ago
Other questions:
  • Whereas lines of competition are clearly defined in the more established industries, in the Internet industry they are blurred a
    9·1 answer
  • What is an independent data mart?
    8·1 answer
  • What are pixels? A. Objects that are part of a particle system B. Tiny colored dots that make up images and text on a computer s
    9·1 answer
  • 2.2-2 Consider sorting numbers stored in array by first finding the smallest element n A of and exchanging it with the element i
    11·1 answer
  • Suppose you are on a desert island and possess exactly 20 coconuts your neighbor Friday is a fisherman and he is willing to trad
    14·1 answer
  • Follow me on Tik-Tok​
    7·2 answers
  • Which statements accurately describe the Outlook interface? Check all that apply.
    7·1 answer
  • Which properties would be useful to know to search for a Word document? Check all that apply.
    7·1 answer
  • When a company sends you recommendations of what to buy you know that :
    12·1 answer
  • How can I master networking my home/business computer(s) - Tv's - iot devices and make the whole system as secure as possible?
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!