Solved

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

Question 34

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

Unlock this Answer For Free Now!

View this answer and more for free by performing one of the following actions

qr-code

Scan the QR code to install the App and get 2 free unlocks

upload documents

Unlock quizzes for free by uploading documents