A directory of Objective Type Questions covering all the Computer Science subjects. Here you can access and discuss Multiple choice questions and answers for various compitative exams and interviews.

51. What is the output of the following?
print("xyyzxyzxzxyy".count('yy'))
a. 2
b. 0
c. error
d. none of the mentioned
View Answer Report Discuss Too Difficult! Search Google
Answer: (a).2

52. What is the output of the following?
print("xyyzxyzxzxyy".count('yy', 1))
a. 2
b. 0
c. 1
d. none of the mentioned
View Answer Report Discuss Too Difficult! Search Google
Answer: (a).2

53. What is the output of the following?
print("xyyzxyzxzxyy".count('yy', 2))
a. 2
b. 0
c. 1
d. none of the mentioned
View Answer Report Discuss Too Difficult! Search Google
Answer: (c).1

54. What is the output of the following?
print("xyyzxyzxzxyy".count('xyy', 0, 100))
a. 2
b. 0
c. 1
d. error
View Answer Report Discuss Too Difficult! Search Google
Answer: (a).2

55. What is the output of the following?
print("xyyzxyzxzxyy".count('xyy', 2, 11))
a. 2
b. 0
c. 1
d. error
View Answer Report Discuss Too Difficult! Search Google
Answer: (b).0

56. What is the output of the following?
print("xyyzxyzxzxyy".count('xyy', -10, -1))
a. 2
b. 0
c. 1
d. error
View Answer Report Discuss Too Difficult! Search Google
Answer: (b).0

57. What is the output of the following?
print('abc'.encode())
a. abc
b. ‘abc’
c. b’abc’
d. h’abc’
View Answer Report Discuss Too Difficult! Search Google
Answer: (c).b’abc’

58. What is the default value of encoding in encode()?
a. ascii
b. qwerty
c. utf-8
d. utf-16
View Answer Report Discuss Too Difficult! Search Google
Answer: (c).utf-8

59. What is the output of the following?
print("xyyzxyzxzxyy".endswith("xyy"))
a. 1
b. True
c. 3
d. 2
View Answer Report Discuss Too Difficult! Search Google
Answer: (b).True

60. What is the output of the following?
print("xyyzxyzxzxyy".endswith("xyy", 0, 2))
a. 0
b. 1
c. True
d. False
View Answer Report Discuss Too Difficult! Search Google
Answer: (d).False

Page 6 of 13