• +91 9971497814
  • info@interviewmaterial.com

Computer Interview Questions Answers

PYTHON Interview Questions Answers

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

Answer - 51 : - Normal 0 false false false EN-US X-NONE X-NONE MicrosoftInternetExplorer4 1.Python memory is managed by Python private heap space. All Python objects and data structures are located in a private heap. The programmer does not have an access to this private heap and interpreter takes care of this Python private heap. 2.The allocation of Python heap space for Python objects is done by Python memory manager.  The core API gives access to some tools for the programmer to code. 3.Python also have an inbuilt garbage collector, which recycle all the unused memory and frees the memory and makes it available to the heap space. /* 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 - 52 : - How will you check in a string that all characters are digits?

Answer - 52 : - isdigit() − Returns true if string contains only digits and false otherwise.

Question - 53 : - Explain the dictionary in Python.

Answer - 53 : - • Python's built-in data type is dictionary, which defines one-to-one relationships between keys and values. • Dictionaries consist of pairs of keys and their corresponding values. • Dictionaries are indexed by keys. • Dictionary is similar to associative array or hash table of other languages. • As following example explains further- India, Angel & Cartoon are keys & their corresponding values are Bharat, Mother Teresa & Mickey respectively. >>> dict = {'India': 'Bharat', 'Angel': ‘Mother Teresa’, 'Cartoon': 'Mickey'} >>>print dict[India] Bharat >>>print dict[Angel] Mother Teresa

Question - 54 : - What is the output of L[1:] if L = [1,2,3]?

Answer - 54 : - 2, 3, Slicing fetches sections.

Question - 55 : - How will you set the starting value in generating random numbers?

Answer - 55 : - seed([x]) − Sets the integer starting value used in generating random numbers. Call this function before calling any other random module function. Returns None.

Question - 56 : - How will you convert a single character to its integer value in python?

Answer - 56 : - ord(x) − Converts a single character to its integer value.

Question - 57 : - How will you get all the values from the dictionary?

Answer - 57 : - Using dictionary.values() function, we can get all the values from the dictionary object. print dict.values()   # Prints all the values

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

Answer - 58 : - Normal 0 false false false EN-US X-NONE X-NONE MicrosoftInternetExplorer4 A Python documentation string is known as docstring, it is a way of documenting Python functions, modules and classes. /* 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 - 59 : - How will you check in a string that all characters are whitespaces?

Answer - 59 : - isspace() − Returns true if string contains only whitespace characters and false otherwise.

Question - 60 : - What is the output of L[2] if L = [1,2,3]?

Answer - 60 : - 3, Offsets start at zero.

Computer Contributors

krishan
Rajeev Katiyar
Yes Baroda

Share your email for latest updates

Name:
Email:

Our partners