• +91 9971497814
  • info@interviewmaterial.com

Computer Interview Questions Answers

PYTHON Interview Questions Answers

Question - 11 : - How will you get all the keys from the dictionary?

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

Question - 12 : - What is the output of print tuple[2:] if tuple = ( 'abcd', 786 , 2.23, 'john', 70.2 )?

Answer - 12 : - It will print elements starting from 3rd element. Output would be (2.23, 'john', 70.200000000000003).

Question - 13 : - How will you check in a string that all characters are in lowercase?

Answer - 13 : - islower() − Returns true if string has at least 1 cased character and all cased characters are in lowercase and false otherwise.

Question - 14 : - What is the output of 3 in [1, 2, 3]?

Answer - 14 : - True

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

Answer - 15 : - Normal 0 false false false EN-US X-NONE X-NONE MicrosoftInternetExplorer4 In order to convert a number into a string, use the inbuilt function str().  If you want a octal or hexadecimal representation, use the inbuilt function oct() or hex(). /* 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 - 16 : - How will you check in a string that all characters are alphanumeric?

Answer - 16 : - isalnum() − Returns true if string has at least 1 character and all characters are alphanumeric and false otherwise.

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

Answer - 17 : - Normal 0 false false false EN-US X-NONE X-NONE MicrosoftInternetExplorer4 In Python, every name introduced has a place where it lives and can be hooked for. This is known as namespace. It is like a box where a variable name is mapped to the object placed.  Whenever the variable is searched out, this box will be searched, to get corresponding object. /* 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 - 18 : - Normal 0 false false false EN-US X-NONE X-NONE

Answer - 18 : - Normal 0 false false false EN-US X-NONE X-NONE MicrosoftInternetExplorer4 A Python decorator is a specific change that we make in Python syntax to alter functions easily. /* 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 - 19 : - How will you get titlecased version of string?

Answer - 19 : - title() − Returns "titlecased" version of string, that is, all words begin with uppercase and the rest are lowercase.

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

Answer - 20 : - Normal 0 false false false EN-US X-NONE X-NONE MicrosoftInternetExplorer4 PyChecker is a static analysis tool that detects the bugs in Python source code and warns about the style and complexity of the bug. Pylint is another tool that verifies whether the module meets the coding standard. /* 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;}

Computer Contributors

krishan
Rajeev Katiyar
Yes Baroda

Share your email for latest updates

Name:
Email:

Our partners