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
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
ADVERTISEMENT