Computer Science Project Class 11
Computer Science Project Class 11
Algorithm
Step 1: Start
Step 2: Setup to assign a given sentence by the user to a variable
Step 3: Checking for special characters like ‘.’,’?’,’!’ etc. If found
going to Step 9.
Step 4: Iterating a loop to return all the characters.
Step 5: If a vowel is found then storing its index and checking for a
vowel at the end of that word if true then Step 6, if false then
Step:7.
Step 6: If a vowel at the end is found then storing it in a String
‘vowel’ and incrementing a counter ‘cc’.
Step 7: No vowel is found then storing the word in a String
‘consonant’.
Step 8: Displaying the counter and the concatenated Strings of
‘vowel’ and’ consonant’.
Step 9: Stop.
CODE
VARIABLE DESCRIPTION TABLE
Algorithm
Step 1: Start
Step 2: Setup to assign the lower and the upper limit from user.
Step 3: Checking if the lower limit is greater than upper limit or if
both are equal. If true then going to Step 9.
Step 4: Iterating a loop to generate all numbers from the lower
limit to the upper limit by an increment of one.
Step 5: Checking if the number returned by Step 4 is Prime or not.
Step 6: If Step 5 is true then checking if the number with an
increment of 2is prime or not
Step 7: If Step 5 is true then printing both numbers as twin prime
numbers.
Step 8: Returning to Step 4 if upper limit not satisfied.
Step 9: Stop.
CODE
VARIABLE DESCRIPTION TABLE
OUTPUTS
PROJECT QUESTION 3
Write a Program in Java to input a 2-D square matrix and check whether
it is an Upper Triangular Matrix or not.
Upper Triangular Matrix: An Upper Triangular matrix is a square matrix
in which all the entries below the main diagonal () are zero. The entries
above or on the main diagonal themselves may or may not be zero.
Example:
5307
0198
0046
0002
Algorithm
Step 1: Start
Step 2: Setup to assign the memory of the Array and elements of
the Array from the User.
Step 3: Displaying the Array entered by the User.
Step 4: Checking for each element below the main diagonal is
zero or not.
Step 5: If Step 4 is false then displaying appropriate message and
going to Step 7.
Step 6: If Step 4 is True then displaying appropriate message and
going to Step 7.
Step 7: Stop.
CODE
VARIABLE DESCRIPTION TABLE
OUTPUTS
PROJECT QUESTION 4
A Circular Prime is a prime number that remains prime under cyclic
shifts of its digits. When the leftmost digit is removed and replaced at
the end of the remaining string of digits, the generated number is still
prime. The process is repeated until the original number is reached
again.
A number is said to be prime if it has only two factors 1 and itself.
Example:
131
311
113
Hence, 131 is a circular prime. Write a program to display all the
circular prime numbers from 1 to 200.
Algorithm
Step 1: Start
Step 2: Setup to iterate all numbers from 1 to 200
Step 3: Checking if a number is Prime or not.
Step 4: If Step 3 is true then checking number of digits. As loop is
from 1 to 200 maximum three digit number is possible.
Step 5: If number of digits is 1 then displaying the number directly.
Step 6: If number of digits is 2 then checking if the number in
reverse order is Prime and displaying.
Step 7: If number of digits is 3 then checking if the reverse and
first and last digit swapped number is true or not.
Step 8: If Step 7 is true then displaying the number.
Step 9: Stop.
CODE
VARIABLE DESCRIPTION TABLE
cc int counter
OUTPUT
PROJECT QUESTION 5
Write a Program in Java to input a 2-D array of size ‘m*n’
and print the given array and its boundary (border)
elements. For Example
Input: - Output:-
1 2 3 4 5 1 2 3 4 5
6 7 8 9 10 6 10
11 12 13 14 15 11 15
16 17 18 19 20 16 17 18 19 20
Algorithm
Step 1: Start
Step 2: Setup to assign the memory of the Array and elements of
the Array from the User.
Step 3: Displaying the Array entered by the User.
Step 4: Iterating a loop to generate all the elements.
Step 5: Checking if an element lies in the boundary or not.
Step 6: If Step 5 is True then displaying the element.
Step 7: If Step 5 is False then checking for next element until all
elements are checked.
Step 8: Stop.
CODE
VARIABLE DESCRIPTION TABLE
Algorithm
Step 1: Start
Step 2: Input the 2D array of ‘m’ rows and ‘n’ columns.
Step 3: Print the original array.
Step 4: Create a 1D array of size ‘m*n‘
Step 5: Save all elements of 2D array into 1D array (i.e.
Converting a 2D array into a 1D array)
Step 6: Sort the 1D array using bubble sorting technique.
Step 7: Save the elements of the sorted 1D array back to the 2D
array.
Step 8: Stop.
CODE
Variable Description Table
Algorithm
Step 1: Start
Step 2: Input the size of 2D array
Step 3: Print the first row and then print the last column.
Step 4: Then printing last row from right to left.
Step 5: Then printing first column down to up.
Step 6: Repeating if all the spaces are not full.
Step 7: Stop.
CODE
Variable Description Table
Algorithm
Step 1: Start
Step 2: Input the first 2D array of ‘m’ rows and ‘n’ columns.
Step 3: Input the second 2D array of ‘m1’ rows and ‘n1’ columns.
Step 4: Print the two arrays
Step 5: Finding compatibility for multiplication (i.e. if n==m1)
Step 6: If Step 5 is true then proceeding else going to Step 9.
Step 7: Multiplying the first two arrays and storing it in a new
array.
Step 8: Displaying the third array.
Step 9: Stop
CODE
Variable Description Table
Algorithm
Step 1: Start
Step 2: Input the size of 2D array
Step 3: Checking if the size is odd or even.
Step 4: If even then printing a normal matrix.
Step 5: Then swapping elements of primary and secondary
diagonals.
Step 6: If odd then filling the elements upwards then right and
incrementing if rows and columns are violated
Step 7: Displaying the Generated Magic Square.
Step 8: Stop.
CODE
Variable Description Table
OUTPUTS