Concept explainers
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;
. . .
}
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 fun 2; fun2 calls fun3; fun3 calls fun1.
- d. main calls fun 3; fun 3 calls fun l.
- e. main, calls fun 1; fun 1 calls fun 3; fun 3 calls fun 2.
- f. main calls fun 3; fun 3 calls fun 2; Calls fun 1.
Want to see the full answer?
Check out a sample textbook solutionChapter 5 Solutions
Concepts of Programming Languages (11th Edition)
Additional Engineering Textbook Solutions
Starting out with Visual C# (4th Edition)
Starting Out with Java: From Control Structures through Objects (6th Edition)
Modern Database Management (12th Edition)
Programming in C
Starting Out with Python (3rd Edition)
Java How to Program, Early Objects (11th Edition) (Deitel: How to Program)
- Please do in ruby only. Correct and detailed answer will upvoted else downvoted. To learn as quickly as time permits the most recent news about their number one in a general sense new working framework, BolgenOS people group from Nizhni Tagil chose to foster a plan. As per this plan a local area part, who is quick to become familiar with the news, calls another part, the last mentioned, in his turn, calls some third part, etc; for example an individual with list I got an individual with list fi, to whom he needs to call, on the off chance that he learns the news. With time BolgenOS people group individuals comprehended that their plan doesn't work at times — there were situations when a few individuals didn't become familiar with the news by any stretch of the imagination. Presently they need to enhance the plan: they add into the plan a few directions of type (xi, yi), which imply that individual xi needs to call individual yi too. What is the base measure of guidelines that they…arrow_forwardImplement in C programming language Question 1 Write a program in c to detect if the system will face any deadlock in the future. If a deadlock is detected then print “Deadlock Ahead” otherwise print “Safe here”. The situation is given below. (Allowed to use Banker’s Algorithm). Note: The code can be implemented in several different ways, but make sure the parameter remains the same as shown below. n = 5; // Number of processes m = 4; // Number of resources int alloc[5][4] = { { 0, 1, 0, 3 }, // P0 // Allocation Matrix { 2, 0, 0, 0 }, // P1 { 3, 0, 2, 0 }, // P2 { 2, 1, 1, 5 }, // P3 { 0, 0, 2, 2 } }; // P4 int max[5][4] = { { 6, 4, 3, 4 }, // P0 // MAX Matrix { 3, 2, 2, 1 }, // P1 { 9, 1, 2, 6 }, // P2 { 2, 2, 2, 8 }, // P3 { 4, 3, 3, 7 } }; // P4 int avail[4] = { 3,…arrow_forwardWrite the following program in C++. ÒMake a Class Named point that represents a point with x and y coordinates on a 2D plane ÒMake class Named line that represents a line on a 2D Plane and it has a start point and an end point ÒMake a triangle class that is composed of three lines ÒMake a rectangle class that is composed of four linesarrow_forward
- Accomplish the following for the given class diagram. Elevator 1. Create the class implementation using C++ upDirection 2. Create one object from class Elevator and store it in the stack memory. 3. Create one object from class Elevator and store it in the heap memory. 4. Test all the functions of the two objects • currentFloor: int • move (numFloors : int): void stop (): void + status (): stringarrow_forwardPlese solve this following question of the concept of object and class in Java program. Please answer this as soon as possible. Thank you in advance.arrow_forwardThe phrase "virtual machine" is used to refer to the environment in which a Java class is executed, but what does it imply exactly? The distinction between this virtual computer and a real machine that executes C-language code is explained below.arrow_forward
- Plese help me with this: The following Java program needs to be converted to C++, with .h and cpp files. PROGRAM Employee.java //Abstract class Employee abstract class Employee { // Attributes of the class private String firstName; private String lastName; private String SSN; // Getters and setters public String getFirstName() { return firstName; } public void setFirstName(String firstName) { this.firstName = firstName; } public String getLastName() { return lastName; } public void setLastName(String lastName) { this.lastName = lastName; } public String getSSN() { return SSN; } public void setSSN(String sSN) { SSN = sSN; } /* * Abstract method getEarnings, this method will be implemented by all child * classes */ public abstract double getEarnings(); // toString method public String toString() { return "firstName=" + firstName + ", lastName=" + lastName + ", SSN=" + SSN; } // Equals method public boolean equals(Object obj) { // TODO Auto-generated method stub return…arrow_forwardRun the following Java code in Netbeans and draw a UML class diagram to model the program. Java Code: //include the required packageimport java.io.*;import java.util.*;//create a main classpublic class experiment{ //definition of the main function public static void main(String args[]) { //create the object of the Scanner class Scanner in=new Scanner(System.in); //declare the required variables and arrays int time[]=new int[10]; float weight[]=new float[10]; String get; char ch; int i=0; //start of do while loop do { //try block try { System.out.print("\nEnter the…arrow_forwarduse Object-Oriented programming concepts to design and implement a system in python for building a scientific calculator which inherits its basic operations from a standard calculator where the standard calculator can perform two types of operations: addition and a subtraction The standard calculator is capable of inputting only two integers. But the scientific calculators can also interpret decimal values. The scientific calculator is capable of four operations: addition, subtraction, cosine, and sine of values. The scientific calculator can accept multiple values for the addition operation.arrow_forward
- Write a Java classarrow_forwardProvide the UML class diagram for the program below. import java.util.ArrayList; import java.util.Scanner; //Define the class Fraction class Fraction { private int n, d; public Fraction() { this.n = this.d = 0; //Initialize the values } public Fraction(int n, int d) { this.n = n; //Initialize the variables this.d = d; } //Define the getter function getNum() that returns the numerator public int getNum() { //Returns numerator return n; } //Define the getter function getDen() that returns the denominator public int getDen() { //Returns denominator return d; } //Define the boolean function isZero() that returns 0 if numerator is 0 and denominator is not equals to zero public boolean isZero() { return(getNum() == 0 && getDen() != 0); } //Define the function getSimplifiedFraction() that returns the simplified fraction public String getSimplifiedFraction() { //Decalre the string variable result to store the result String result = ""; //if the numerator and…arrow_forwardPrograms developed in dynamically typed programming languages like Lisp and Python are unlike those produced in static typed programming languages like C++ and Java. Talk about the benefits and drawbacks of each typing style.arrow_forward
- EBK JAVA PROGRAMMINGComputer ScienceISBN:9781305480537Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENTEBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENT