• +91 9971497814
  • info@interviewmaterial.com

Chapter 12- Strings Interview Questions Answers

Question 1 :
Explain capitalize( ) method in Python.

Answer 1 :

The method capitalize( ) returns a copy of the string with only its first character capitalized.

Question 2 :
Write the syntax for capitalize( ) method.

Answer 2 :

Following is the syntax for capitalize( ) method : str.capitalize( )

Question 3 :
What value will be returned by center (width, fillchar) method in Python.

Answer 3 :

The method center( ) returns centered in a string of length width. Padding is done using the specified fillchar.

Question 4 :
What are the two parameters of center( ) method.

Answer 4 :

width — This is the total width of the string,
fillchar — This is the filler character

Question 5 :
Describe the count(str, beg=0,end= len(string))

Answer 5 :

The method count( ) returns the number of occurrences of substring sub in the range [start, end].

Question 6 :
Describe the decode (encoding=’UTF8′, errors=’ strict’ )

Answer 6 :

The method decode( ) decodes the string using the codec registered for encoding.

Question 7 :
What do you mean by endswith(suffix, beg=0, end=len(string))

Answer 7 :

The method endswith( ) returns True if the string ends with the specified suffix, otherwise return False

Question 8 :
Write the the syntax for find( ) method

Answer 8 :

Following is the syntax for find( ) method :
str.find(str, beg=0 end=len(string))

Question 9 :
Write the syntax for isalnum( ) method.

Answer 9 :

Following is the syntax for isalnum( )
method :
str.isalnum( )

Question 10 :
Write the syntax for isalpha( ) method.

Answer 10 :

Following is the syntax for isalpha( ) method :
str.isalpha( )


Selected

 

Chapter 12- Strings Contributors

krishan

Share your email for latest updates

Name:
Email:

Our partners