St. Britto Hr. Sec. School - Madurai
12th Computer Science Monthly Test - 1 ( Strings and String manipulations )-Aug 2020
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
What is the use of title () function? Give example.
-
Write a program to create a mirror of the given string. For example, "weI" = "Iew".
-
Differentiate lower() and is lower().
-
Program to display the following pattern
*
* *
* * *
* * * *
* * * * *
str1=' * '
i=1
while i<=5:
print (str1*i)
i+=1 -
Write a program to accept a string and print it in reverse order.
-
Why 'in' and 'not in' operators are called membership operator? Explain with example.
-
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)) -
What is the use of format( )? Give an example.
-
How the positive and negative subscript valuesare assigned? Give example.
-
Write a note on
(i) isalnum ()
(ii) isalpha ()
(iii) isdigit () -
Write a Python program to display the given pattern
C O M P U T E R
C O M P U T E
C O M P U T
C O M P U
C O M P
C O M
C O
C -
-
Write the formats string characters for the following
(i) Exponential notation
(ii) Floating point numbers
(iii) Short numbers in exponential notation -
Write the output of the following statements.
(i) print (len ("Corporation"))
(ii) print ("school", Capitalize())
(iii) print ("Welcome" center (15, '*'))
-
-
Fill in the blanks
Format character
Usage
(i)
_______
Unsigned decimal integer
(ii)
% 0
_______
(iii)
_______
Hexadecimal integer
(iv)
% i
_______
-
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)) -
Program to create an Abecedarian series. (Abecedarian refers list of elements appear in alphabetical order)
str1="ABCDEFGH"
str2="ate"
for i in str1:
print ((i+str2),end='\t') -
-
Write the program to display the following pattern
* * * * *
* * * *
* * *
* * * -
Write a python program to print the following pattern
*
* *
* * *
* * * *
* * * * *
-
-
Write a python program to create an Abecedarian series, (Abecedarian refers list of elements appear in alphabetical order).
-
Write a python program to display the number of vowels and consonants in the given string.