Solved

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

Question 31

Short Answer

The following is a program segment and the definition of a function named sub.
..X=3; def sub(Y):sub(X)Y=5; print (X);..\begin{array} { l r } .\\.\\\mathrm { X } = 3 ; & \text { def } s u b ( Y ) : \\\operatorname { sub } ( \mathrm { X } ) & \mathrm { Y } = 5 ; \\\text { print } ( \mathrm { X } ) ; &\\.\\.\end{array}
A. What value will be printed by the program segment if parameters are passed by value?
____________
B. What value will be printed by the program segment if parameters are passed by reference?
____________

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