Python Interview Questions for Freshers 2020 Python Basic Inter

These Python interview questions for freshers 2020 will based on questions on python python basic interview questions to make you prepare for your upcoming python interview programs. Practice here program questions in python with these most asked python interview questions and answers. 1. How to install Python on Windows and set path variable Ans To install Python on Windows follow the below steps Install python from this link s www.python.org downloads After this install it on your PC. Look for the location where PYTHON has been installed on your PC using the following command on your command prompt cmd python.Then go to advanced system settings and add a new variable and name it as PYTHON_NAME and paste the copied path.Look for the path variable select its value and select edit .Add a semicolon towards the end of the value if it s not present and then type %PYTHON_HOME% 2. Mention the use of operator in Python Ans It is a Floor Divisionoperator which is used for dividing two operands with the result as quotient showing only digits before the decimal point. For instance 10 5 2 and 10.0 5.0 2.0. 3. How can the ternary operators be used in python Ans The Ternary operator is the operator that is used to show the conditional statements. This consists of the true or false values with a statement that has to be evaluated for it. Syntax The Ternary operator will be given as [on_true] if [expression] else [on_false]x y 25 50big x if x < y else y Example The expression gets evaluated like if x< y else y in this case if x< y is true then the value is returned as big x and if it is incorrect then big y will be sent as a result. 4. What is the purpose of operator Ans Exponent Performs exponential (power) calculation on operators. a b 10 to the power 20 if a 10 and b 20. 5. What is the purpose of operator Ans Floor Division The division of operands where the result is the quotient in which the digits after the decimal point are removed. 6. What is the purpose of is operator Ans is Evaluates to true if the variables on either side of the operator point to the same object and false otherwise. x is y here is results in 1 if id(x) equals id(y). 7. What is the purpose of not in operator Ans not in Evaluates to true if it does not finds a variable in the specified sequence and false otherwise. x not in y here not in results in a 1 if x is not a member of sequence y. 8. What are the two major loop statements Ans for and while 9. What is the purpose break statement in python Ans break statement Terminates the loop statement and transfers execution to the statement immediately following the loop. 10. What is the purpose continue statement in python Ans continue statement Causes the loop to skip the remainder of its body and immediately retest its condition prior to reiterating. 11. What is lambda function in python Ans lambda is a keyword in python which creates an anonymous function. Lambda does not contain block of statements. It does not contain return statements.12. What is the usage of help() and dir() function in Python Ans Ans Help() and dir() both functions are accessible from the Python interpreter and used for viewing a consolidated dump of built-in functions. Help() function The help() function is used to display the documentation string and also facilitates you to see the help related to modules keywords attributes etc.Dir() function The dir() function is used to display the defined symbols. 13. What is the difference between remove() function and del statement Ans You can use the remove() function to delete a specific object in the list. If you want to delete an object at a specific location (index) in the list you can either use del or pop. 14. What is split() and join() functions in Python Ans You can use split() function to split a string based on a delimiter to a list of strings.You can use join() function to join a list of strings based on a delimiter to give a single string. 15. What is map function in Python Ans map function executes the function given as the first argument on all the elements of the iterable given as the second argument. If the function given takes in more than 1 arguments then many iterables are given. Follow the link to know more similar functions. 16. What are docstrings in Python Ans Docstrings are not actually comments but they are documentation strings. These docstrings are within triple quotes. They are not assigned to any variable and therefore at times serve the purpose of comments as well. 17. Mention the use of the split function in Python Ans The use of the split function in Python is that it breaks a string into shorter strings using the defined separator. It gives a list of all words present in the string.18. What are tuples in Python Ans A tuple is another sequence data type that is similar to the list. A tuple consists of a number of values separated by commas. Unlike lists however tuples are enclosed within parentheses. 19. What is the difference between tuples and lists in Python Ans The main differences between lists and tuples are Lists are enclosed in brackets ( [ ] ) and their elements and size can be changed while tuples are enclosed in parentheses ( ( ) ) and cannot be updated. Tuples can be thought of as read-only lists. 20. What is zip() function in Python Ans Python zip() function returns a zip object which maps a similar index of multiple containers. It takes an iterable convert into iterator and aggregates the elements based on iterables passed. It returns an iterator of tuples. Source URL s gtecvesu.com python-interview-questions-for-freshers Name GTec VesuWebsite s gtecvesu.com Contact 91-89800-21008Email inquiry(at)gtecvesu.com or premware.education(at)gmail.comAddress F 4 Ofira Business Hub VIP Road Surat - 395007

Share:

Important!

There are a lot of advertisers on Advertigo. We cannot check them one by one.

You work hard for your money and you want a company you can rely on when you are buying or selling things. That’s why we want to help you protect yourself from fraud. In this section, you’ll find informative tips and other useful material to stay informed and help reduce your chances of falling victim to scammers.

Please understand that Advertigo.net is a free service to help buyers and sellers (and etc.) find one another. Advertigo.net is not involved in any transactions and can not police the actions of our many users.