answer.
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
labwork [276]
2 years ago
4

Given the following calling sequences and assuming that dynamic scoping is used, what variables are visible during execution of

the last function called? Include with each visible variable the name of the function in which it was defined. a. main calls fun1; fun1 calls fun2; fun2 calls fun3. b. main calls fun1; fun1 calls fun3. c. main calls fun2; fun2 calls fun3; fun3 calls fun1. d. main calls fun3; fun3 calls fun1. e. main calls fun1; fun1 calls fun3; fun3 calls fun2. f. main calls fun3; fun3 calls fun2; fun2 calls fun1.
Computers and Technology
1 answer:
Strike441 [17]2 years ago
7 0

Answer:

see explaination

Explanation:

a) Main call fun1; fun1 calls fun2; fun2 calls fun3.

Answer:

Variables that are visible at the last function call:

a ------------- defined in main

b ------------- defined in fun1

c ------------- defined in fun2

d, e, f ------------- defined in fun3

b) Main call fun1; fun1 calls fun3.

Answer:

Variables that are visible at the last function call

a ------------- defined in main

b, c ------------- defined in fun1

d, e, f ------------- defined in fun3

c) Main calls fun2; fun2 calls fun3; fun3 calls fun1.

Answer:

Variables that are visible at the last function call:

a ------------- defined in main

e, f ------------- defined in fun3

b, c, d ------------- defined in fun1

d) Main calls fun3; fun3 calls fun1.

Answer:

Variables that are visible at the last function call:

a ------------- defined in main

e, f ------------- defined in fun3

b, c, d ------------- defined in fun1

e) Main calls fun1; fun1 calls fun3; fun3 calls fun2.

Answer:

Variables that are visible at the last function call:

a ------------- defined in main

b ------------- defined in fun1

f ------------- defined in fun3

c, d, e ------------- defined in fun2

f) Main calls fun3; fun3 calls fun2; fun2 calls fun1

Answer:

Variables that are visible at the last function call:

a ------------- defined in main

f ------------- defined in fun3

e ------------- defined in fun2

b, c, d ------------- defined in fun1

You might be interested in
Problem 1a. Write a function named hasFinalLetter that takes two parameters 1. strList, a list of non-empty strings 2. letters,
mash [69]

Answer:

The answer is the programming in Python language has strings and characters that has to be declared in the method.

Explanation:

#method

def hasFinalLetter(strList,letters):

output = #output list

#for every string in the strList

for string in strList:

#findout the length of each string in strList

length = len(string)

#endLetter is last letter in each string

endLetter = string[length-1]

#for each letter in the letters list

for letter in letters:

#compare with endLetter

#if we found any such string

#add it to output list

if(letter == endLetter):

output.append(string)

#return the output list

return output

#TestCase 1 that will lead to return empty list

strList1 = ["user","expert","login","compile","Execute","stock"]

letters1 = ["a","b","y"]

print hasFinalLetter(strList1,letters1)

#TestCse2

strList2 = ["user","expert","login","compile","Execute","stock"]

letters2 = ["g","t","y"]

print hasFinalLetter(strList2,letters2)

#TestCase3

strList3 = ["user","expert","login","compile","Execute","stock"]

letters3 = ["k","e","n","t"]

print hasFinalLetter(strList3,letters3)

8 0
2 years ago
Write the recursive function max_depth; it is passed a binary (any binary tree, not necessarily a binary search tree) and a valu
OleMash [197]

Answer:

A python code was used in writing of the recursive function max_depth; and passed a binary (any binary tree, not necessarily a binary search tree) and a value as arguments.

Explanation:

Solution

To solve this given question we make use of Python programming language.

Thus

THE CODE:

class BinaryTreeNode:

def __init__(self, value, left=None, right=None):

self.value = value

self.left = left

self.right = right

# recursive max_depth function implementation

def max_depth(tree, value):

if tree == None:

return -1

# recursive calls to this function

leftDepth = max_depth(tree.left, value)

rightDepth = max_depth(tree.right, value)

# return the maximum depth

if tree.value == value or leftDepth > -1 or rightDepth > -1:

return 1 + max(leftDepth, rightDepth)

else:

return max(leftDepth, rightDepth)

btn1 = BinaryTreeNode(2)

btn2 = BinaryTreeNode(3, None, btn1)

btn3 = BinaryTreeNode(3)

btn4 = BinaryTreeNode(3)

btn5 = BinaryTreeNode(2, btn2, btn3)

btn6 = BinaryTreeNode(1, btn4)

tree = BinaryTreeNode(3, btn5, btn6)

print('max_depth(tree, 1):',max_depth(tree, 1))

print('max_depth(tree, 2):',max_depth(tree, 2))

print('max_depth(tree, 3):',max_depth(tree, 3))

Note: Kindly find an attached copy of the Implementation of max_depth() function, Code to test the max_depth() function and the sample output below.

8 0
2 years ago
Create an array w with values 0, 0.1, 0.2, . . . , 3. Write out w[:], w[:-2], w[::5], w[2:-2:6]. Convince yourself in each case
larisa86 [58]

Answer:

w = [i/10.0 for i in range(0,31,1)]

w[:]  = [0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2.0, 2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 2.8, 2.9, 3.0]

w[:-2] = [0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2.0, 2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 2.8]

w[::5]= [0.0, 0.5, 1.0, 1.5, 2.0, 2.5, 3.0]

w[2:-2:6] = [0.2, 0.8, 1.4, 2.0, 2.6]

Explanation:

List slicing (as it is called in python programming language ) is the creation of list by defining  start, stop, and step parameters.

w = [i/10.0 for i in range(0,31,1)]

The line of code above create the list w with values 0, 0.1, 0.2, . . . , 3.

w[:]  = [0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2.0, 2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 2.8, 2.9, 3.0]

since start, stop, and step parameters are not defined, the output returns all the list elements.

w[:-2] = [0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2.0, 2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 2.8]

w[:-2] since  stop is -2, the output returns all the list elements from the beginning to just before the second to the last element.

w[::5]= [0.0, 0.5, 1.0, 1.5, 2.0, 2.5, 3.0]

w[::5] since  step is -2, the output returns  the list elements at index 0, 5, 10, 15, 20, 25,30

w[2:-2:6] = [0.2, 0.8, 1.4, 2.0, 2.6]

the output returns the list elements from the element at index 2  to just before the second to the last element, using step size of 6.

6 0
2 years ago
Moore’s Law is said to be more of a trend, rather than a representation of the actual number of transistors on a silicon chip. W
inna [77]

Answer:

Moores Law is defined to be the computer law which defines that the number of transistors on the integrated circuits will double time to time such as in an interval of 2 years. Moore's Law was coined by Intel employee, Gordon Moore.Moore's law is the observation that the number of transistors in a dense integrated circuit doubles about every two years. ... Moore's law describes a driving force of technological and social change, productivity, and economic growth.

Explanation:

Moore's Law is named after Intel cofounder Gordon Moore. He observed in 1965 that transistors were shrinking so fast that every year twice as many could fit onto a chip, and in 1975 adjusted the pace to a doubling every two years. ... Intel has suggested silicon transistors can only keep shrinking for another five years.Moore's law is the observation that the number of transistors in a dense integrated circuit doubles about every two years. ... Moore's law describes a driving force of technological and social change, productivity, and economic growth.Moore's law is the observation that the number of transistors in a dense integrated circuit doubles about every two years. ... Moore's law describes a driving force of technological and social change, productivity, and economic growth. Moore's law is an observation and projection of a historical trend.Moore's law is the observation that the number of transistors in a dense integrated circuit doubles about every two years. The observation is named after Gordon Moore, the co-founder of Fairchild Semiconductor and CEO of Intel, whose 1965 paper described a doubling every year in the number of components per integrated circuit,[2] and projected this rate of growth would continue for at least another decade.[3] In 1975,[4] looking forward to the next decade,[5] he revised the forecast to doubling every two years, a compound annual growth rate (CAGR) of 40%.[6][7][8]

The doubling period is often misquoted as 18 months because of a prediction by Moore's colleague, Intel executive David House. In 1975, House noted that Moore's revised law of doubling transistor count every 2 years in turn implied that computer chip performance would roughly double every 18 months (with no increase in power consumption).[9] Moore's law is closely related to MOSFET scaling, also known as Dennard scaling,[10] as the rapid scaling and miniaturization of silicon MOSFETs (metal-oxide-semiconductor field-effect transistors, or MOS transistors)[11][12] is the key driving force behind Moore's law.[10][13]

Moore's prediction proved accurate for several decades and has been used in the semiconductor industry to guide long-term planning and to set targets for research and development (R&D).[14] Advancements in digital electronics are strongly linked to Moore's law: quality-adjusted microprocessor prices,[15] memory capacity (RAM and flash), sensors, and even the number and size of pixels in digital cameras.[16] Digital electronics has contributed to world economic growth in the late twentieth and early twenty-first centuries.[17] Moore's law describes a driving force of technological and social change, productivity, and economic growth.[18][19][20][21]

Moore's law is an observation and projection of a historical trend. It is an empirical relationship and not a physical or natural law. Although the rate held steady from 1975 until around 2012, the rate was faster during the first decade. In general, it is not logically sound to extrapolate from the historical growth rate into the indefinite future. For example, the 2010 update to the International Technology Roadmap for Semiconductors predicted that growth would slow around 2013,[22] and in 2015, Gordon Moore foresaw that the rate of progress would reach saturation: "I see Moore's law dying here in the next decade or so."[23]

Microprocessor architects report that semiconductor advancement has slowed industry-wide since around 2010, below the pace predicted by Moore's law.[24] Brian Krzanich, the former CEO of Intel, announced, "Our cadence today is closer to two and a half years than two."[25] Intel stated in 2015 that improvements in device have slowed, starting at the 22 nm feature width around 2012, and continuing at 14 nm.[26] Krzanich cited Moore's 1975 revision as a precedent for the current deceleration, which results from technical challenges and is "a natural part of the history of Moore's law".[27][28][29] Leading semiconductor manufacturers, TSMC and Samsung Electronics, have the 10 nm and 7 nm nodes in

4 0
2 years ago
Why is it important to use standard english when applying for a job
algol13
To start of on the right foot with your boss by showing him/her that you can be professional, but not be intimidating. Hope this helped.
8 0
2 years ago
Read 2 more answers
Other questions:
  • Name an analog quantity other than temperature and sound.
    14·1 answer
  • Phillip is a wellness counselor. He has created a newsletter as a service for his clients. He needs to decide upon a method to d
    7·1 answer
  • When performing actions between your computer and one that is infected with a virus, which of the following offers NO risk of yo
    11·2 answers
  • Which of the following is NOT a method in which a macro can be run?
    10·1 answer
  • When you park on a hill, think about which way _____.
    6·2 answers
  • To reduce costs and the environmental impact of commuting, your company decides to close a number of offices and to provide supp
    11·1 answer
  • What technology gets its name from the notion that it ignores the traditional A, B, and C class designations for IP addresses?
    14·1 answer
  • Temperature Class Write a Temperature class that will hold a temperature in Fahrenheit and provide methods to get the temperatur
    6·1 answer
  • Return 1 if ptr points to an element within the specified intArray, 0 otherwise.
    7·1 answer
  • The Tell Me feature also includes access to the _____ feature.
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!