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
For what show did the actor, whose star is located at 6667 Hollywood Boulevard, earn an Emmy Award for Outstanding Supporting Ac
Ilya [14]

The show’s title is China Beach, which was a television series set in a hospital during the Vietnam War. It was aired from 1988 to 2001. The actress who won a Primetime Emmy Award for Outstanding Supporting Actress in a Drama Series was Marg Helgenberger. She won in 1990 for her role as a part-time prostitute who is also a volunteer, Karen Charlene "K.C." Koloski.  


4 0
2 years ago
Read 2 more answers
USDA-APHIS Animal Care Resource Policy #12 "Considerations of Alternatives to Painful/Distressful Procedures" states that when a
katrin2010 [14]

Answer:

C. The specific field of study

C. change in anesthetic agent

Explanation:

In the consideration for the procedure, some information are required and examples are the strategy of the search/the database name. However, the area of study is not one of the information.

The animal use proposal can general be altered based on the type of change required. However, an anesthetic agent alteration is not a significant change.

6 0
3 years ago
Whenever I ask a question I loose points I just asked a question before and I had 56 points now I have 12 now I'll probably have
lilavasa [31]
Just try to answer some questions as well, then you can keep a nice balance.
ps. Only answer the questions you know. 
5 0
3 years ago
The ____ tool allows a user to connect to the active registry database and make changes that are effective immediately. editreg.
kenny6666 [7]
Regedit is the Answer
3 0
3 years ago
Question 2 Unsaved Which of these is NOT an example of an emerging technology? Question 2 options: Sixth Sense Close Range Drone
alexandr1967 [171]

The answer is <em>B.) Close Range Drones</em>

I just took the test

3 0
3 years ago
Other questions:
  • In which step of writing a program does a programmer first use a<br> compiler?<br> documentin
    6·1 answer
  • Which best describes a difference between transcription and DNA replication
    8·2 answers
  • Patricia is leading an online group of students from many
    8·2 answers
  • Natalie is a secretary and must complete a large amount of filing this afternoon. At 1:00 PM, the office receptionist gets sick
    10·1 answer
  • How much does a dodge tomohawk cost for a used one?
    7·1 answer
  • how do I delete my brainly account, my child signed up for it and nothing has been paid but I do not want the account to exist a
    7·2 answers
  • Where ....................... the books that you borrowed? *
    5·1 answer
  • Write a program that inputs a five-digit integer, spearates the integer into its digits and prints them seperated by three space
    6·1 answer
  • Declare a typedef struct named jumper_t that will have four parts: character array name that is 16 in length, double array of tr
    12·1 answer
  • What starts with p and ends with orn
    15·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!