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
Papessa [141]
3 years ago
15

Assume the following JavaScript program was interpreted using static-scoping rules. What value of x is displayed in function sub

1? 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:
kirill [66]3 years ago
6 0

Answer:

The value of x in both scope can be described as follows:

i) Static scope:

x=  5

ii) Dynamic scope:

x=10

Explanation:

The static scoping  is also known as an arrangement, which is used in several language, that defines the variable scope like the variable could be labelled inside the source that it is specified.

i) program:

function sub1()  //defining function sub1

{

  print("x = " + x + ""); //print value

}

function sub2()//defining function sub2

{

   var x; //defining variable x

   x = 10; //assign value in variable x

   sub1();  //caling the function sub1

}

x = 5; //assign the value in variable x

sub2(); //call the function sub2

In Dynamic scoping, this model is don't see, it is a syntactic mode that provides the framework, which is used in several program. It doesn't care how well the code has been written but where it runs.  

ii) Program:

var x //defining variable x

function sub1()  //defining a function sub1

{

print("x = " + x + ""); //print the value of x

}

x = 10; // assign a value in variable x

sub2(); // call the function sub2

function sub2() //defining function sub2

{

var x; //defining variable x

x = 5; // assign value in x

sub1();//call the function sub1

}

You might be interested in
To close a window in Windows 10, you can _____. Select all that apply. A. right-click its button on the taskbar, then click Clos
Nookie1986 [14]

Answer:

A, B and C

Explanation:

A, B and C

(The following is unrelated to the answer just to fill the letters criteria)

3 0
4 years ago
Gunther is filling in his own input mask. He wants to format the Social Security numbers of his clients. The field must contain
a_sh-v [17]
Last one I am not sure they
3 0
3 years ago
Bruh why is everyone skipping my question!!!!!!!
DiKsa [7]

Answer:

What is your question?

Explanation:

7 0
3 years ago
A device combined with a switch, router, and wireless access point is called what?
ra1l [238]

It is called a wireless router!

8 0
3 years ago
Read 2 more answers
Mention at least five devices used for digitizing data
creativ13 [48]
Answer:
1. Cloud Storage Solutions
2. Digital Communication Tools
3. Cloud ERP Systems
4. CRM Platforms
5. Digital Accounting Tools

For more information, please visit: https://www.gend.co/blog/the-digitisation-tools-with-the-biggest-impact-for-business?hs_amp=true

Hope this helps!!
3 0
2 years ago
Other questions:
  • What the address for dns server that the eorkstation will use?
    10·1 answer
  • If you see ##### in a cell, you should
    10·1 answer
  • If you're looking to install Gigabit Ethernet, what cabling system would you use?
    9·1 answer
  • PLEASE AWNSER 50 POINTS PLUS BRAINLEST ILL FAIL MY GRADE IF I DONT AWNSER IN A HOUR!
    15·1 answer
  • Display the total number of parking tickets.
    5·1 answer
  • Edhesive assignment 7 calendar
    10·1 answer
  • Where to get industrial circuits far cry 6
    8·1 answer
  • What is a benefit of an account with interest?
    5·1 answer
  • Which of the following BEST describes the part of video or movie creation during which filming occurs, digital modelers create a
    9·2 answers
  • Digital publishing software has increased the use of which of the following?
    15·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!