0% found this document useful (0 votes)
32 views

Computer Project Questions

The document provides 15 programming problems involving string manipulation and pattern printing. The problems include printing various patterns using loops, accepting and manipulating sentences and strings, converting strings to uppercase and finding character frequencies, defining methods to operate on strings, and working with two-dimensional arrays.

Uploaded by

Eram Alameen
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
32 views

Computer Project Questions

The document provides 15 programming problems involving string manipulation and pattern printing. The problems include printing various patterns using loops, accepting and manipulating sentences and strings, converting strings to uppercase and finding character frequencies, defining methods to operate on strings, and working with two-dimensional arrays.

Uploaded by

Eram Alameen
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

1) Write a program to print the following pattern on the output screen.

*
**
***
****
*****

2) Write a program to print the following pattern on the output screen.


*
**
***
****
*****

3) Write a program to print the following pattern on the output screen


1
23
345
6789

4) Write a program to print the following pattern on the output screen


*
***
*****
***
*

5) Pg 425, program 1
6) Pg 427, program 3
7) Write a program to enter a string,convert it to uppercase and print the frequency of each
character
8) Write a program to accept a sentence which may be terminated by either a full stop, question
mark, or exclamation mark. The words may be separated by more than one blank space and are
in uppercase.
Perform the following tasks:
i) Accept the sentence and reduce all extra blank spaces between two words to a single
blank space.
ii) Accept a word from the user which is the part of a sentence along with its position
number and delete the word and display the sentence
9) Write a program to accept a sentence which may be terminated by either a full stop or question
mark only. The words are to be separated by a single blank only. Print an error message if the
sentence does not end with a full stop or question mark. You can assume that the number of
words does not exceed 15 so that you can get a proper formatted output.

Perform the following tasks:

i) Convert the first and last letter of each word to uppercase.


ii) Find the number of words beginning and ending with a vowel.
iii) Place the words ending and beginning with a vowel in the beginning followed by the words
as they occur in a sentence.
10) Write a program to enter a sentence and print the potential of each word and print it on the
output screen; presuming A as 1,B as 2 and so on. Decode each word, add the values to get thee
potential of the word.
11) Write a program to enter the number of rows and columns of a matrix. Enter the elements of
the matrix and print the matrix by rotating it by 90 degrees.
12) Write a program to define the following method which has a sentence as an argument and print
the original sentence along with the words that begin and end with a vowel.
13) Define a method void fun(String w) that accepts a word and finds the first occurrence of the
vowel, prints the latter half of the word first then the former half.
14) Write a program to use a class with the following specifications.
Class name- StringOP
Data members/instance variables- str, rev
Member methods-
StringOP()-constructor to initialize the data members
Void input()-to store a sentence in str
Void process()-to reverse string str and store the reversed string in rev. also print both strings
Void fun()- make use of string tokenizer class to find the no. of words and blanks available in the
string entered from the console.
15) Write a program to create a double dimensional array of size 5x5 and enter the elements in the
array and print the elements that are above the right diagonal.

You might also like