Initializing the StringBuffer Class

Java : Initializing the StringBuffer Class Program List




Program [1]

Write a program that encodes a word into Piglatin. To translate word into a Piglatin word, convert the word into uppercase and then place the first vowel of the original word as the start of the new word along with the remaining alphabets. The alphabets present before the vowel being shifted towards the end followed by “AY”.

Sample 1:

Input  : London,

Output : ONDONLAY

Sample 2:

Input : Olympics,

Output : OLYMPICSAY



View Solution


Program [2]

Encryption is a technique of coding messages to maintain their secrecy. A String array of size ‘n’ where ‘n’ is greater than 1 and less than 10, stores single sentences (each sentence ends with a full stop) in each row of the array.

Write a program to accept the size of the array. Display an appropriate message if the size is not satisfying the given condition. Define a string array of the inputted size and fill it with sentences row-wise. Change the sentence of the odd rows with an encryption of two characters ahead of the original character. Also change the sentence of the even rows by storing the sentence in reverse order. Display the encrypted sentences as per the sample data given below:

Test your program on the sample data and some random data. Example 1 :

INPUT: n = 4

IT IS CLOUDY.

IT MAY RAIN.

THE WEATHER IS FINE. IT IS COOL.

OUTPUT: KV KU ENQWFA.

RAIN MAY IT.

VJG YGCVJGT KU HKPG. COOL IS IT.

Example 2 :

INPUT: n = 13

OUTPUT: INVALID ENTRY



View Solution


Program [3]

Write  a  program  to  accept  a  sentence as  input.  The  words  in  the  string  are  to   be   separated by a blank.  Each  word  must  be  in  upper  case.  The  sentence  is  terminated  by  either “.”,”!” or “?”. Perform the following tasks:

(i) Obtain the length of the sentence (measured in words).

(ii) Arrange the sentence in alphabetical order of the words.

Example 1

INPUT: NECESSITY IS THE MOTHER OF INVENTION.

OUTPUT:

LENGTH : 6

REARRANGED SENTENCE : INVENTION IS MOTHER NECESSITY OF THE

Example 2

INPUT: BE GOOD TO OTHERS.

OUTPUT:

LENGTH : 4

REARRANGED SENTENCE : BE GOOD OTHERS TO




View Solution


Program [4]

Write a program to accept a sentence which may be terminated by either ‘.’ ‘?’ or ‘!’ only. Any other character may be ignored. The words may be separated by more than one blank space and are in UPPER CASE.

Perform the following tasks:

(a) Accept the sentence and reduce all the extra blank space between two words to a single blank space.

(b) Accept a word from the user which is part of the sentence along with its position number and delete the word and display the sentence.

Test your program with the sample data and some random data



View Solution


CCC Online Test 2021 CCC Practice Test Hindi Python Programming Tutorials Best Computer Training Institute in Prayagraj (Allahabad) Best Java Training Institute in Prayagraj (Allahabad) Best Python Training Institute in Prayagraj (Allahabad) O Level NIELIT Study material and Quiz Bank SSC Railway TET UPTET Question Bank career counselling in allahabad Sarkari Naukari Notification Best Website and Software Company in Allahabad Website development Company in Allahabad