Start learning 50% faster. Sign in now
In Python, arguments are passed to functions using pass-by-object-reference , a hybrid approach where the behavior depends on the object’s mutability. For mutable objects (e.g., lists, dictionaries), functions can modify the object directly, as the reference points to the same memory location. For immutable objects (e.g., integers, strings), any attempt to modify them results in a new object being created, leaving the original object unchanged. For example: def modify_list(lst): lst.append(4) my_list = [1, 2, 3] modify_list(my_list) print(my_list) # Output: [1, 2, 3, 4] In the case of immutables: def modify_int(x): x += 1 num = 5 modify_int(num) print(num) # Output: 5 This illustrates that Python’s approach is neither traditional pass-by-value nor pass-by-reference. Why Other Options Are Incorrect:
Which of the following was/were the necessary steps taken by the government to minimize the impact of inflation and supply shortage on the vulnerable se...
What is the new threshold for the Basic Services Demat Account (BSDA) as per SEBI's recent guidelines?
With reference to United Nations Development Programme (UNDP) report on HDI, consider the following statements:
1. There has been a decl...
Which of the following is not a major gold trading center?
Branches of an Indian bank in GIFT-IFSC can act as a ____ of India International Bullion Exchange.
A.Trading and Clearing Member (TCM)
B.T...
Which pension fund scheme is open to all citizens of India and provides a defined contribution to the account?
Who among the following can issue Certificate of Deposits to raise short term resources?
Which organization has been designated as the Nodal Agency for issuing guarantee cover under the Credit Enhancement Guarantee Scheme for Scheduled Caste...
What is the primary function of global financial centers (GFCs)?
Foreign currency exchange risk in case of Non-Resident (Banks) scheme (FCNB) is borne by?