St. Britto Hr. Sec. School - Madurai
12th Computer Science Monthly Test - 2 ( Strings and String manipulations )-Aug 2020
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
How will you delete a string in Python?
-
What is String?
-
What is meant by stride?
-
Write the output of the following statements.
(i) print (len ("Corporation"))
(ii) print ("school", Capitalize())
(iii) print ("Welcome" center (15, '*')) -
Write the output of the following statements.
strl = 'mammals'
(i) strl. find ('rna')
(ii) strl. find ('rna', 2)
(iii) strl. find ('mi, 2, 4)
(iv) strl. find ('mi, 2, 5) -
What is the use of format( )? Give an example.
-
Program to slice substrings using for loop
str1="COMPUTER"
index=0
for i in str1:
print (str1[:index+1])
index+=1 -
Write a program to accept a string and print it in reverse order.
-
Write the syntax and example of using string characters.
-
-
Write the out put for the following statement.
strl = "Raja Raja Chozhan"
(i) print (strl. count ('Raja'))
(ii) print (strl. count ('R'))
(iii) print (strl. count ('A'))
(iv) print (strl. count ('a'))
(v) print (strl. count ('a', 0, 5))
(vi) print (strl . count ('a', 11)) -
Write the description for the following escape sequence.
(i) \r
(ii) \000
(iii) \v
-
-
Write a python program that accept a string from the user and display the same after removing vowels from it.
-
Program that count the occurrences of a character in a string
def count(s, c):
c1=0
for i in s:
if i == c:
c1+=1
return c1
str1=input ("Enter a String: ")
ch=input ("Enter a character to be searched: ")
cnt=count (str1, ch)
print ("The given character {} is occurs {} times in the given string".format(ch,cnt)) -
-
Write the program to display the following pattern
* * * * *
* * * *
* * *
* * * -
Write a python program to check whether the given string is palindrome or not.
-
-
Write a python program to print the following pattern
*
* *
* * *
* * * *
* * * * * -
Program that accept a string from the user and display the same after removing vowels from it
def rem_vowels(s):
temp_str=''
for i in s:
if i in "aA
eEiIoOuU":
pass
else:
temp_str+=i
print ("The string without vowels: ", temp_str)
str1= input ("Enter a String: ")
rem_vowels (str1)