Python Interview Questions
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.
return (a+x) *(b+x)
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.
It will give output as below
Q64. What is the ideal way to copy sequences?
Ans : You should use slicing to copy sequence as below
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.
Q66. How is the below statement will be evaluated?
“x” in “a” , “x”
Ans : Please note that comma is not an operator. It is a separator. Hence, above statement will be evaluated as below.
(“x” in “a”) , “x”
And result will be as below
Q67. What is the value of below expression?
Val = X if X < Y else Y
Ans: Here Val will have 20. Because first condition is false, which will result in Y, which is 20.
Q68. How will you remove the duplicate elements from the list?
Ans: It’s very simple, as we know set contain only unique values. Hence, first convert list to set and then set back to list.
Q69. What is a Class?
Ans : You can say, it is a user defined object. It works as a template and hold attributes and functions.
Q70. What is self?
Ans: Self is a first argument of a method. A method defined as do_something(self, a, b, c) should be called as object.do_something(a, b, c) for some instance object of the class in which the definition occurs; the called method will think it is called as do_something(self, a, b, c).
- Spark Certification & Training Material
- Python Interview Questions-1
- Python Interview Questions-2
- Python Interview Questions-3
- Python Interview Questions-4
- Python Interview Questions-5
- Python Interview Questions-6
- Python Interview Questions-7
- Python Interview Questions-8
- Python Interview Questions-9
- Python Interview Questions-10
- Cloudera (Hadoop/Data Engineer) Certification
- Hortonworks (BigData) Certifications
Home Spark Hadoop NiFi Java
1. Hortonworks® is a registered trademark of Hortonworks.
2. Cloudera® is a registered trademark of Cloudera Inc
3. Azure® is aregistered trademark of Microsoft Inc.
4. Oracle®, Java® are registered trademark of Oracle Inc
5. SAS® is a registered trademark of SAS Inc
6. IBM® is a registered trademark of IBM Inc
7. DataStax ® is a registered trademark of DataStax
8. MapR® is a registered trademark of MapR Inc.
2014-2017 © HadoopExam.com | Dont Copy , it's bad Karma |