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
Neko [114]
3 years ago
9

Functional side effects: 15) Given the following Java/C++ like code. Assuming function calls (operands) are evaluated from left-

to-right, one at a time. a) What outputs are printed to the screen? int a = 4; // global variable int fun1() { a = 2; return 3; } int fun2() { return a; } void main() { int x = fun1() + fun2(); System.out.println("x = " + x); } Answer: x = b) What outputs are printed to the screen? int a = 4; // global variable int fun1() { a = 2; return 3; } int fun2() { return a; } void main() { int x = fun2() + fun1(); System.out.println("x = " + x); } Answer: x =
Computers and Technology
1 answer:
tigry1 [53]3 years ago
7 0

Answer:

a. x = 5

b. x = 7

Explanation:

a)

OUTPUT: x = 5

In the main() function, fun1() is evaluated first and it updates the value of the global variable to 2 and returns 3.

The second function returns the value of the global variable 'a' and this variable has value 2.

So,

x = 3 + 2

x = 5

b)

OUTPUT: x = 7

In the main() function, fun2() is evaluated first and it returns 4 because global variable 'a' is initialized with value 4.

The second function fun()1 will returns the value 3.

So,

x = 4 + 3

x = 7

You might be interested in
San Diego broker Cal Abrams has avoided the technological trend of the past 20 years. Finally, he's jumped online and realized w
AnnZ [28]

Answer:

Cal Abrams must do online advertising and learn digital marketing.

Explanation:

First, Cal has to learn digital marketing that is another name of marketing and advertising online on the internet. He must learn digital marketing courses that are easily available on the internet and some of them are free to learn. However, some of them required a subscription to learn. Learning digital marketing and advertising is so easy. After learning the basics of digital marketing, he must learn the skills of using social media effectively for reaching millions of potential customers.

However, the following are different tools that can be used effectively for online advertising and marketing to reach millions of customers just by running one little advertisement.

  • (Please see the attachment).

4 0
3 years ago
You can use automatic link-checking software to identify invalid hyperlinks. if you find invalid links, what should you do next?
Solnce55 [7]
Correct the href value of the appropriate anchor.
7 0
3 years ago
What is a biometric scanner?
Lisa [10]
<span>an electronic device used to determine a person's identity by detecting and matching the person's physical features, such as fingerprints or the eyes, to a database</span>
3 0
3 years ago
Read 2 more answers
Create a game that rolls two dies (number from 1 to 6 on the side) sequentially for 10 times (use loop). If at least once out of
Alex73 [517]

Answer:

Explanation:

The following code is written in Java and loops through 10 times. Each time generating 2 random dice rolls. If the sum is 10 it breaks the loop and outputs a "You Win" statement. Otherwise, it outputs "You Lose"

import java.util.Random;

class Brainly {

   public static void main(String[] args) {

       UseRandom useRandom = new UseRandom();

       boolean youWin = false;

       for (int x = 0; x<10; x++) {

           int num1 = useRandom.getRandom(6);

           int num2 = useRandom.getRandom(6);

           if ((num1 + num2) == 10) {

               System.out.println("Number 1: " + num1);

               System.out.println("Number 2: " + num2);

               System.out.println("You Win");

               youWin = true;

               break;

           }

       }

       if (youWin == false) {

           System.out.println("You Lose");

       }

   }

}

class UseRandom{

   public int getRandom(int n)

   {

       Random r=new Random();

       int rand=r.nextInt(n);

       return rand;

   }}

8 0
3 years ago
Name the six parts of the product development life cycle.
Nuetrik [128]

Answer:

Development, Introduction, Growth, Maturity and Decline.

Explanation:

5 0
3 years ago
Read 2 more answers
Other questions:
  • Using the flowchart below, what value when entered for Y will generate a mathematical error and prevent our flowchart from being
    14·1 answer
  • WILL MARK BRAINLYIST
    15·2 answers
  • Sara has a habit of stealing money from her brother Charlie. When he found out, Charlie rebuked Sara in the presence of his frie
    11·1 answer
  • Anyone want to join my dîšćòrd
    8·2 answers
  • After which stage in the information processing cycle can data be referred for future use?
    7·1 answer
  • True or false: when an ospf route sends its link state information, it is sent only to those nodes directly attached neighbors.
    14·1 answer
  • ....is an act of introducing an invention into market on business basis for profit​
    12·1 answer
  • Write the functions of F1 to F12 on the keyboard​
    5·2 answers
  • mary needs to rename her report.txt file to final_report.txt. which command will allow her to do this?
    10·2 answers
  • _____ are fields that are used to personalize a mail merge document
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!