Questions on String Handling and ASCII

1.  Accept a name and print it in reverse form.

2.  Accept a sentence and then count number of vowel present in it. Also find out frequency of each vowel present in it.

3.  Accept a sentence and then print no of character present in it.

4.  Accept a sentence then count number of word present in it.

5.  Write programs to accept any word and check whether the word is palindrome or not.

6.  Write a program to accept a name. Then display the ASCII value of each character present in that name.

7.  Write a program to accept a sentence, then display how many characters, vowels and words present in that sentence.

8.  Write a program to accept a name (in first name & last name format), then display that name in short format. (for Example - SACHIN TENDULKAR becomes S. TENDULKAR

9.  Write a program to accept a name and convert that name to upper case. (Assume that the input name is in lower case)

10. Write a program to accept any name and convert it to proper case.

11. Write a program to accept any string and then convert each �A� to �AN� present in that string. Then print the string. (Note: remember �A� should not be a part of a word?).

12. Accept two strings, a word and a sentence. Then find number of times the word is present in given string. If I enter �THE� and �THE BIG FAT THE ODORE�, then the computer should display 2.

13. Vikalp has a terrible habit of deleting the last two letters of a word beginning with �E� and adding a single letter �O� in their place. Write a program to convert the following word (Edit, Exterminate, Ellipse, End, and Eleanor) according to Vikalp habit.

14. Write a basic program for converting capital letters of a string into small letters. For example:

    Input: MY NAME IS SUMIT

    Output: my name is sumit

15. If ASCII code of a to z are 97 to 122, then state the output when the following are printed:

        I.   ASC(CHR$(100))

        II.  CHR$(100,9)

        III. ASC(�x�) - ASC(�m�)

16. Write a program in BASIC to take a proverbial statement (like �Failure are the pillars of success�) as an input from the user and then output the frequency of the vowels occurring in the statement.

17. Write a program in BASIC to read a word. Print the position of the first vowel occurring in the word and terminate the program with a �Thank you� message. If there is no vowel in the word then print �Sorry�.

18. Write a program to find the ASCII code of the following basic characters: I, J, 9, > and ?

19. Write a program in BASIC to enter any string and calculate the following :

        i)    Total number of digits present in it.

        ii)   Total number of small letters present in it,

        iii)  Total number of capital letters present in it.

20. Prepare an interactive program in BASIC to accept a person�s first, middle and last names in a single variable and then display in short form.

21. In Piglatin a word such as KING is replaced by INGKAY, TROUBLE becomes OUBLETRAY as so on. The first vowel of the original word becomes the starting of the translation and proceeding letter being shifted towards the end and followed by AY. Word that begins with a vowel is left unchanged. Write a program in BASIC to accept a word and convert in to Piglatin word.

22. A person enters a number, which can be up to, the range of 100 digits. Write a BASIC program which will change all the 21�s to 22�s. For example: if the person enters - 593315882167521, the computer should display 593315882267522.

23. Write a program to read any 15 numbers. Give the output of numbers in words.

        For example Number is: 102

        Output: One Zero Two

24. Write a basic program to enter any 20 numbers. Calculate and print the sum of the numbers in which the first digit is greater then 4 as well as divisible by 2.

25. Write a program to find the character represented by the even ASCII code number from 40 to 80.

26. Write a program to decode the message conveyed by the ASCII code number: 065     100  118  097  110  099  101

27. Write a program searching for a character give by user in the word �INTERNATIONAL� and then printing its position if it is present, otherwise display a message not found.

28. Write a program to accept any sentence and convert capital letter into small letter and small letter into capital letter.

29. Write a program to accept any name then print name in isosceles triangle form.

30. Write a program to find the percentage of occurrence of alphabets, numeric digits and special character present in a string.

31. Write a program to accept two names. Then prepare a name, which is created by taking one by one character from each name. (For e.g. if given names are SUROJIT, RISHABH Output: SRUIRSOHJAIBTH)

32. Write a program to accept a sentence then convert each character to second next character. The character A becomes C, Y becomes A and Z becomes B.

33. A name is to be said as odd name if the ASCII code of each character become an odd number. Writes a program to accept a name and check whether the given name is odd name or not.

34. Write a program to accept a binary number and convert it to decimal number. Also convert each binary digit to its compliment and then convert it to decimal number.

35. Write a basic program for converting a sentence in reverse. (Input: BASIC IS PROGRAMMING       Output: PROGRAMMING IS BASIC)