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
Dan wants to check the layout of his web page content. What is the best way in which he can do this?
KatRina [158]
The answer is b I hope it helped
4 0
3 years ago
Read 2 more answers
What does the process of email encryption involve??
stealth61 [152]

Answer: Option C

Explanation:

4 0
3 years ago
The field of ____ is concerned with the technical issues involved in information display. computer science
Nataliya [291]

The field of <u>Computer graphics</u> is concerned with the technical issues involved in the information display. The correct option is A.

<h3>What is computer graphics?</h3>

Computer graphics is a branch of computer science called computer graphics research techniques for digitally synthesizing and modifying visual content.

Even while the phrase is frequently used to describe the study of three-dimensional computer graphics, it also includes image processing and two-dimensional graphics. This section works for information display.

Thus, the correct option is A. Computer graphics.

To learn more about computer graphics, refer to the link:

brainly.com/question/1169945

#SPJ4

The question is incomplete. Your most probably complete question is given below:

Computer graphics

computer-aided visualization

computer visualization

engineering graphics

7 0
2 years ago
Write an algorithm for a program which inputs the lengths a, b and c of the three
Dmitriy789 [7]

Hello,

Answer:

<h2>--//Triangles Algorithm</h2>

Declare the variables of the side of each triangle, in this case, a, b, and c, and input them.

If a^2 == b^2 + c^2

           display "This triangle IS right-angled."

Else

          display "This triangle is NOT right-angled

Explanation:

The meaning of the word "algorithm" in this situation would be the coding of the program that you are assigned to create. I'll use Python in this. Display, in this case, will mean "print"

6 0
3 years ago
Read 2 more answers
A device is sending out data at the rate of 1000 bps. How long does it take to send
vredina [299]

Answer:

0.01 second ; 0.008 seconds; 800 seconds

Explanation:

Given that:

Sending rate = 1000 bps

Rate of 1000 bps means that data is sent at a rate of 1000 bits per second

Hence, to send out 10 bits

1000 bits = 1 second

10 bits = x

1000x = 10

x = 10 / 1000

x = 0.01 second

2.)

A single character 8 - bits

1000 bits = 1 second

8 bits = (8 / 1000) seconds

= 0.008 seconds

3.)

100,000 characters = (8 * 100,000) = 800,000

1000 bits = 1 second

800,000 bits = (800,000 / 1000)

= 800 seconds

4 0
3 years ago
Other questions:
  • Human-centered technology often recommends _______ao
    13·2 answers
  • Its false because I got it wrong
    5·1 answer
  • A proactive computer professional will _____. have a neutral outlook toward technology underestimate the impact of technology an
    13·2 answers
  • I'm a number less then 40000.all my digits are multiples of 3.my first third a d fifth digits are the same both of my thousands
    10·1 answer
  • During the boot process, the computer performs a quick self diagnostic then loads the operating system into memory.... IS THIS T
    5·1 answer
  • Create a Java program that will store 10 student objects in an ArrayList, ArrayList. A student object consists of the following
    14·1 answer
  • What are the two extra registers that the fetch decode execute cycle uses to communicate with memory outside of the chip?
    9·1 answer
  • Update thejavafile names to include your initials at the end, send .java file only.1. Completein-place heapSort, which takes an
    11·1 answer
  • Print a test page what is the answer.​
    9·2 answers
  • "what is the common information listed under the ip section of pdu details as compared to the information listed under the osi m
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!