Page-5

String

61)Positive index of a string starts from-
Last character First character
Second last character Second character
Answer :

62)Negative index of a string starts from-
Last character First character
second character No negative index
Answer :

63)Which one of the following is not a valid string operator?
+ *
/ in
Answer :

64)Which of the following function is used to count total number of characters in a string?
count() len()
index() none of these
Answer :

65)Which of the following functions is used to count the frequency of a character?
len() index()
count() all of these
Answer :

66)Which of the following functions returns a list of words of the string?
find() partition()
split() index()
Answer :

67)Which of the following functions returns the string in all capital letter?
toupper() upper()
isupper() to-upper()
Answer :


68)Which of the following functions will convert the string I love python programing to I Love Python Programing?
title() capitalize()
upper() istitle()
Answer :

69)Which of the following functions will returns a tuple having the string in 3 pieces?
split() partition()
upper() replace()
Answer :

70)Which of the following functions returns the character from ASCII code?
ord() char()
character() chr()
Answer :

71)The function that removes leading and trailing spaces is _____
lstrip() rstrip()
strip() all of these
Answer :

72)Which of the following will return last three characters of the string S?
S[3::] S[-3::]
S[::-3] S[:3:]
Answer :

73)What will be the output of the following code?
s='Hello'
print(s*2)
Hello2 HelloHe
HelloHello Error
Answer :

74)If a string contains letter and digit, then which function returns True?
isalpha() isdigit()
isalnum() none of these
Answer :

75)What will be the output of the following code?
s='This is Python'
d='123'
print(s.isdigit(), d.isalpha())
True True True False
False True False False
Answer :

This is page:5



Disclaimer: We have taken utmost care to keep the information error free. The site is not responsible for any kind of damage of whatsoever nature.
©Copy right reserved