Solved

The Following Is a Program Segment and the Definition of a Function

Question 12

Short Answer

The following is a program segment and the definition of a function named sub.
X=8˙ def sub():  sub() x˙=2 print (X).\begin{array} { l c } \mathrm { X } = \dot { 8 } & \text { def sub(): } \\\text { sub() } & \dot { \mathrm { x } } = 2 \\\text { print } ( \mathrm { X } ) & \cdot \\. & \cdot\end{array}
A. What value will be printed by the program segment if X of function sub is a global variable?
___________
B. What value will be printed by the program segment if X of function sub is a local variable?
___________

Correct Answer:

verifed

Verified

Unlock this answer now
Get Access to more Verified Answers free of charge

Related Questions