Documents

Computer Practicals

Categories
Published
of 5
All materials on our website are shared by users. If you have any questions about copyright issues, please report us to resolve them. We are always happy to assist you.
Related Documents
Share
Description
nn
Transcript
  Question 1- A palindrome is a word that may be read the same way in either direction. Accept a sentence in UPPER CASE which is terminated by either . , ? , or ! . Each word of the sentence is separated by a single blank space. Perform the following taks: (a) display the count of palindromic words in the sentence. (b) Display the palindromic words in the sentence. Example of palindromic words: MADAM, ARORA, NOON Test your program with the sample data and some random data: Example 1 INPUT : MOM AND DAD ARE COMING AT NOON OUTPUT : MOM DAD NOON NUMBER OF PALINDROMIC WORDS : 3 Example 2 INPUT : HOW ARE YOU? OUTPUT : NO PALINDROMIC WORDS Question 2- Write a program to input a natural number less than 1000 and display it in words. Test  your program on the sample data and some random data. Sample input and output of the program. Input: 29 Output: TWENTY NINE Input: 17001 Output: OUT OF RANGE Input: 119 Output: ONE HUNDRED AND NINETEEN Input: 500 Output: FIVE HUNDRED Question 2 Question 3 Design a program which accepts your date of birth in dd mm yyyy format. Check whether the date entered is valid or not. If it is valid, display VALID DATE , also compute and display the day number of the year for the date of birth. If it is invalid, display INVALID DATE and then terminate the program. Testing of the program Input: Enter your date of birth in dd mm yyyy format 05 01 2010 Output: VALID DATE 5 Input: Enter your date of birth in dd mm yyyy format 03 04 2010 Output: VALID DATE 93  Input: Enter your date of birth in dd mm yyyy format 34 06 2010 Output: INVALID DATE Input a paragraph containing 'n' number of sentences where (1<=n<=4). The words are to be separated with single blank space and are in upper case. A sentence may be terminated either with a full stop (.) or question mark (?). Perform the followings: (i) Enter the number of sentences, if it exceeds the limit show a message. (ii) Find the number of words in the paragraph (iii) Display the words in ascending order with frequency. Example 1: INPUT: Enter number of sentences: 1 Enter sentences: TO BE OR NOT TO BE. OUTPUT: Total number of words: 6 WORD FREQUENCY OR 1 NOT 1 TO 2 BE 2 Example 2: INPUT: Enter number of sentences: 3 Enter sentences: THIS IS A STRING PROGRAM. IS THIS EASY? YES, IT IS.  OUTPUT: Total number of words: 11 WORD FREQUENCY A 1 STRING 1 PROGRAM 1 EASY 1 YES 1 IT 1 THIS 2 IS 3 Question 2. The computer department of the Agency of International Espionage is trying to decode intercepted messages. The agency’s spies have determined that the enemy encodes messages by first converting all characters to their ASCII values and then reversing the string. For example, consider A_z (the underscore is just to highlight the space). The ASCII values for A, , z are 65, 32, 122 respectively. Concatenate them to get 6532122, then reverse this to get 2212356 as the coded message. Write a program which reads a coded message and decodes it. The coded message will not exceed 200 characters. it will contain only alphabets (A……Z, and a-z) and spaces. A  SCII values of A…..Z are 65……90 and those of a….z are 97 …… 122. test your program for the following data and some random data.
We Need Your Support
Thank you for visiting our website and your interest in our free products and services. We are nonprofit website to share and download documents. To the running of this website, we need your help to support us.

Thanks to everyone for your continued support.

No, Thanks