• +91 9723535972
  • info@interviewmaterial.com

PYTHON Interview Questions and Answers

Related Subjects

PYTHON Interview Questions and Answers

Question - 11 : - What is the output of print str if str = 'Hello World!'?

Answer - 11 : - It will print complete string. Output would be Hello World!.

Question - 12 : - What is the output of print str[0] if str = 'Hello World!'?

Answer - 12 : - It will print first character of the string. Output would be H.

Question - 13 : - What is the output of print str[2:5] if str = 'Hello World!'?

Answer - 13 : - It will print characters starting from 3rd to 5th. Output would be llo.

Question - 14 : - What is the output of print str[2:] if str = 'Hello World!'?

Answer - 14 : - It will print characters starting from 3rd character. Output would be llo World!.

Question - 15 : - What is the output of print str * 2 if str = 'Hello World!'?

Answer - 15 : - It will print string two times. Output would be Hello World!Hello World!.

Question - 16 : - What is the output of print str * 2 if str = 'Hello World!' ?

Answer - 16 : - It will print string two times. Output would be Hello World!Hello World!.

Question - 17 : - What is the output of print str + "TEST" if str = 'Hello World!'?

Answer - 17 : - It will print concatenated string. Output would be Hello World!TEST.

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

Answer - 18 : - It will print complete list. Output would be ['abcd', 786, 2.23, 'john', 70.200000000000003].

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

Answer - 19 : - It will print first element of the list. Output would be abcd.

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

Answer - 20 : - It will print elements starting from 2nd till 3rd. Output would be [786, 2.23].


NCERT Solutions

 

Share your email for latest updates

Name:
Email:

Our partners