What are the consequences of writing selection structures to include an unnecessary nested selection structure ?​

Answers

Answer 1

Answer: less efficient code

Explanation:

When a programmer studies the specifications of a problem, then the programmer can then decide if the solution to the problem will require a nested selection structure or not.

One consequences of writing selection structures to include an unnecessary nested selection structure is that it produces a less efficient code.


Related Questions

what was the computer works in binary functions

Answers

Computers use binary - the digits 0 and 1 - to store data. A binary digit, or bit , is the smallest unit of data in computing.

A company is considering making a new product. They estimate the probability that the new product will be successful is 0.75. If it is successful it would generate $240,000 in revenue. If it is not successful, it would not generate any revenue. The cost to develop the product is $196,000. Use the profit (revenue − cost) and expected value to decide whether the company should make this new product.

Answers

Answer:

-16000

Explanation:

Given

P(success) = 0.75

Amount generated on success, X = 240000

P(not successful) = P(success)' = 1 - 0.75 = 0.25

Revenue generated, 0

Product development cost = 196000

Profit = Revenue - cost

When successful ; 240000 - 196000 = 44000

Unsuccessful ; 0 - 196000 = - 196000

x __________ 44000 _____ - 196000

P(x) _________ 0.75 _________ 0.25

The expected value ; E(X) = Σx * p(x)

Σx * p(x) = (44000 * 0.75) + (-196000 * 0.25)

= 33000 + - 49000

= - 16000

Hence, the company should not make the product

Answer:

-16000

Given P(success) = 0.75

Amount generated on success, X = 240000

P(not successful) = P(success)' = 1 - 0.75 = 0.25

Revenue generated, 0

Product development cost = 196000

Profit = Revenue - cost

When successful ; 240000 - 196000 = 44000

Unsuccessful ; 0 - 196000 = - 196000

x __________ 44000 _____ - 196000

P(x) _________ 0.75 _________ 0.25

The expected value ; E(X) = Σx * p(x) Σx * p(x) = (44000 * 0.75) + (-196000 * 0.25) = 33000 + - 49000 = - 16000 Hence, the company should not make the product

Explanation:

edge 2021

The ________ is the most important component in a computer because without it, the computer could not run software. Note: You may use an acronym to respond to this question.

Answers

Answer:

Central processing unit (CPU)

Explanation:

A computer can be defined as an electronic device that is capable of receiving of data in its raw form as input and processes these data into information that could be used by an end user.

The central processing unit (CPU) is typically considered to be the brain of a computer system. It is the system unit where all of the processing and logical control of a computer system takes place.

Hence, the most important component in a computer is the central processing unit (CPU) because without it, it is practically impossible for the computer to run any software application or program.

Additionally, the component of the central processing unit (CPU) that controls the overall operation of a computer is the control unit. It comprises of circuitry that makes use of electrical signals to direct the operations of all parts of the computer system. Also, it instructs the input and output device (I/O devices) and the arithmetic logic unit on how to respond to informations sent to the processor.

Write an ALTER TABLE statement that adds two new columns to the Products table: one column for product price that provides for three digits to the left of the decimal point and two to the right. This column should have a default value of 9.99; and one column for the date and time that the product was added to the database.

Answers

Answer:

ALTER TABLE Products

ADD Products_price float(5,2) DEFAULT 9.99,

ADD Adding_time datetime;

Explanation:

So at first we need to use ALTER TABLE statement, when we use this statement we also need to provide the table name. In this case, i assume it is 'Products'.

Then, as per question, we need to add two columns.

The first one is 'product_price' and it contains decimal points. So, we need to use ADD statement and give a column name like 'Prodcuts_price' and its datatype 'float' because it contains decimal or floating points. so, for 3 digits on the left and 2 digits on the right, it makes a total of 5 digits. So, we need to declare it like this. (5,2) it means a total of 5 digits and 2 after the decimal point. after that, we need to set our Default value using the DEFALUT statement. so DEFAULT 9.99. it will set the default value to 9.99 for existing products.

And for our next column, we give its a name like 'Adding_time' then it's datatype 'datetime' because it will contain date and times.

Consider an array inarr containing atleast two non-zero unique positive integers. Identify and print, outnum, the number of unique pairs that can be identified from inarr such that the two integers in the pair when concatenated, results in a palindrome. If no such pairs can be identified, print -1.Input format:Read the array inarr with the elements separated by ,Read the input from the standard input streamOutput format;Print outnum or -1 accordinglyPrint the output to the standard output stream

Answers

Answer:

Program.java  

import java.util.Scanner;  

public class Program {  

   public static boolean isPalindrome(String str){

       int start = 0, end = str.length()-1;

       while (start < end){

           if(str.charAt(start) != str.charAt(end)){

               return false;

           }

           start++;

           end--;

       }

       return true;

   }  

   public static int countPalindromePairs(String[] inarr){

       int count = 0;

       for(int i=0; i<inarr.length; i++){

           for(int j=i+1; j<inarr.length; j++){

               StringBuilder sb = new StringBuilder();

               sb.append(inarr[i]).append(inarr[j]);

               if(isPalindrome(sb.toString())){

                   count++;

               }

           }

       }

       return count == 0 ? -1 : count;

   }

   public static void main(String[] args) {

       Scanner sc = new Scanner(System.in);

       String line = sc.next();

       String[] inarr = line.split(",");

       int count = countPalindromePairs(inarr);

       System.out.println("RESULT: "+count);

   }

}

Explanation:

OUTPUT:

the grade point average collected from a random sample of 150 students. assume that the population standard deviation is 0.78. find the margin of error if c = 0.98.

Answers

Answer:

[tex]E = 14.81\%[/tex]

Explanation:

Given

[tex]n = 150[/tex]

[tex]\sigma = 0.78[/tex]

[tex]c = 0.98[/tex]

Required

The margin of error (E)

This is calculated as:

[tex]E = z * \frac{\sigma}{\sqrt{n}}[/tex]

When confidence level = 0.98 i.e. 98%

The z score is: 2.326

So, we have:

[tex]E = 2.326 * \frac{0.78}{\sqrt{150}}[/tex]

[tex]E = 2.326 * \frac{0.78}{12.247}[/tex]

[tex]E = \frac{2.326 *0.78}{12.247}[/tex]

[tex]E = \frac{1.81428}{12.247}[/tex]

[tex]E = 0.1481[/tex]

Express as percentage

[tex]E = 14.81\%[/tex]

In a certain game, a player may have the opportunity to attempt a bonus round to earn extra points. In a typical game, a player is given 1 to 4 bonus round attempts. For each attempt, the player typically earns the extra points 70% of the time and does not earn the extra points 30% of the time. The following code segment can be used to simulate the bonus round.
success - 0
attempts - RANDOM 1, 4
REPEAT attempts TIMES
IF (RANDOM 110 s 7
success - success + 1
DISPLAY "The player had"
DISPLAY attempts
DISPLAY "bonus round attempts and"
DISPLAY success
DISPLAY "of them earned extra points."
Which of the following is not a possible output of this simulation?
А. The player had 1 bonus round attempts and 1 of them earned extra points.
B The player had 2 bonus round attempts and of them earned extra points.
С The player had 3 bonus round attempts and 7 of them earned extra points.
D The player had 4 bonus round attempts and 3 of them earned extra points.

Answers

Answer:

С The player had 3 bonus round attempts and 7 of them earned extra points.

Explanation:

Given

See attachment for correct code segment

Required

Which of the options is not possible?

From the question, we understand that:

[tex]attempts \to [1,4][/tex] --- attempt can only assume values 1, 2, 3 and 4

The following "if statement" is repeated three times

IF RANDOM[1,10] <= 7:

   success = success + 1

This implies that the maximum value of the success variable is 3

The first printed value is the attempt variable

The second printed value is the success variable.

From the list of given options, (a), (b) and (d) are within the correct range of the two variable.

While (c) is out of range because the value printed for variable success is 7 (and 7 is greater than the expected maximum of 3)

Examine the following output:
4 22 ms 21 ms 22 ms sttlwa01gr02.bb.ispxy.com [154.11.10.62]
5 39 ms 39 ms 65 ms placa01gr00.bb.ispxy.com [154.11.12.11]
6 39 ms 39 ms 39 ms Rwest.plalca01gr00.bb.ispxy.com [154.11.3.14]
7 40 ms 39 ms 46 ms svl-core-03.inet.ispxy.net [204.171.205.29]
8 75 ms 117 ms 63 ms dia-core-01.inet.ispxy.net [205.171.142.1]
Which command produced this output?
a. tracert
b. ping
c. nslookup
d. netstat

Answers

Answer:

a. tracert

Explanation:

Tracert is a computer network diagnostic demand which displays possible routes for internet protocol network. It also measures transit delays of packets across network. The given output is produced by a tracert command.

To access a ___ library, you will need a computer and Internet access.

Answers

To access an online library, you will need a computer and an internet connection.

What are online libraries?

Online libraries are digital collections of books, journals, and other materials that are available to users through a web browser.

With a computer and internet access, users can browse, search, and read or download materials from the online library. Many online libraries also offer features such as personalized user accounts, bookmarking, and citation tools.

Online libraries have become increasingly popular as more content becomes available in digital format, making it easier and more convenient for people to access information from anywhere with an internet connection.

Read more about online library here:

https://brainly.com/question/20406929

#SPJ1

bao bì chủ động active packaging và bao bì thông minh intelligent packaging khác biệt như thế nào

Answers

answer:

yes....................

Let’s say you’re having trouble locating a file on your computer. Which of the following are good places to look for the file?

a. The Recycle Bin
b. Default folders like My Documents
c. The Downloads folder

Answers

Answer:

The downloads folder ( C )

Explanation:

when you have difficulty locating a file on your computer you can look for the file in any of the options listed ( The recycle bin, Default folders like My Documents  or The Downloads folder )

But the best place out of these three options is the Downloads folder. and this is because by default all files downloaded into your computer are  placed in the Downloads folder regardless of the type of file

diagram of a central processing unit​

Answers

Hehehehehehehehehehdurnrjrir

Need help ASAP!

Which of the following statements is true?

1) A PCAP format is handy because there is no additional tool to read it.
2) Network traffic can be captured using the Tcpdump protocol analyzer.
3) Normally, traffic inside a network is recorded within a capture file.
4) Sniffer is a program to save the network capture to a specific format.

Answers

The statement that  is true is that  Network traffic can be captured using the Tcpdump protocol analyzer.

How is network traffic captured?

Network traffic can be taken in using the Tcpdump. This is known to be a kind of packet sniffer that is often used to look and record network traffic on an interface.

An example is when a person capture 1,000 packets through the use of tcpdump. One can then analyze network traffic by using actual network traffic analyzer, which is as Wireshark.

Learn more about Network traffic from

https://brainly.com/question/26199042

Compute the approximate acceleration of gravity for an object above the earth's surface, assigning accel_gravity with the result.
The expression for the acceleration of gravity is: (G*M)/(d2), where G is the gravitational constant 6.673 x 10-11, M is the mass of
the earth 5.98 x 1024 (in kg), and d is the distance in meters from the Earth's center (stored in variable dist_center)
Sample output with input: 6.3782e6 (100 m above the Earth's surface at the equator)
Acceleration of gravity: 9.81

Answers

Answer:

The summary of the given query would be summarized throughout the below segment. The output of the question is attached below.

Explanation:

Given values are:

[tex]G = 6.673e-11[/tex][tex]M = 5.98e24[/tex][tex]accel \ gravity = 0[/tex][tex]dist\ center=float(inp())[/tex]

here,

inp = input

By utilizing the below formula, we get

⇒ [tex]\frac{GM}{d^2}[/tex]

Now,

⇒ [tex]accel \ gravity=\frac{G\times M}{dist \ center**2}[/tex]

⇒ print("Acceleration of gravity: {:.2f}".format(accel_gravity))

Given the following snippet of code, answer the following two questions based on the code: typedef enum {Sun, Mon, Tue, Wed, Thu, Fri, Sat} days; days x = Mon, y = Sat; while (x != y) { x++; } y++; printf("x = %d, y = %d", x, y); 1. What value will be printed for variable x? [ Select ] . 2. What value will be printed for variable y? [ Select ]

Answers

Answer:

1) The value of x will be 6.

2) The value of y will be 7.

Explanation:

1) The value of x will be 6.  

The enum values are labeled by default from 1. This means that Sun = 1, Mon = 2, Tue = 3 and so on.  

So, x = Mon = 2 and y = Sat = 6  

x increases up to y = 6 in the while loop.  

and then y also increments by 1.  

2)So the value of y = 7.  

You will need actual printf("Sun") or printf("Mon") for printing the actual text for the enum.

Decomposing and modularizing software refers to the process of combining a number of smaller named components having well-defined interfaces that describe component interactions into a single, larger monolithic system.

a. True
b. False

Answers

Answer:

b. False

Explanation:

Decomposing and modularizing means that a large software is being divided into smaller named components that have a well-defined interfaces which basically describes the component interactions. The main goal is to place these different functionalities as well as the responsibilities in different components.

Decomposition and modularization forms the principle of software design.

Hence, the answer is false.

Describe how data is transmitted using half-duplex serial data transmission.

Answers

Answer:

In half duplex mode, the signal is sent in both directions, but one at a time. In full duplex mode, the signal is sent in both directions at the same time. In simplex mode, only one device can transmit the signal. In half duplex mode, both devices can transmit the signal, but one at a time.

about system implementation in long

Answers

Answer:

Systems implementation & evaluation

What is systems implementation?

What are the tools for physical systems design?

What are the issues to consider before an information system is operational?

What are the key indicators of a quality system?

What are the techniques for systems evaluation?

Systems implementation is the process of:

defining how the information system should be built (i.e., physical system design),

ensuring that the information system is operational and used,

ensuring that the information system meets quality standard (i.e., quality assurance).

Systems design

Conceptual design – what the system should do

Logical design – what the system should look to the user

Physical design – how the system should be built

Physical system design using structured design approach:

à To produce a system that is easy to read, code, and maintain

1. Factoring: decomposition

2. Span of control: 9 subordinate modules

3. Reasonable size: 50-100 LOC

4. Coupling: minimize inter-module dependency

5. Cohesion: single module functionality

6. Shared use: multiple calls to lower level modules from different bosses

Structured design tools

· Organization of programs and program modules (structure chart)

· Processing logic specification in each module (pseudocode)

Structure chart – to show graphically

how the various program parts/modules of an information system are physically organized hierarchically

how the modules communicate with each other through data couple (data exchange) and flag (control/message)

how the modules are related to each other in terms of sequence, selection, and repetition

Describe computer in your own words on three pages

Answers

no entendi me explicas porfavor para ayudarte?

Read integers from input and store each integer into a vector until -1 is read. Do not store -1 into the vector. Then, output all values in the vector (except the last value) with the last value in the vector subtracted from each value. Output each value on a new line. Ex: If the input is -46 66 76 9 -1, the output is:
-55
57
67

Answers

Answer:

The program in C++ is as follows:

#include <iostream>

#include <vector>

using namespace std;

int main(){

vector<int> nums;

int num;

cin>>num;

while(num != -1){

 nums.push_back(num);

 cin>>num; }  

for (auto i = nums.begin(); i != nums.end(); ++i){

    cout << *i <<endl; }

return 0;

}

Explanation:

This declares the vector

vector<int> nums;

This declares an integer variable for each input

int num;

This gets the first input

cin>>num;

This loop is repeated until user enters -1

while(num != -1){

Saves user input into the vector

 nums.push_back(num);

Get another input from the user

 cin>>num; }

The following iteration print the vector elements

for (auto i = nums.begin(); i != nums.end(); ++i){

    cout << *i <<endl; }

preguntas sobre la búsqueda de alternativas de solución​

Answers

Answer:

Explanation:

Qué tipo de solución alternativa estás buscando

3 Marks] Q 2. A host has the IP address 196.22.44.133/21. What are the network address, broadcast address and valid host addresses for the IP subnet which the host is a member of​

Answers

Answer:

Address:   192.22.44.133         11000000.00010110.0 0101100.10000101

Netmask:   255.255.128.0     11111111.11111111.1 0000000.00000000

Network:   192.22.0.0/17         11000000.00010110.0 0000000.00000000 (Class C)

Broadcast: 192.22.127.255        11000000.00010110.0 1111111.11111111

HostMin:   192.22.0.1            11000000.00010110.0 0000000.00000001

HostMax:   192.22.127.254        11000000.00010110.0 1111111.11111110

Explanation:

how to add a fixed decimal value to an identifier using Delphi 10 coding?​

Answers

Answer:A declaration defines an identifier (such as the name of a function or variable) that ... This topic introduces the Delphi language character set, and describes the syntax for ... The Delphi language uses the Unicode character encoding for its character set, ... Integer and real constants can be represented in decimal notation as ...

Explanation:

¿Cuál es la diferencia de un ciudadano digital entre la vida real y la vida en línea?

Answers

No podes ir a lugar sin tarjeta verde en los Estados Unidos Digitalmente podes comprar lo que puedas

x-1; while x ==1 disp(x) end, then the result a. infinity or b. (1) ​

Answers

Answer:

1 is the answer because ur trying to trick us

Explanation:

Design a function char maxChar (char,char)- to return the smallest character from the arguments.
in java please please​

Answers

Answer:

Following are the program to the given question:

public class Main//defining Main method

{

   char maxChar (char x1,char x2)//defining a method maxChar that takes two char parameter

   {

       if(x1<x2)//use if to compare char value

       {

           return x1;//return first char value

       }

       else//else block

       {

           return x2;//return second char value

       }

       

   }

public static void main(String[] args)//defining main method

{

    char x1,x2;//defining char variable

    x1='d';//use char to hold value

    x2='a';//use char to hold value

    Main ob=new Main();//creating class Object

 System.out.println(ob.maxChar(x1,x2));//calling method and prints its return value

}

}

Output:

a

Explanation:

In this code, a method "maxChar" is defined that holds two char variable "x1,x2" in its parameters, and use if conditional statement that checks the parameter value and print its return value.

In the main method, two char variable is declared that hold char value and passing the value in the method and prints its return value.  

7. Lower than specified oil pressure is measured on a high-mileage engine. Technician A says that worn main or rod bearings could be the cause. Technician B says that a clogged
oil pump pickup screen could be the cause. Who is correct?

O A. Neither Technician A nor B

O B. Technician B

O C. Technician A

O D. Both Technicians A and B

Answers

Technician B as Technician A was a fraud

Describe what happens at every step of our network model, when a node of one network...

Answers

Answer:

Each node on the network has an addres which is called the ip address of which data is sent as IP packets. when the client sends its TCP connection request, the network layer puts the request in a number of packets and transmits each of them to the server.

3. State whether the given statements are true or false. a. The computer is called a data processor because it can store, process, and retrieve data whenever needed. b. Modern processors run so fast in term of megahertz (MHz). c. If millions of calculations are to be performed, a computer will perform every calculation with the same accuracy. d. It is very safe to store data and information on the computer independently. e. If some electrical or electronic damages occur, there are no any chances of data loss or damage f. The output devices of the computer like monitor, printer, speaker, etc. can store meaningful information, g. The input devices can display the output after processing. h. Students can also use computer as their learning tools.​

Answers

Answer:

a,b,c,d,f,g are true only e is false

Given two integers as user inputs that represent the number of drinks to buy and the number of bottles to restock, create a VendingMachine object that performs the following operations:

Purchases input number of drinks
Restocks input number of bottles
Reports inventory
The VendingMachine is found in VendingMachine.java. A VendingMachine's initial inventory is 20 drinks.

Ex: If the input is:

5 2
the output is:

Inventory: 17 bottles

Need this answer in java! !!!!!!!!!!!!

Answers

Answer:

import java.util.Scanner;

class Main {

 public static void main (String args[])

 {

   Scanner input = new Scanner(System.in);

   VendingMachine machine = new VendingMachine(20);

   System.out.print("Enter nr to purchase: ");

   int nrPurchased = input.nextInt();

   System.out.print("Enter nr to re-stock: ");

   int nrRestock = input.nextInt();

   machine.Transaction(nrPurchased, nrRestock);

   input.close();

 }

}

class VendingMachine {

 private int inventory;

 public VendingMachine(int initialInventory) {

   inventory = initialInventory;

 }

 public void Transaction(int nrToBuy, int nrToRestock) {

   inventory += nrToRestock - nrToBuy;

   System.out.printf("Inventory: %d bottles.\n", inventory);

 }

}

The program is an illustration of a sequential program, and it does not require loops, iterations and branches.

The program in java, where comments are used to explain each line is as follows:

import java.util.Scanner;

class Main {

public static void main (String args[]){

   //This creates a scanner object

  Scanner input = new Scanner(System.in);

  //This gets input for the number of purchases

  int Purchased = input.nextInt();

  //This gets input for the number of restocks

  int Restock = input.nextInt();

  //This calculates and prints the inventory

System.out.print("Inventory: "+(20 - Purchased + Restock)+" bottles");

}

}

At the end of the program, the net inventory is printed.

Read more about similar programs at:

https://brainly.com/question/22851981

Other Questions
What is cos(A)? please explain d= (r+c)t how do i solve for t? Explain the conflict that arises over Lavinia. What happens as a result of this? Who is killed and by whom? What was the killers justification? what is the area of a flower pot that have the shape of a semi circle and its diameter 2.8cm? What is the area please? Mass of a proton: 1.007825 unitsMass of a neutron: 1.008665 unitsCalculate the mass Defect of 214 N has actual mass of 14.0031 u. if x4 + 1/x4 = 4 find the value of x2+1/x2 On a coordinate plane, a line goes through (negative 3, negative 3) and (negative 1, 5). What is the equation of the line parallel to the given line with an x-intercept of 4? Could someone help me please if you dont mind thank you so much! can someone pls pls help me? please help me look at the photo! Why was this video created?1.to encourage American women to work in factories2.to ask the public to make donations to the war effort3.to ask citizens to save gasoline and other supplies4.to help increase the size of the American military what percentage is the following 3 upon 4 of 3 upon 8 What is the flow rate of oil if 70mL of oil take 20 seconds to flow out of a pipe? A 21-year-old woman presents with a 3-month history of a black mole on her right calf. She tells you that the lesion is enlarging and expanding. It began to itch about 3 weeks ago, and it has bled 2 times. She thinks that there may have been a mole near the same spot previously, but she is not certain. Her general health is good; there is no history of chronic illness, hospitalizations, or surgeries. She works as a professional model for a large advertisement agency. She does not take any prescription medication; she does not use tobacco, alcohol, or recreational drugs. Although she has dark hair, she has a fair skin, and she says that she usually burns with even short sun exposure. She does occasionally use a tanning booth prior to modeling events and vacations. There is no family history of skin cancer.VS stable, she looks anxious, but she is otherwise well.There is a dark brown-black nodule on the right calf 1 cm in diameter.On the surface of the nodule, there is a tiny area of crusting. There are no hairs. The nodule is asymmetrical, and its border is sharply demarcated; the color is uniform, and the elevation is regular. There is a narrow (1-2 mm) rim of erythema around most of the nodule. She has a sprinkling (about 25-30 in all) of melanocytic nevi on her trunk and legs. There is no significant local or distal lymphadenopathy. The liver is not palpable. The remainder of the physical examination is unremarkable.What is the most likely diagnosis? 16. Which type of epithelium is found in uterine tubes(oviducts)? 2. Which weather instrument is used to measure wind speed? What is the total cost of a $25 book if the sales tax is 8%? Define the terms of data and information . Your neighbor's house is on fire. * LIFE-SAVING SOLUTION: How do you respond to an emergency? Whom do you call for help?