Q61. How do you find, if two variables are pointing to the same object or not?
Ans: You should have used is operator or build-in function id().
Q62. How can you return more than 1 value from a function?
Ans : You should have used tuple as a return value. If you want more than 1 value as a return value.
Q63. What do you mean by Higher-order function?
Ans : A function, which can accept other function as an arguments and return function to the caller is known as higher order fi=unction. See the example below.
def doOperation(a,b): def operation(x): return (a+x) *(b+x) return operation |
Here, doOperation function take two arguments a and b as input and return operation function as an output. So you call the function as below.
result=doOperation(5,10) result(10) |
It will give output as below
(5+10)*(10+10)=(15)*(20)=300
Q64. What is the ideal way to copy sequences?
Ans : You should use slicing to copy sequence as below
New_list=old_list[:]
Q65. Which method will you use to find all the methods and attributes of an Object of a class?
Ans : We will be using either help() or dir() method.