Download as pdf
Download as pdf
You are on page 1of 9
1 cane PAPER a ang Pole! solve any 008 ae fll | , zgand 5 0m = ose prime 10ers include anming mbes are este integer numbers W ae j1ed 10? « : af paring nb as 6-203 S01 prime factors aH a pis naming number 88 oxzand ita only 2 HS es eis an hamming number a8 8 aes ME 3,5 08pm is nora haming number a8 427 thas 7as one ofits PrHTC factor a4e2uxll Tens 1 as one oils re BS ynber oF a hamming number 88 js a Hamming "4 medi qc umber and check if ene ise, The De to accept any positive int than appropriate age if nega ing data and some random dats. Design a program rot. Display the result wit ‘ould also generate error mess “Test your program forthe follow Example ! inpurr: OUTPUT: 3600=2x2x2x +3600 IS A HAMMING NUMBER Enter any number: 3600 2x 3x3x5KS Example 2 INPUT: —_Enerany oumber: $832 5632 2x2x2x3x3x3K3K3NF 5832 IS A HAMMING NUMBER ourPUuT: Example3 INPUT: Enter any number 7854 OUTPUT: 1854=2x3x7x 11x17 788418 NOT A HAMMING NUMBER Examples INPUT: Entera number: -120 OUTPUT: | NEGATIVE NUMBER ENTERED. INVALID INPUT Question 2 Write a program to dec Matkov matrix or not. A 0 (i) area square matrix MI} of oder ‘N'. Check if the mati is a Dovbly ‘matrix which satisfies the following conditions are Doubly Markov matrix All elements are greater than or equal o 0 Sum of each row is equal tot. (ii) Sum of each column is equal to 1 ‘Accept *N’ from the user where 3 <= N = 9. Display an appropriate error message i Nis notin the given range or the entered numbers are negative. Allow the user to crate a matrix and check heer he created mati & Dobly Markov matix or not Test your program forthe following data and some random dat: Example INPUT: NSS Enier element inthe matrix: 05,025, 0.25, 025, 0.75, 00,025, 00, 0.78 OUTPUT: FORMED MATRIX aos 025 025 Vo2s 075 09 em 00 © 0.75 ITIS A DOUBLY MARKOV MATRIX Example 2 INPUT; NO To cmesin te mati: 15,3015, 025,4, 18,025, 10.3 TPT: FORMED MA ourruT: FORMED MATIX on 3 ons vas 4 tos 10 3 Ir 1SNOT A DOUBLY MARKOV MATRIX tangles wer: Enter elements inthe mat 08, -40,09,35 OUTPUT; NEGATIVE NUMBERS ENTERED. INVALID ENTRY Example 4 INPUT: oN ourrut: SIZE IS OUT OF RANGE. INVALID ENTRY questions A snow sing 2 sentence where 2 word is fan consecutive For example {am the Lord” is snowball string @S Lengnof word 5! Length of word 'am' 182 Length ‘of word “the” Is 3 Length of word “Lord! is 4 word sone more ta te PVCU word Hence ey are conseeue andin J words in the The length of each sscending ordet amo ener any sentence and check i ‘be separated by 2.0" ropriateefror Message Write a prost ivi a snowball string OF 90" sentence may a ninated by 7 or?” only ‘The program wll generat aPP 3g character. ram fo the following data and some random data! ‘Test your prog Example 1 He may give bons INPUT: rr is A SNOWBALL STRING ourput: 1 Example 2 INPUT: OUTPUT: IT IS A SNOWBALL STRING Is the cold wate frozen? Example 3 INPUT: Look before you leap. OUTPUT: IT IS NOT A SNOWBALL STRING Example INPUT: The child is father of the man! OUTPUT: INCORRECT TERMINATING CHARACTER. INVALID INPUT SAMPLE PAPER? fe any one ofthe following Problems. Question 1 Write program in JAVA to accept day number (between 1 and 366 (yyy) from the user ant display the comespoding date. Also accep °N’ fom the user where (LN 0) 0 compute and display the ae date N’ 6a afr the given date Display enor message if valu ofthe day number rN’ are not within the Timi Day number clelated aki ofthe given yearas | and y January Test your program with given set of dua and some random data Example | INPUT; DAY NUMBER: YEAR: 2023 N25 OUTPUT: ENTERED DATE: FEBRUARY 19,20 2SDAYS LATER: MARCH 16, 2023 Example? INPUT: DAY NUMBER: 321 YEAR: 2 a OUTPUT: ENTERED DATE: NOVEMBER 17, 2025 77 DAYS LATER: FEBRUARY 4 samples INPUT: DAY NUMBER: 00 YEAR: 2023 Nis ‘OUTPUT: INCORRECT DAY NUMBER INCORRECT VALUEOP'N) rafter removing secon tir. Four remain afer remo \ maine natura une Question 2 Lcky mmbers area sequence of mata numbers that Fad so on murbers respectively fm # sequence of al numbers 15,17,19 20 nat Removing every second number 1,350 9, 1h 13 rho umber roaces ie sequen 36717 13,1519 ne sequence 13.713, 5,19 Consider the sequence of first produces the sequence roving every fourth number produes th et the sequence I ile andthe five num Next 3,713.19 ype deletion Next rem ers that are lucky 10 €5¢a Further deleting every fifth number we iso possi lucky Deletion of every sinth number remain indefinitely Write a program to enter any posit he given natural number numbers less than th ‘est your program with the followin vena ber Ne Ne*SO) a4 generate 4g set of data Example 1 input: N-I0 urpur: LUCKY NUMBERS LESS THAN 10 ARE: 1,347 Example 2 input: N25 vrpuT: LUCKY NUMBERS LESS THAN 25 ARE: 1,37, 13,19 Example3 input: N=100 NUMBER NOT IN RANGE. INVALID ENTRY ourPuT: Qvestion y Wits progam onda mee ae arcgT 8 Sentence wh ae! ene by ier 9 Potedy asgletag Sand ar in UPPER Cage Perform the following ath: ©) Count unt oF! oly. The Of Vowels ang Consonants, ©) Generate the UPL ofthe fe SSNOnaES as shown gah Present in each word Test Your program, MY oF aba gah wee V denotes vowes and ¢ ‘rhe flowing daa nd sone "andor data Example INT: ROW Ans youn OUTPUT: Worp count How v ce ARE w c You wv c Example? INPUT: Goop pay: OvrruT WorD ——couyr > ow coor w y Day ve Examples INPUT: _LONGLIVE THE KING ourrur c INVALID INPUT INCORRECT TERMINATING CHARACTER BYVAL SAMPLE PAPER 3 Solve any one ofthe following Problems, Question 1 f Vampire number is a composite natural umber with an even nunber of digis that can fActored int wo natural numbers each with half as many digi ste crginal number and ot Example: 1260= 21 x 60( where, 21 and 60 contin precisely all the digits ofthe number ) Thus, 1260 isa Vampire number, Test your program forthe following data and some random data Example 1 INPUT: m= 1002 n= 1640 ourpur; ‘THE VAMPIRE NUMBERS ARE. 1260 1395 1435-1530 FREQUENCY OF VAMPIRE NUMBER IS: 4 Example 2 INpur: 810 = 7800 output: ‘THE VAMPIRE NUMBERS ARE: 1827 2187 6880 FREQUENCY OF VAMPIRE NUMBER IS:3, Example 3 INPUT: m=s105 n =9999 ourpur: ‘THE VAMPIRE NUMBERS ARE: NIL FREQUENCY OF VAMPIRE NUMBER IS:0 Example 4 input: m=im4 n=4500 ovrrur: INVALID INPUT r ‘Question 2 Writea 0 and Ny the rant Aaa A [ {Jf rder (M » N) where “Mi the numberof ows ee of columns such that both M and N must be greater than 2 and ess than 0 ite PU integers into this max. Display appropriate error message for an invalid Perform the following tasks on the matin (2) Display the input matrix (6) Rote 7 a i 7 ‘he matrix by 270° degrees anti clock wise and display the resultant matrix alculse the sum ofthe od element ofthe matrix and display ‘Test your program forthe following data and some random dat: Example 1 WPUT: wes Nes a ENTER ELEMENTS: 8, 7, 9, PTPUT: ORIGINALMATRDS, peed ros ra Os a3 Mee 4 ROTATED: ATRIX: (270° ANTI CLOCK WISE ) 04,513.64 cient et Beats 34 aa Dee? SUM OF THE ODD ELEMENT oe sample? Rent INPUT: M=3 ie 23 Naa ENTER ELEMENTS: 9,13,41, 5,6 5 OUTPUT: ORIGINALMATRIX ob 4 ee ROTATED MATROX (27 ANTI CLOCK WISE) $9 iar oa SUMOF THE 000 BLEMENTS = 63 amped ineets 0 OUTPUT: INVALIDINPUT Question 3 cof encryption technique. A keyword is used the Key, and it bet tothe plain alphabet. Repeats of letters inthe ied with the keyword matching to A,B: C are used in Keyword cipher is a form determines the letter matching the cipher alpha word are removed, then the cipher alphabet is generat vie. until the keyword is used up, whereupon the rest of the cipher text letters fiphabetical order, excluding those already used in the Ke. Encryption: The first line of input contains the string which you have to encrypt. Plaintext: A BCDEFGHI JK LMNOPQRS TUVWXYZ Encrypted: K RYPT OSABCD EFG HI LMNQUVWXZ With KRYPTOS as the keyword all A’s become K's all B's becoming R's, and soon 1 contains the keyword which you wish to enter. The second line of input Example’ KNOWLEDGE IS POWER when, Keyword is KRYPTOS VETPST BM IHVTL ext in upper case and a Keyword. Using the above technique Enerypling the message: De Decoded message: Write a program to accept a Coded t decrypt the text and display, Note: All he messages are encoded in uppercase Whitespace, special characters and ‘numbers remains unchanged. Test your program forthe following inputs: Example input: ENTERKEYWORD: SECRET ENTER TEXT TO BE DECODED: ZLJEFT DTOT ovrput: DECODED TEXT: ZOMBIE HERE Example? Input; ENTER KEYWORD: STAR WARS ENTER TEXT TO BE DECODED: SPPSAG SP RSV} ovrput: DECODEDTEXT: ATTACK AT DAWN Example 3 input: ENTER KEYWORD: PLAYERS ENTER TEXT TO BE DECODED: Haln de yok! output: INVALID TEXT

You might also like