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
frosja888 [35]
3 years ago
11

Consider the following skeletal C program: void fun1(void); /* prototype */ void fun2(void); /* prototype */ void fun3(void); /*

prototype */ void main() { int a, b, c; . . . } void fun1(void) { int b, c, d; . . . } void fun2(void) { int c, d, e; . . . } void fun3(void) { int d, e, f; . . . } 256 Chapter 5 Names, Bindings, and Scopes 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:
natita [175]3 years ago
8 0

Answer:

Check the explanation

Explanation:

a) main calls fun1; fun1 calls fun2; fun2 calls fun3

fun3()                                        d, e, f

fun2()                                        c, d, e

fun1()                                        b, c, d

main()                                        a, b,c

CALL STACK SHOWING THE VARIABLES OF EVERY FUNCTION

   From the above call stack diagram, it is very clear that the last function call is made to fun3().

   In fun3(), the local variables "d, e, f" of fun3() will be visible

   variable "c" of fun2() will be visible

   variable "b" of fun1() will be visible

   variable "a" of main() will be visible

b) main calls fun1; fun1 calls fun3

fun3()                                        d, e, f

fun1()                                        b, c, d

main()                                        a, b,c

CALL STACK SHOWING THE VARIABLES OF EVERY FUNCTION

   From the above call stack diagram, it is very clear that the last function call is made to fun3().

   In fun3(), the local variables "d, e, f" of fun3() will be visible

   variable "b, c" of fun1() will be visible

   variable "a" of main() will be visible

c) main calls fun2; fun2 calls fun3; fun3 calls fun1

fun1()                                        b, c, d

fun3()                                        d, e, f

fun2()                                        c, d, e

main()                                        a, b,c

CALL STACK SHOWING THE VARIABLES OF EVERY FUNCTION

   From the above call stack diagram, it is very clear that the last function call is made to fun1().

   In fun1(), the local variables "b, c, d" of fun1() will be visible

   variable "e, f" of fun3() will be visible

   variable "a" of main() will be visible

d) main calls fun1; fun1 calls fun3; fun3 calls fun2

fun2()                                        c, d, e

fun3()                                        d, e, f

fun1()                                        b, c, d,

main()                                        a, b,c

CALL STACK SHOWING THE VARIABLES OF EVERY FUNCTION

   From the above call stack diagram, it is very clear that the last function call is made to fun2().

   In fun2(), the local variables "c, d, e" of fun2() will be visible

   variable "f" of fun3() will be visible

     variable "b" of fun1() will be visible

   variable "a" of main() will be visible

The last function called will comprise of all its local variables and the variables other than its local variables from all its preceding function calls till the main function.

You might be interested in
Your assignment is to write an assembly language program which read a string and print it in uppercase. This program asks the us
const2013 [10]

Answer:

try this

Explanation:

MSG1 DB 10,13,'enter any string:-$'

MSG2 DB 10,13,'converted string is:-$'

P1 LABEL BYTE

M1 DB 0FFH

L1 DB?

P11 DB 0FFH DUP<'$'>

DATA ENDS

DISPLAY MARCO MSG

MOV AH,9

LEA DX,MSG

INT 21H

ENDM

CODE SEGMENT

ASSUME CS: CODE,DS:DATA

START:

MOV AX,DATA

MOV DS,AX

DISPLAY MSG1

LEA DX,P1

MOV AH,0AH

INT 21H

DISPLAY MSG2

LEA SI,P1

MOV CL,L1

MOV CH,0

CHECK:

CMP[SI],61H

JB DONE

CMP[SI],5BH

UPR: SUB[SI],20H

DONE: INC SI

LOOP CHECK

DISPLAY P11

MOV AH,4CH

INT 21H

CODE ENDS

END START

4 0
3 years ago
Que es un proyecto técnico?
deff fn [24]

Answer:

Explanation:

La gestión técnica de proyectos es la capacidad de apoyar la gestión de una iniciativa de TI desde un concepto hasta un entregable concreto como un proyecto con conocimientos técnicos especializados. ... Esto puede depender de la organización o cultura geográfica de los diferentes países, o incluso del tamaño del proyecto.

7 0
3 years ago
Read 2 more answers
write an algorithm that gets two values: the price for item A and the quantity purchased. The algorithm should then print the to
pochemuha

Answer:

Explanation:

price = eval(input("price of item: "))

quantity = eval(input("quantity of item: "))

sales_tax = 0.08 # 8% sales tax

total_cost = price*quantity

total_cost_with_tax = total_cost + total_cost*sales_tax

print("total cost: "+str(total_cost))

print("total cost + 8% sales tax: "+str(total_cost_with_tax))

5 0
4 years ago
Which of the following best describes open source software?
sp2606 [1]
What was the options they gave you?
5 0
3 years ago
Read 2 more answers
The primary purpose of an ids is to detect intrusions, log suspicious events, and send alerts.
Kamila [148]

Hello, Mochacon, so to answer this question, we must understand what and ids is. A intrusion detection system (IDS) is a device or software application that monitors network or system activities for malicious activities or policy violations and produces electronic reports to a management station. IDS come in a variety of "flavors" and approach the goal of detecting suspicious traffic in different ways. So according to this definition, this statement is true since and ids does detect intrusions, detects suspicious events indeed, and sends alerts when intrusions happen.

Hope this helped!

3 0
3 years ago
Other questions:
  • A(n) ____ tag is used to let the compiler know that your intention is to override a method in a parent class
    10·1 answer
  • Nonvolatile in the context of data storage means ________________. a. the data can't be changed in a data warehouse. b. the data
    11·1 answer
  • What's the first step in being a wise consumer of media?
    10·2 answers
  • A switch has just arrived from Cisco. The switch has never been configured with any VLANs, but VTP has been disabled. An enginee
    13·1 answer
  • Hey guys, quick question:<br><br> What are the positives and negative’s of GUI’s??
    5·2 answers
  • Select the correct answer.
    5·1 answer
  • How many times will an infinite loop repeat?
    9·1 answer
  • A data table is a range that displays what?
    15·2 answers
  • As part of its commitment to sustainability, a company is looking for a way to track the source of purchased goods and how they
    14·2 answers
  • Understanding that protection of sensitive unclassified information is:
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!