• Courses
  • Tutorials
  • Jobs
  • Practice
  • Contests

Python String Quiz

Question 11

Question 11: What is the output of the following program? Python3
var1 = \'Hello Geeks!\'	
var2 = \"GeeksforGeeks\"

print ( var1[0], var2[1:5])
  • H eeks
  • H eek
  • H eeksf
  • H Geeks

Question 12

Question 12: What is the output of the following program? Python3
var1 = \'Geeks\'

print(var1[:4] + \'for\' + \'Geeks\') 
  • GeeksforGeeks
  • GeekforGeek
  • GeekforGeeks
  • GeekForGeeks

Question 13

Question 13: What is the output of the following program? Python3
print (\'C:\\\\inside C directory\')
  • C:\\inside C directory
  • C:\\\\inside C directory
  • inside C directory
  • Error

Question 14

Question 14: What is the output of the following program? 

Python:

[caption width="800"] [/caption]
  • [caption width="800"] [/caption]
  • [caption width="800"] [/caption]
  • [caption width="800"] [/caption]
  • [caption width="800"] [/caption]

Question 15

Question 15: What is the output of the following program? 

Python3
print (\'\\x25\\x26\')
  • \\x25\\x26

  • \'\\x25\\x26\'

  • %&

  • &%

Question 16

Question 16: What is the output of the following program? Python3
a = \"GeeksforGeeks \"

b = 13

print (a + b) 
  • GeeksforGeeks13
  • 13GeeksforGeeks
  • GeeksforGeeks
  • Error

Question 17

Question 17: What is the output of the following program? Python3
def gfgFunction(): 
	\"Geeksforgeeks is cool website for boosting up technical skills\"
	return 1

print (gfgFunction.__doc__[17:21]) 
  • is
  • cool
  • website
  • for

Question 18

Question 18: What is the output of the following program? Python3
a = \"This is a string\"
print a 
  • This is a string
  • a
  • "This is a string"
  • Error

Question 19

Question 19: What is the output of the following program? Python3
a = \"This is a string\"
print(a.count(\"i\"))
  • 1
  • 2
  • 3
  • 4

Question 20

What will be the output of the following Python expression if x=56.236?

print("%.2f"%x)

  • 56.236

  • 56.23

  • 56.24

  • 56.0000

There are 21 questions to complete.

Last Updated :
Take a part in the ongoing discussion