Python Interview Questions

Learn Python in Less than 8 Hrs Sitting @ Home /Desk with HandsOn

Q11. What is a runtime error?

Ans: These errors only appears when you run the program. This is also known as exceptions.

Q12. What is semantic errors?

Ans: Catching such errors are not easy. Until and unless you test the output. It means your program will run without any issue. It will successfully complete. But when you see the result than only you can say that there is an issue e.g. You want to add two numbers 2 and 3 and expected answer is 5, but program generate 6 (because instead of + sign, * has been used.).

Q13. What is the difference between interpreter and compiler?

Ans: Interpreter convert high level language line by line but for compiler entire program will be translated in low level language.

Q14. What do you mean by data type in Python?

Ans: This is a category of the data e.g. 23 is an int , 23.7 id a float and ‘Amit’ is a string type.

Q15. What is the variable in a python?

Ans: Its name to a value. You can refer a particular value using variable name like ‘Amit’ it is a value but will be referred using a variable called ‘name’

Q16. What is a function?

Ans: Function is a collection of statements, which is defined once and then call it later to do some executions. Below is the function definition example

def total_course_durations(c1,c2):
    training=curse_duration()
    training.hours=c1.hours+c2.hours
    training.minutes=c1.minutes+c2.minutes
    training.seconds=c1.seconds+c2.seconds
    return training

total_duration=total_course_durations(hadoop_training,spark_training)

Name of the function: total_course_duration

Statements: All orange color lines are statements.

return: It is a return statements.

total_duration: It is a variable, holding the values return by function call.

Function Arguments: These two variables are known as function arguments hadoop_training,spark_training

Q17. How do you convert data from one data type to another data types?

Ans: There are various functions available, which can help you convert data from one data types to another data type. See the example below

int(‘100’) -> 100 #Converting string to int
flaot(‘100.5’) -> 100.5 #Converting string to float
str(3.02) -> ‘3.02’ #Converting float to string

Q18. What is the module in Python?

Ans: Python module is any python file with .py extension, which contains functions and variables are known as Python Module. To use module in our current program we have to import it first. There are in-built modules which are provided by Python itself e.g. import math (Here, math is a Python module)

Q19. What do you mean by a fruitful functions?

Ans: Function, which return a value is known as fruitful function. E.g math.sqrt(4), it will return 2

Q20. What is void function?

Ans: Function which does not return a value is known as void function.

Learn Python in Less than 8 Hrs Sitting @ Home /Desk with HandsOn

Premium Training : Spark Full Length Training : with Hands On Lab

Previous Next

Home Spark Hadoop NiFi Java












Disclaimer :

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 |