Python Advance Questions

Python Advance Questions:
This first part covers basic Python interview questions and answers
What are the different types of sequences in Python?
Answer:
Different types of sequences in Python are strings,Unicode strings, lists, tuples, buffers and xrange objects.
What is Lambda form in Python?
Answer:
Lambda keyword is used to create small random anonymous throw away functions.
What is Pickling in Python?
Answer:
Pickle is a standard module which serializes and de-serializes a python object structure.
How can an object be copied in Python?
Answer:
By using two ways objects can be copied in python: Shallow copy & Deep copy.
Let us move to the next Python Interview Questions.
How do I convert a string to a number?
Answer:
There are different built-in functions by which we can convert values from one data type to another.
Describe how to send email from a Python Script?
Answer:
The smtplib module is used to defines an SMTP client session object that can be used to send email using Pythons Script.
What is the command used for exiting help command prompt?
Answer:
The command name is “quit”
What does the split(), sub() and subn() methods do?
Answer:
Split()  its uses a regex pattern to split any given string into a created list.
Sub()  It will find all the substring where this regex pattern will match and then replace the string.
Subn()  It is similar to a sub(), it will return the new string along with the other no. of replacements.
Mention the way to display the text contents of the files in the reverse order?
Answer:
First, convert the file into the list and after that reverse this list by utilizing reversed ( ).
 What will append() and extend methods do?
Answer:
append( ) = adds the element at the end.
extend( ) = adds the elements of a different list at the end.
 What is TKinter?
Answer:
The Tkinter is the library of Python. It is one of the toolkits for developing the GUI.
What is the difference between Java and Python?
Answer:
Java has a static data type while Python has a dynamic typed-data type.

Post a Comment

0 Comments