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
Developed the first compiler and conducted work that led to the development of COBOL ?
zimovet [89]

Answer:

Grace Hopper.

Explanation:

Grace Hopper was a US Naval Rear Admiral and an American computer scientist who was born on the 9th of December, 1906 in New York city, United States of America. She worked on the first commercial computer known as universal automatic computer (UNIVAC), after the second World War II.

In 1953 at the Remington Rand, Grace Hopper invented the first high-level programming language for UNIVAC 1 by using words and expressions.

Additionally, the high-level programming language known as FLOW-MATIC that she invented in 1953 paved the way for the development of common business-oriented language (COBOL).

Hence, Grace Hopper developed the first compiler and conducted work that led to the development of COBOL.

6 0
3 years ago
Help me and i'll mark brainliest
chubhunter [2.5K]

Answer: Help you with what

Explanation: This is so random lol but i guess im getting brain points or sum like that

4 0
3 years ago
What are two factors that determine overall system performance?
podryga [215]
The amount of ram left and counting up on that CPU state
3 0
4 years ago
A snail goes up A feet during the day and falls B feet at night. How long does it take him to go up H feet? Given three integer
Ann [662]

Answer:

H=(A*D)-(B*(D-1))

H = A*D- B*D+B

H-B = (A-B)*D

D= (H-B)/(A-B)

Python 3 code

import math

H=int(input('Enter Height: '))

up=int(input('Enter Number of Feet Up: '))

down=int(input('Enter Number of Feet Down: '))

D=(H-down)/(up-down)

print(math.ceil(D),' Days'

Explanation:

The output of the Program is given in the attached file.

8 0
3 years ago
Heat transfers from an area of ____temperature to an area of ___ temperature.
dsp73

Answer:

Higher, lower. I really hope this helped!!!

5 0
3 years ago
Other questions:
  • Given the following business scenario, create a Crow's Foot ERD using a specialization hierarchy if appropriate. Granite Sales C
    12·1 answer
  • You are planning the requirements for a site tracking and reporting system for your company Web site. Which of the following inf
    10·1 answer
  • If a class contains more than one constructor, describe how the computer determines the appropriate constructor. provide an exam
    10·1 answer
  • Which act requires that financial institutions must provide a privacy notice to each consumer that explains what data about the
    12·1 answer
  • PLEASE ANSWER QUICK
    13·2 answers
  • 9.6 Code Practice, this is in Python, I need its quick!
    13·1 answer
  • Which two items define a person's online identity? (choose two)
    15·1 answer
  • Which technology do online storesusually use to present customized content?
    10·1 answer
  • What is computer system ?​
    9·2 answers
  • help i was building my pc and i pushed the cpu into the socket really hard until there was an audible crack and it went into the
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!