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
Lera25 [3.4K]
3 years ago
9

Which of the following are valid calls to Math.max? 1. Math.max(1,4) 2. Math.max(2.3, 5) 3. Math.max(1, 3, 5, 7) 4. Math.max(-1.

5, -2.8f) A. 1, 2 and 4 B. 2, 3 and 4 C. 1, 2 and 3 D. 3 and 4
Computers and Technology
1 answer:
stiv31 [10]3 years ago
8 0

Answer:

1, 2 and 4

Explanation:

the Math.max() is the function in java which is used to compare the two values and it gives the maximum of two values.

it take only two argument and the data type can be int, float etc.

Math.max(1,4): it takes two int values and give the output 4. it is valid call.

Math.max(2.3, 5): it takes two values and give the output 5.0. it is valid call.

Math.max(1, 3, 5, 7): it takes 4 values which is wrong because function takes only two variables. it is not valid call.

Math.max(-1.5, -2.8f): it takes two values and give the output -1.5. it is valid call.

You might be interested in
Consider the following general code for allowing access to a resource:
Margaret [11]

Answer:

a) The code allows access even when  IsAccessAllowed(...) method fails.

b) Either use If

(dwRet = ACCESS_ALLOWED)

or use

if (dwRet == NO_ERROR)

to avoid flaw

Explanation:

Lets first see what the code chunk does:

DWORD dwRet = IsAccessAllowed(...);

if (dwRet == ERROR_ACCESS_DENIED) {

// Security check failed.

// Inform user that access is denied.

} else {

// Security check OK.

}

In the given code, DWORD is basically a data type for double word type integers and this is defined in windows.h

So there is DWORD type variable dwRet that is assigned a method calls.

The method is IsAccessAllowed() which checks if the access is allowed to user.

if (dwRet == ERROR_ACCESS_DENIED) condition basically checks if the value of DWORD type variable dwRet is equal to ERROR_ACCESS_DENIED

If this condition evaluates to true then the security checks fails and user is informed via some message or action that the access is denied.  But when the if condition evaluates to false then the else part executes which allows access.

So basically this chunk of code checks if the error ERROR_ACCESS_DENIED is returned.

Now the flaw in this program is what if the method IsAccessAllowed() by any reason. The reasons can be system failure or the memory failure. In memory failure case for example, the system returns out of memory error. So this means that the error is not  ERROR_ACCESS_DENIED. Instead it is out of memory error. So in such a case the user is allowed access as the if condition evaluates to false and else part executes. So if any other error is produced due to some reason like mentioned above, then user has unrestricted access.

This shows that the doe should not check for the failure or rely on checking ERROR_ACCESS_DENIED to allow access but instead it should check for success. Code should only give access privilege if access is allowed successfully or no error is produced.

So to avoid this flaw the code is altered as:

DWORD dwRet = IsAccessAllowed(...);

If (dwRet = ACCESS_ALLOWED) {

//Security check OK.

} else {

//Security check failed.

//Inform user that access is denied.

}

This will only allow access if ACCESS_ALLOWED evaluates to true and success is checked instead of failure here

You can also alter the if condition as:

If (dwRet = No_Error)

or

If (dwRet = 0)

The above if conditions checks if the access is allowed or if no error is produced. Only then it will allowed access otherwise not. So the access check is a success is checked first and failure (for any reason). The user is allowed access only if there is no error otherwise user is not allowed access.

6 0
2 years ago
Word Online works exact same as the downloaded Office 2016 version.<br>True<br>False​
melisa1 [442]

Answer:

The Answer is false. They work similarly but quite differently on a lot of offerings from them. Office 365 and office.com are online version, and Office 2016 is a desktop version.

Explanation:

I am not going very deep into this but the facts I am mentioning will clarify your doubts.

Office 2016 offers so many ways to share a file even though we work offline on it We can email the document, share on social media as well as store on One drive. However, Office 365, and especially Word online does not allow any other sharing options than sending an invitation or sharing a link.

For Word Online you will need internet all the time, though you can work from anywhere, and even on any device. Word 2016 does not require internet, but provide a lot of analytics features and even data mining facilities when it is connected to the internet.

Watch out for Word online 2019 version, and office 2019 desktop version. They are awesome and provides AI features, and a lot more than 2016 versions, both desktop and online.

3 0
3 years ago
If you are going to develop a special computer, what would it be and explain it's purpose.​
Ann [662]

Answer:

It would be to figure out what cancers someone could exactly so no need for a biopsy

4 0
3 years ago
What is the output of this program?
vladimir1956 [14]

All of the conditions of the elif statement are true. numA does equal 2 and numB does equal 3.

The output of this program is no.

3 0
2 years ago
What is the output of a hash function called?
ruslelena [56]

Answer:

cryptographic hash collision.

Explanation:

4 0
2 years ago
Other questions:
  • Changing the position of the wing will
    9·1 answer
  • How does Hadoop work? It breaks up Big Data into multiple parts so each part can be processed and analyzed at the same time on o
    5·1 answer
  • What is ucspi-tcp pakage in qmail??
    5·1 answer
  • How does technology make America great?​
    10·1 answer
  • Explain with the help of an example that family background affects the entrepreneurial behaviour of people
    12·1 answer
  • Which of the following is a hardware component used to hold the BitLocker encryption key and ensures encrypted data is not acces
    5·1 answer
  • How are web design &amp; web development different from each other?
    9·1 answer
  • SeleCT all correct text​
    5·1 answer
  • What is the name of the option in most presentation applications with which you can modify slide elements?
    7·2 answers
  • What is connected to the base unit in Desktop PC?
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!