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
Please help!!
Likurg_2 [28]

Answer:

D. Server

Explanation:

A server is a computer or system that provides resources, data, services, or programs to other computers, known as clients, over a network. In theory, whenever computers share resources with client machines they are considered servers.

If this helps, mark me Brainliest!!

8 0
2 years ago
Read 2 more answers
Explain each of the three important concepts behind the Federal Networking Council's definition of the term Internet. Explain ho
maria [59]

Answer:

The three important concepts in the Federal Networking Council's definition of the Internet are, namely;

  • Packet switching
  • The TCP/IP communications protocol
  • Client/server computing

Explanation:

  • Packet switching involves the transfer of data which are grouped into different packets and then sent over a digital network to their respective destination. After the data are received at the destination site, they are then extracted and used by the application software.
  • The transmission control protocol/internet protocol allows one computer to connect or communicate with another one through the internet. The internet protocol defines how to route and address each packet to ensure it gets to the right destination. The IP address of a particular device on a network is usually unique to that device.
  • Client/server computing describes how a server provides services by taking requests from clients computers and sharing its resources with one or more computers.
7 0
3 years ago
What seems to be the prevailing opinion about enterprise clouds?
garik1379 [7]
Used by almost everyone
3 0
3 years ago
Read 2 more answers
Which layer in the Transmission Control Protocol/Internet Protocol (TCP/IP) model is responsible for delivering data between two
s2008m [1.1K]

Answer:

Network.

Explanation:

The Transmission Control Protocol/Internet Protocol (TCP/IP) model is a standard networking protocol which allows network devices such as routers, switches, and host computers to interconnect and communicate with one another over a network. The Transmission Control Protocol/Internet Protocol (TCP/IP) model comprises of four (4) layers and these includes;

I. Application layer.

II. Transport layer.

III. Internet layer.

IV. Network layer.

The network layer in the Transmission Control Protocol/Internet Protocol (TCP/IP) model is responsible for delivering data between two nodes.

Basically, this layer known as network layer is the fourth layer of the Transmission Control Protocol/Internet Protocol (TCP/IP) model and it is typically responsible for the transmission of packets from one network device to another.

4 0
3 years ago
Suppose x = 10 and y = 20. The value of the expression
Vladimir [108]

Answer:

true

Explanation:

The given operators && and || are Logical operators whose execution is from left to right.so first (x>=10)&&(y>20) will be executed .Given values for x and y are 10 ,20 (10>=10 true)&&(10>20 false), which gives result as false (&& evaluates to true only when both conditions are true).so the result of this is false. next condition is ||. for this (20>=10)&&(20>20) is false and (x<y)(10<20) is true, which gives result as true.(|| evaluates to true if any one is true).

The Answer is True

7 0
3 years ago
Other questions:
  • Website reputation is an important part of page quality (PQ) rating. Reputation can justify the Highest rating and the Lowest ra
    15·1 answer
  • How long before a speech should you begin practicing?
    10·2 answers
  • What are the three major functions of a game engine?
    15·1 answer
  • Which of the following, (1) money deposited in a bank account, (2) student recording her answer to a question in an online test,
    14·1 answer
  • How to write (c program) code for 30/4 = 7.5. It should print 7.5, not 7
    12·1 answer
  • Which is true about POP3 and IMAP for incoming email?
    14·1 answer
  • A technician recently fixed a computer with several viruses and spyware programs on it and notices the Internet settings were se
    15·1 answer
  • How many questions do you have to answer before you can use direct messages on Brainly?
    13·2 answers
  • Please help me on this it’s due now
    5·1 answer
  • A(n) __________ looks and acts just like a publicly accessible website and uses the same software, hardware, and networking tech
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!