Question

(10pts).   Consider the following: void fun1(void); void fun2(void); void fun3(void); void main() {    Int a,b,c;...

  1. (10pts).   Consider the following:

void fun1(void);

void fun2(void);

void fun3(void);

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.

  1. Main calls fun1; fun1 calls fun2; fun2 calls fun3
  2. Main calls fun1; fun1 calls fun3
  3. Main calls fun2; fun2 calls fun3; fun3 calls fun1
  4. Main calls fun3; fun3 calls fun1
  5. Main calls fun1; fun1 calls fun3; fun3 calls fun2
  6. Main calls fun3; fun3 calls fun2; fun2 calls fun1

5) Write a Python programs to solve the following. Run your code and submit the code and screenshots of the results to the link in Blackboard.

  1. (5pts) An electronics company sells circuit boards that cost $21.99. Assume tax is 9%. Print the total price of 3 circuit boards

  1. (5pts) Write a program that asks the user for his score on an exam. The program will then use a function to calculate the user’s grade using (90-100, A, 80-89 B, 70-79 C, etc)

  1. (5pts) Scientist measure an object’s mass in kilograms and its weight in newtons. The equation is weight = mass * 9.8. Write a program that asks the user to enter an object’s mass and then calculates and displays its weight. If the object weighs more than 1,000 newtons display a message indicating that it is very heavy otherwise display a message indicating that it is very light.

  1. (5pts) Using the following names: Kerry, Thomas, Marina, Kevin, Jose, Gina, Josephine. Write a program that prints only the names that begin with J or K.
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Ans to Ques no 1:

1. variable (a from main), (b from function f1), (c from function f2), (d,e,f from function fun3) will be visible.

2. variable (a from main), (b,c from function f1), (d,e,f from function fun3) will be visible.

3. variable (a from main), (b,c,d from function f1), (e,f from function fun3) will be visible.

4. variable (a from main), (b,c,d from function f1), (e,f from function fun3) will be visible.

5. variable (a from main), (b from function f1), (c,d,e from function f2), (f from function fun3) will be visible.

6. variable (a from main), (b,c,d from function f1), (e from function f2), (f from function fun3) will be visible.

Ans to Ques no 2:

Code for question a:

output:

Code for question b:

Output:

Code for question c:

Output:

Code for question d:

output:

Add a comment
Know the answer?
Add Answer to:
(10pts).   Consider the following: void fun1(void); void fun2(void); void fun3(void); void main() {    Int a,b,c;...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • programming languages in #f language QUESTION 4 Consider the following skeletal C program: void funi(void); /*...

    programming languages in #f language QUESTION 4 Consider the following skeletal C program: void funi(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, Assuming that dynamic scoping is used, what variables are visible during execution of the last function called in following calling sequence: main calls...

  • I need Notebook++ coding! Thanks so much I will upvote! <!DOCTYPE html> <html> <body> <!-- replace...

    I need Notebook++ coding! Thanks so much I will upvote! <!DOCTYPE html> <html> <body> <!-- replace the text below with your name!-->    <!-- -->    <!-- -->    <title> Jason Kidwell</title> <script> // // Scientists measure an object’s mass in kilograms and its weight in newtons. // If you know the amount of mass of an object in kilograms, you can calculate // its weight in newtons with the following formula: // //       weight=mass×9.8 // // Write a...

  • 16 Points) Question 3 Write down the outputs of the following program into the provided table include <iostream> using namespace std; void fun I(int a); int fun2(int a, int b); int x-3: int...

    16 Points) Question 3 Write down the outputs of the following program into the provided table include <iostream> using namespace std; void fun I(int a); int fun2(int a, int b); int x-3: int main) int x-1,y 0,z-2; x-fun2(y,z); cout sx fun 1 (z); cout (#xtytz(endl; y-fun2(x,x); cout <exty+zscendl; system("pause"); void fun 1 (int a) int fun2(int a, int b) int static c2; return atx; 16 Points) Question 3 Write down the outputs of the following program into the provided table...

  • Write a main function that declares the names, marks, number of elements as well as the...

    Write a main function that declares the names, marks, number of elements as well as the value to be searched for and the index of the returned function calls. Read and display the contents of names and marks. Ask the user for a name and using the linear search return the index to the user. If -1 is returned then the name is not in the file. Otherwise write out the name and mark for that student. Sort the arrays...

  • This lab is to give you more experience with C++ Searching and Sorting Arrays Given a...

    This lab is to give you more experience with C++ Searching and Sorting Arrays Given a file with data for names and marks you will read them into two arrays You will then display the data, do a linear search and report if found, sort the data, do a binary search. Be sure to test for found and not found in your main program. Read Data Write a function that reads in data from a file using the prototype below....

  • 2. Write a MIPS program that translates the following C code int a 1234; b 5678 int sum void main () atb sum = cout &lt...

    2. Write a MIPS program that translates the following C code int a 1234; b 5678 int sum void main () atb sum = cout <<sum; } 2. Write a MIPS program that translates the following C code int a 1234; b 5678 int sum void main () atb sum = cout

  • in c++ language 1.Re-write the following for loop statement by using a while loop statement: int...

    in c++ language 1.Re-write the following for loop statement by using a while loop statement: int sum = 0; for(int i=0;i<=1000;i++){                 sum+=i; } 1 (b). Following is the main () function of a program. The program asks a user to enter 150 integers and print the largest integer user entered. int main() {    int score, highest;             //missing portion of the program             return 0;    } 1(c). Find the missing portion of the following code, so the...

  • *********C Language******* Write a file final_main.c 4. Inside main(void): Write a loop that oops until the...

    *********C Language******* Write a file final_main.c 4. Inside main(void): Write a loop that oops until the entered number is 0 or negative 5. Ask the user to enter a positive int between 0 and 10 inclusive 6. If the number is < 1, it terminates. 7. Else: call the above four functions 8. Print the result of each function after its call. Q2. Write a program that removes the punctuations letters from a file and display the output to the...

  • In this program, you will be using C++ programming constructs, such as functions. main.cpp Write a...

    In this program, you will be using C++ programming constructs, such as functions. main.cpp Write a program that asks the user to enter an integer value. Your program will then display that integer back to the user. Your program should include a function called getInteger that requests an integer value from the user and returns that value back to the caller. Your main () function will call the function getInteger and will then display the value returned by that function....

  • Programming language C Please go through this carefully. Needs function void add(int *a1, int n, int...

    Programming language C Please go through this carefully. Needs function void add(int *a1, int n, int *a2) Write a program addition.c that reads in an array (a1) of numbers, and creates a new array (a2) of numbers such that the first and last numbers of a1 are added and stored as the first number, the second and second-to-last numbers are added and stored as the second number, and so on. You need to check for even and odd length of...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT