Consider the method total below:public static int total (int result, int a, int b){ if (a == 0) { if (b == 0) { return result * 2; } return result / 2; } else { return result * 3; }}
The assignment statementx = total (1, 1, 1);must result in:A. x being assigned the value 3 B. x being assigned the value 7C. x being assigned the value 5D. x being assigned the value 2E. x being assigned the value 0

Answers

Answer 1
Answer:

Answer:

Explanation:



When you look at the assignment "x = total (1, 1, 1);", you can see that result, a and b all refers to 1. Then, you need to go to the function and check the conditions. The first condition is "if (a == 0)", it is not true because a is assigned to 1. Since that is not true, you need to go to the else part "else { return result * 3". That means the result of this function is going to give us 3 (because result variable equals to 1 initially). That is why x is going to be assigned as 3.


Related Questions

The computer output for integer programs in the textbook does not include reduced costs, dual values, or sensitivity ranges because these variables are not meaningful for integer programs. TrueFalse
A device that protects electronic equipment from an increase in power, but not a decrease or outage is a ___.a. Battery backupb. Surge suppressorc. CRTd. UPS
A vowel word is a word that contains every vowel. Some examples of vowel words are sequoia, facetious, and dialogue. Determine if a word input by the user is a vowel word.
Which statement is written correctly?
Integer userNumber is read from input. Write a while loop that multiplies userNumber by 4, updating userNumber with the product, and outputs the updated userNumber, followed by a newline. The loop iterates until userNumber is greater than or equal to 40.Ex: If the input is 25, then the output is: 100 import java.util.Scanner; public class ProductCalculator { public static void main(String[] args) { Scanner scnr = new Scanner(System.in); int userNumber; userNumber = scnr.nextInt(); while(userNumber >= 40){ userNumber = userNumber * 4; System.out.println(userNumber); } Java. What am I doing wrong? It's not giving an output. } }

Write a Python function fun3(e) to update a list of numbers e such that the first and last elements have been exchanged. The function needs to also return multiplication of elements of e. You should assume that the list e has at least 2 elements.Example:

>>>lst = [4, 1, 2, -1]

>>>fun3(list)

-8

Answers

Answer:

Here is code in Python:

#function to swap first and last element of the list

#and calculate product of all elements of list

def fun3(e):

   product = 1

   temp = e[0]

   e[0] = e[-1]

   e[-1] = temp

   for a in e:

       product *= a

   return product

#create a list

inp_lst = [4, 1, 2, -1]

#call the fun3() with parameter inp_lst

print("product of all elements of list is: ",fun3(inp_lst))

#print the list after swapping

print("list after swapping first and last element: ",inp_lst)

Explanation:

Create a list "inp_lst" and initialize it with [4,1,2,-1]. In the function fun3() pass a list parameter "e". create a variable "product" to calculate the product of all elements.Also create a temporary variable to swap the first and last element of the list.

Output:

product of all elements of list is:  -8                                                                                        

list after swaping first and last element:  [-1, 1, 2, 4]

. A file allocation table (FAT) is used to keep track of the portions assigned to a file. Select one: True False

Answers

Answer: True

Explanation: File allocation table(FAT) is the part of the file system that helps the hard drives .It is used for the management of the files and data which gets stored in the hard drive  by the operating system. It can also help in the extension or expansion of the hard drive storage.

It also keeps tracing the files and data accordingly. This table works for the  portable devices ,cameras etc. Thus, the statement given is true.

Write a program segment that simulates flipping a coin 25 times by generating and displaying 25 random integers, each of which is either 1 or 2

Answers

Answer:

//import the Random class

import java.util.Random;

//Begin class definition

public class CoinFlipper {

   //The main method

    public static void main(String []args){

       

       //Create an object of the Random class

       Random ran = new Random();

       System.out.println("Result");    

       //Use the object and the number of times for simulation

       //to call the flipCoin method

       flipCoin(ran, 25);

    } //End of main method

   

   

    //Method to flip coin

    public static void flipCoin(Random ran, int nooftimes){

        //Create a loop to run as many times as specified in variable nooftimes

       for(int i=1; i<=nooftimes; i++)

           System.out.println(ran.nextInt(2) + 1);

    }

}   //End of class definition

====================================================

Sample Output:

Result

1

1

1

2

1

2

2

1

2

1

1

2

1

2

1

1

1

2

1

1

1

2

2

1

2

========================================================

Explanation:

The above code has been written in Java. It contains comments explaining every part of the code. Please go through the comments.

The sample output from the execution of the code is also given above.

The code is re-written as follows without comments.

import java.util.Random;

public class CoinFlipper {

    public static void main(String []args){

       Random ran = new Random();

       System.out.println("Result");    

       flipCoin(ran, 25);

    }

   

    public static void flipCoin(Random ran, int nooftimes){

       for(int i=1; i<=nooftimes; i++)

           System.out.println(ran.nextInt(2) + 1);

    }

}

What are the 21St century competencies or skills required in the information society?

Answers

Answer:

Communication

Collaboration

ICT literacy

Explanation:

These are some of the skills that are needed in the 21st century to compete and thrive in the information society.

To remain progressive, one needs to have good communication skills. These communication skills can include Active Listening and Passive Listening.

Collaboration is important because you'll have to work with other people as no man is an island, we need someone else so the skill of collaboration is necessary to compete and stay relevant in the information society in the 21st century.

IT literacy is also very important because one needs to have basic computer knowledge such as programming, computer essentials and applications, etc.

Poor quality lateral communication will result in which ofthefollowing?
a. Lack of direction
b. Lack of coordination
c. Lack of delegation
d. Lack of control

Answers

Answer:

b. Lack of coordination

Explanation:

LAteral communication in human resources and organizational communication is known as the communication that exists between peers and colleagues, so that wouldn cause a lack of cirection, delegation or control because its not between bosses and employees, what it would cause would be a lack of coordination between the employees.

Answer:

b

Explanation:

b, lack of coordination

Is e commerce a challenge or opportunity to the freight forwarder

Answers

Answer:

It can be both

Explanation:

This all depends on how that e commerce is planning on handling their deliveries. Taking Amazon as an example, they're probably top customers from FedEx and UPS (and others as well), which at a very beginning this has shown a great opportunity for these companies. However, Amazon has started to show interest in starting their own delivery which also poses a huge risk.