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
soldi70 [24.7K]
2 years ago
6

A store sells rope only in whole-foot increments. Given three lengths of rope, in feet, the following code segment is intended t

o display the minimum length of rope, in feet, that must be purchased so that the rope is long enough to be cut into the three lengths. For example, for lengths of 2.8 feet, 3 feet, and 5 feet, the minimum length of rope that must be purchased is 11 feet. For these inputs, the code segment should display 11. As another example, for lengths of 1.1 feet, 3.2 feet, and 2 feet, the minimum length of rope that must be purchased is 7 feet. For these inputs, the code segment should display 7.
double len1
double len2
double len3;
double total = len1 + len2 + len3
int minLength = (int) (total + 0.5)
System. out. print(minLength)
Which of the following best describes the behavior of the code segment?
A. The code segment works as intended for all non-negative values of len1, len2, and len3.
B. The code segment works as intended but only when the sum of the three lengths is an integer or the decimal part of the sum of the three lengths is greater than or equal to 0.5.
C. The code segment does not work as intended for some values of len1, len2, and len3. It could be corrected by casting len1, len2, and len3 to int before adding them together and assigning the sum to minLength.
D. The code segment does not work as intended for some values of len1, len2, and len3. It could be corrected by declaring minLength as a double and casting it to an int in the System. out. print statement.
E. The code segment does not work as intended for any values of len1, len2, and len3. It returns the sum of 0.5 and the three lengths for all values of len1, len2, and len3.
Computers and Technology
1 answer:
Lynna [10]2 years ago
5 0

Answer:

The answer is "option B".

Explanation:

In the given code, four double variable "len1, len2, len3, and total" is declared, in which the first three variables accept some value, and in the total variable, we add those variable. In the next step, an integer variable minLength is defined, which converts the decimal value to an integer and adds the value that is "0.5". In this section, the code uses as an intended purpose but only if the total of 3 lengths is equivalent to or larger then 0.5, and wrong choices can be described as follows:

  • In option A, It accepts the negative value, that's why it is wrong.
  • Option C, Option D, and Option E all were wrong because the code segment is work as intended.
You might be interested in
A __________ acts as separate network that rests outside the secure network perimeter so untrusted users can access web servers
pychu [463]
Firewall
Dont forget to thanks and give brianliest.
4 0
3 years ago
To print the last element in the array named ar, you can write :A. System.out.println(ar.length);
timofeeve [1]

Answer:

Option (d) is the correct answer.

Explanation:

An Array is used to store multiple variables in the memory in the continuous memory allocation on which starting index value is starting from 0 and the last index value location is size-1.

In java programming language the array.length is used to tells the size of the array so when the user wants to get the value of the last element, he needs to print the value of (array.length-1) location so the correct statement for the java programming language is to print the last element in the array named ar is--

System.out.println(ar[ar.length-1]);

No option provides the above statement, so option d (None of these) is correct while the reason behind the other option is not correct is as follows--

  • Option a will prints the size of the array.
  • Option b also gives the error because length is an undeclared variable.
  • Option c will give the error of array bound of an exception because it begs the value of the size+1 element of the array.
3 0
3 years ago
The National Vulnerability Database (NVD) is responsible for actively performing vulnerability testing for every company's softw
V125BC [204]

Answer:

False

Explanation:

The answer to this question is false. This is because the NVD doesn't perform such tests on their own. Instead they they rely on third-party vendors, software researchers, etc to get such reports and do the assignment of CVSS scores for softwares

The National Vulnerability Database (NVD) is the United State governments leading resource for software vulnerability

8 0
2 years ago
Generally, websites ending in .edu, .gov, and .org are less likely to be biased, or to show preference toward a certain financia
svetlana [45]

Answer:

True

Explanation:

Domain extensions always appear at the end of a website's address.

It's a means to categorise websites.

.edu domains are used for educational purposes

.gov are restricted to by government entities

.org is largely used by nonprofit websites.

While

.net is derived from the word network, indicating it was originally intended for organizations involved in networking technologies, such as Internet service providers and other infrastructure companies

.biz is intended for registration of domains to be used by businesses

The right domain extension adds credibility and memorability to your website by aligning it with a specific brand purpose.

8 0
3 years ago
How can this requirement be met? Universal Containers provide access to Salesforce for their Sales, Service and Marketing Teams.
ArbitrLikvidat [17]
Good luck and I hope u can find the right answer
5 0
3 years ago
Other questions:
  • What is a valence orbit?
    13·2 answers
  • ____, developed by xuejia lai and james massey, is a block cipher that operates on 64-bit blocks of plaintext.
    10·1 answer
  • A ____________ is a set of commands which can be run by calling it by name.
    11·2 answers
  • In Word, tables can be styled much like text can.<br> True<br> False
    6·1 answer
  • To edit the text in a smartart graphic, what must be done first ?
    7·2 answers
  • Aubrey is on a Windows machine. She wants to back up her Halloween pictures on an external hard drive. Which of the following ta
    12·1 answer
  • In what software development model does activity progress in a lock-step sequential process where no phase begins until the prev
    7·1 answer
  • What is the importance of human flourishing to science and technology?​
    8·1 answer
  • If i hit the delete key three times what will be left
    12·1 answer
  • What are the importance of Help and Support feature of Windows​
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!