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
Nastasia [14]
3 years ago
12

Assume the following JavaScript program was interpreted using staticscoping rules. What value of x is displayed in function sub1

? Under dynamic-scoping rules, what value of x is displayed in function sub1? var x; function sub1() { document.write("x = " + x + ""); } function sub2() { var x; x = 10; sub1(); }x = 5; sub2();
Computers and Technology
1 answer:
Annette [7]3 years ago
7 0

Answer:

Static scoping: x is 5

Dynamic scoping : x is 10.

Explanation:

Static scoping :

In static scoping the variable of a function take the value within the function.

If there is no values exist within the function then take the global value of the variable.

var x // No value is assigned to x so it check global value of x

function sub1() {

   document.write(“x = “ + x + “”); // So it print x = 5

}

function sub2() {

   var x;

   x = 10;

   sub1();

}

x = 5; // It is the global value of x

sub2();

Static scoping: x is 5

Dynamic scoping :

In Dynamic scoping the variable of a function take the value all the calling function ends.

If the global value is the last assigned value of a variable then it take that value.

If there exist some other function after global variable value if that function contain the variable with some assigned value variable take that value.

var x

function sub1() {

   document.write(“x = “ + x + “”);

}

x = 5; // At this point x value is 5 and check there exist a function

sub2(); // So now call this function

function sub2() {

   var x;

   x = 10; // The value of x = 5 is replaced with x = 10

   sub1();

}

Dynamic scoping : x is 10.

You might be interested in
Linda is searching for a new job. Which information would her potential employers likely review in her social profile?
nasty-shy [4]
The answer will be A they would wanna know about her work history
3 0
3 years ago
Read 2 more answers
When you first purchase a notebook, make sure you have a ____ CD containing the installed OS so you can recover from a failed ha
stira [4]

When you first purchase a notebook, make sure you have a RECOVERY CD. It enables the restoration of the notebook computer.

A recovery disc is a disc that enables to restore the computer to the same condition when it was bought.

Moreover, a recovery drive refers to a separate partition in the notebook that must contain the required files to restore the device if the system becomes unstable.

A recovery disc can be considered as a drive used to keep a backup of the files (e.g., images) and other types of restoration data.

Learn more about recovery disc here:

brainly.com/question/14217813

5 0
2 years ago
The sum of the deviations of each data value from this measure of central location will always be zero. A. Median B. Standard de
JulijaS [17]

Answer:

C. Mean

Explanation:

Mean = (∑x_{i})/N

Median = central values when data is sorted

Mode = most repeated value

Standard deviation = \sqrt{sum(x_{i}-mean)^{2}/N}

In standard deviation, formula you may see that deviation is being calculated from the mean (central location). But here we take square of the value before adding all of them.

But if we just take sum(x - mean), it would be equal to zero.

<u>EXAMPLE</u>

Take 4, 9, 5 as data

mean = (4+9+5)/3 = 18/3 = 6

sum of deviations from mean = (4-6)+(9-6)+(5-6) = (-2)+(3)+(-1) = 0

8 0
3 years ago
Read 2 more answers
Requirements description:
Andrews [41]

Answer:

The code has been written in Java.

The source code of the file has been attached to this response. The source code contains comments explaining important lines of the program.

A sample output got from a run of the application has also been attached.

To interact with the program, kindly copy the code into your Java IDE and save as Cafe.java and then run the program.

Download java
<span class="sg-text sg-text--link sg-text--bold sg-text--link-disabled sg-text--blue-dark"> java </span>
75f69c356ebff0797de4ffcfb6f8c22e.png
8 0
3 years ago
Lost passwords set for documents in Microsoft® Word® documents can be retrieved in the backstage view. True False
Nat2105 [25]

Answer:

True

Explanation:

Hope this helped!

3 0
2 years ago
Read 2 more answers
Other questions:
  • George borrowed some equipment from his friend for recording his monologue for his art class. He got all the equipment except th
    15·1 answer
  • 15) the following statement describes government depository librearies , except:
    12·1 answer
  • An installed theme can be applied by clicking on a theme in the themes group on the ____ tab.
    7·2 answers
  • Overlay analysis is ____________, taking in data from two or more layers to create a single output layer.
    5·1 answer
  • If I use google incognito mode or a throwaway google account can my search history be tracked by Microsoft parental controls?
    7·1 answer
  • Write a Java program that prints out a 4x4 square (like the one below)
    11·1 answer
  • Which technology concept uses computer resources from multiple locations to solve a common problem?
    13·1 answer
  • How can injection attacks be prevented? Check all that apply
    6·2 answers
  • What report provides data on how specific sections of a website performed?
    6·1 answer
  • What is one of the limitations of marketing in social media?.
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!