Certified Associate in Python Programming (PCAP) — Question 121
Which of the following invocations are valid? (Choose two.)
Answer options
- A. sort(ג€pythonג€)
- B. ג€pythonג€.find(ג€ג€)
- C. ג€pythonג€.rindex(ג€thג€)
- D. 'python'.sorted()
Correct answer: B, C
Explanation
The correct answers are B and C because both find() and rindex() are valid methods for string objects in Python, allowing for search functionality. Option A is incorrect as sort() is not a method associated with strings, and option D is wrong since the sorted() function cannot be called as a method on a string object.