String Manipulation || Type C || Sumita Arora || Class 11 || Computer science || Information practices || Solution




Q1. Write a program to count the number of times a character occurs in the given string.


Q2. Write a program which replaces all vowels in the string with '*'.


Q3. Write a program which reverses a string and stores the reversed string in a new string.


Q4. Write a program that prompts for a phone number of 10 digit and two dashes, with dashes after the area code and the next three numbers.
Display if the phone number entered is valid format or not and display if the phone number is valid or not.



Q5. Write a program that :-
(a) prompt the user for a string.
(b) extract all the digit from the string.
(c) if there are digits:-
(i) sum the collected digits together.
(ii) print out :    
    (1) the original string
    (2) the digits
    (3) the sum of the digits
(d) if there are no digits:
Print the original string and massage "has no  digit"



Q6. Write a program that should prompt the user to type some sentence (s) followed by “enter”. It should then print the original sentence (s) and the following statistics relating  to sentence (s):
(1) number of word
(2) number of character (including  white space and punctuation )
(3) percentage of character that are alpha numeric



Q7. Write a python program as per specifications given below:
(1) repeatedly prompt for  a sentence (string) or for “q” to quit .
(2) upon input of a sentence s, print  the string produced  form s by converting each lower case letter to upper case and each upper case letter to lower case
(3) all other character  are left unchanged



Q8. Write a program that does the following:
(i) Take two inputs: the first, an integer and the second, a string
(ii) from the input string extract all the digits in the order they occurred, from the string.
(a) if no digits occur, set the extracted digit to 0 .
(iii) add the integer input and digits extracted from the string together as integer .
(iv) print a string of the form:
“integer _input + string _ digits = sum”



Q9. On what principles does python compare two string? Write a program that takes two strings from the user and displays the smaller string in a single line and largest string as per this format :
1st  letter                        last  letter
    2nd  letter                2nd last letter
        3rd letter        3rd last letter
                    :



Q10. Write a program to convert given number into equivalent roman number (store its value as string).


Q11. Write a program that asks the user for a string (only single space between words) and returns an estimate of how many words are in the string.


Q12. Write a program to input a formula with some brackets and checks, and prints out if the formula has the same number of opening and closing parentheses.


Q13. Write a program that inputs a line of text and prints out the count of vowels in it.


Q14. Write a program to input a line of text and print the biggest word (length wise) from it.


Q15. Write a program to input a line of text and create a new line of text where each word of input line is reversed.




String Manipulation Sumita arora class 11
String Manipulation Sumita arora class 11 Type c solution

12 Comments

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

Post a Comment

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

Previous Post Next Post