• +91 9971497814
  • info@interviewmaterial.com

Computer Interview Questions Answers

PYTHON Interview Questions Answers

Question - 81 : - How will you get the max valued item of a list?

Answer - 81 : - max(list) − Returns item from the list with max value.

Question - 82 : - How will you convert a string to a long in python?

Answer - 82 : - long(x [,base] ) - Converts x to a long integer. base specifies the base if x is a string.

Question - 83 : - What is the output of [1, 2, 3] + [4, 5, 6]?

Answer - 83 : - [1, 2, 3, 4, 5, 6]

Question - 84 : - How will you convert a string to an int in python?

Answer - 84 : - int(x [,base]) - Converts x to an integer. base specifies the base if x is a string.

Question - 85 : - Normal 0 false false false EN-US X-NONE X-NONE

Answer - 85 : - Normal 0 false false false EN-US X-NONE X-NONE MicrosoftInternetExplorer4 Python sequences can be index in positive and negative numbers.   For positive index, 0 is the first index, 1 is the second index and so forth.  For negative index, (-1) is the last index and (-2) is the second last index and so forth. /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-priority:99; mso-style-qformat:yes; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin-top:0in; mso-para-margin-right:0in; mso-para-margin-bottom:10.0pt; mso-para-margin-left:0in; line-height:115%; mso-pagination:widow-orphan; font-size:11.0pt; font-family:"Calibri","sans-serif"; mso-ascii-font-family:Calibri; mso-ascii-theme-font:minor-latin; mso-hansi-font-family:Calibri; mso-hansi-theme-font:minor-latin; mso-bidi-font-family:"Times New Roman"; mso-bidi-theme-font:minor-bidi;}

Question - 86 : - What built-in type does python provide?

Answer - 86 : - Following are the most commonly used built-in types provided by Python: Immutable built-in types of python Numbers Strings Tuples Mutable built-in types of python List Dictionaries Sets

Question - 87 : - What is the output of print list[2:] if list = [ 'abcd', 786 , 2.23, 'john', 70.2 ]?

Answer - 87 : - It will print elements starting from 3rd element. Output would be [2.23, 'john', 70.200000000000003].

Question - 88 : - What are Python's dictionaries?

Answer - 88 : - Python's dictionaries are kind of hash table type. They work like associative arrays or hashes found in Perl and consist of key-value pairs. A dictionary key can be almost any Python type, but are usually numbers or strings. Values, on the other hand, can be any arbitrary Python object.

Question - 89 : - How will you convert a object to a string in python?

Answer - 89 : - str(x) − Converts object x to a string representation.

Question - 90 : - What are tuples in Python?

Answer - 90 : - 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.

Computer Contributors

krishan
Rajeev Katiyar
Yes Baroda

Share your email for latest updates

Name:
Email:

Our partners