Monday, September 14, 2026

Python find() Quiz

Python find() Quiz


1. What is the output? s = "Python Programming" print(s.find("Pro"))

   A. 6

   B. 8

   C. -1

   D. 7


2. What is the output? s = "banana" print(s.find("na"))

   A. 3

   B. 2

   C. 1

   D. 4


3. What is the output? print("hello world".find("world"))

   A. 6

   B. 5

   C. 7

   D. -1


4. What is the output? print("Python".find("Java"))

   A. None

   B. -1

   C. 1

   D. 0


5. What is the output? s = "programming" print(s.find("g"))

   A. 10

   B. 3

   C. 5

   D. 7


6. What is the output? s = "banana" print(s.find("a", 2))

   A. 5

   B. 3

   C. -1

   D. 1


7. What is the output? s = "banana" print(s.find("a", 4))

   A. -1

   B. 3

   C. 5

   D. 4


8. What is the output? print("mississippi".find("iss"))

   A. 0

   B. 2

   C. 4

   D. 1


9. What is the output? print("PYTHON".find("python"))

   A. 0

   B. 6

   C. 1

   D. -1


10. What is the output? print("hello".find(""))

   A. -1

   B. None

   C. 0

   D. 1


11. What is the output? s = "abcabc" print(s.find("abc", 1))

   A. 1

   B. 3

   C. -1

   D. 0


12. What is the output? s = "abcdef" print(s.find("cd", 0, 4))

   A. -1

   B. 1

   C. 2

   D. 3


13. What is the output? s = "abcdef" print(s.find("ef", 0, 5))

   A. 4

   B. 3

   C. -1

   D. 5


14. What is the output? print("banana".find("ana"))

   A. 2

   B. 3

   C. 0

   D. 1


15. What is the output? s = "Python Python" print(s.find("Python", 1))

   A. 0

   B. -1

   C. 7

   D. 6


16. What is the output? print("developer".find("lop"))

   A. -1

   B. 4

   C. 2

   D. 3


17. What is the output? s = "abracadabra" print(s.find("abra", 1))

   A. 7

   B. 3

   C. -1

   D. 0


18. What is the output? s = "cat cat cat" print(s.find("cat", 4))

   A. 4

   B. 5

   C. 0

   D. 8


19. What is the output? s = "python programming" print(s.find("python"))

   A. 1

   B. -1

   C. 0

   D. 7


20. What is the output? s = "hello hello" print(s.find("hello", 1))

   A. 5

   B. 0

   C. -1

   D. 6

No comments: