Monday, February 21, 2022

String Intreview Question-Python

1. How would you confirm that 2 strings have the same identity?

2. How would you check if each word in a string begins with a capital letter?

3. Check if a string contains a specific substring

4. Find the index of the first occurrence of a substring in a string

5. Count the total number of characters in a string

7. Capitalize the first character of a string

8. What is an f-string and how do you use it?

9. Search a specific part of a string for a substring

10. Interpolate a variable into a string using format()

11. Check if a string contains only numbers

12. Split a string on a specific character

13. Check if a string is composed of all lower case characters

14. Check if the first character in a string is lowercase

15. Can an integer be added to a string in Python? Ans:It will through an error 16. Reverse the string “hello world”

17. Join a list of strings into a single string, delimited by hyphens

18. Check if all characters in a string conform to ASCII

19. Uppercase or lowercase an entire string 20-When would you use rfind()?

21-Remove vowels from a string

22-Does defining a string twice (associated with 2 different variable names) create one or two objects in memory?

23. What does it mean for strings to be immutable in Python?

24. Give an example of using maketrans() and translate()

25. Give an example of using the partition() function

26. Concatenate two strings

27. Capitalize the first character of each word in a string

28. Check if all characters are whitespace characters

29. Check if a string begins with or ends with a specific character?

No comments:

Post a Comment

"🚀 Delta Lake's Vectorized Delete: The Secret to 10x Faster Data Operations!"

"🚀 Delta Lake's Vectorized Delete: The Secret to 10x Faster Data Operations!" Big news for data engineers! Delta Lake 2.0+ in...