0% found this document useful (0 votes)
44 views13 pages

Class 12 Terminal Assignment 2024

Uploaded by

nascarjeet01
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
44 views13 pages

Class 12 Terminal Assignment 2024

Uploaded by

nascarjeet01
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 13

ST STEPHEN’S GROUP OF SCHOOL

COMPUTER TERMINAL ASSIGNMENT 2024 – 2025


CLASS XII

Question 1
A company manufactures packing cartons in four sizes, i.e. cartons to
accommodate 6 boxes, 12 boxes, 24 boxes and 48 boxes. Design a program
to accept the number of boxes to be packed (N) by the user (maximum up to
1000 boxes) and display the break-up of the cartons used in descending
order of capacity (i.e. preference should be given to the highest capacity
available, and if boxes left are less than 6, an extra carton of capacity 6
should be used.)
Test your program with the following data and some random data:
Example 1
INPUT:
N = 726
OUTPUT:
48 * 15 = 720
6*1=6
Remaining boxes = 0
Total number of boxes = 726
Total number of cartons = 16
Example 2
INPUT:
N = 140
OUTPUT:
48 * 2 = 96
24 * 1 = 24
12 * 1 = 12
6*1=6
Remaining boxes = 2 * 1 = 2

1
Total number of boxes = 140
Total number of cartons = 6
Example 3
INPUT:
N = 4296
OUTPUT:
INVALID INPUT

Question 2
Write a program to declare a matrix a[][] of order (m × n) where 'm' is the
number of rows and 'n' is the number of columns such that the values of both
'm' and 'n' must be greater than 2 and less than 10. Allow the user to input
integers into this matrix. Perform the following tasks on the matrix:

1. Display the original matrix.


2. Sort each row of the matrix in ascending order using any standard
sorting technique.
3. Display the changed matrix after sorting each row.

Test your program for the following data and some random data:
Example 1
INPUT:
M=4
N=3
ENTER ELEMENTS OF MATRIX:
11 -2 3

5 16 7
9 0 4

3 1 8

2
OUTPUT:
ORIGINAL MATRIX
11 -2 3
5 16 7

9 0 4

3 1 8

MATRIX AFTER SORTING ROWS


-2 3 11

5 7 16
0 4 9

1 3 8

Example 2
INPUT:
M=3
N=3
ENTER ELEMENTS OF MATRIX
22 5 19
7 36 12

9 13 6

OUTPUT:
ORIGINAL MATRIX
22 5 19

7 36 12
9 13 6

3
MATRIX AFTER SORTING ROWS
5 19 22
7 12 36
6 9 13

Example 3
INPUT:
M = 11
N=5
OUTPUT:
MATRIX SIZE OUT OF RANGE.

Question 3 :
The names of the teams participating in a competition should be displayed
on a banner vertically, to accommodate as many teams as possible in a
single banner. Design a program to accept the names of N teams, where 2 <
N < 9 and display them in vertical order, side by side with a horizontal tab
(i.e. eight spaces).
Test your program for the following data and some random data:
Example 1
INPUT:
N=3
Team 1: Emus
Team 2: Road Rols
Team 3: Coyote

4
OUTPUT:
E R C
m o o
u a y
s d o
t
R e
o
l
s
Example 2
INPUT:
N=4
Team 1: Royal
Team 2: Mars
Team 3: De Rose
Team 4: Kings
OUTPUT:
R M D K
o a e i
y r n
a s R g
l o s
s
e
Example 3
INPUT:
N = 10
OUTPUT:
INVALID INPUT

5
Question 4 :

The potential of a word is found by adding the ASCII value of the alphabets.
(ASCII values of A to Z are 65 to 90).

Example: BALL

Potential = 66 + 65 + 76 + 76 = 283

Write a program to accept a sentence which may be terminated by either “ . ” , “ ?


” or “ ! ” only. The words of sentence are separated by single blank space and
are in UPPER CASE. Decode the words according to their potential and arrange
them in ascending order of their potential strength.

Test your program with the following data and some random data:
Example 1:
INPUT: HOW DO YOU DO?
OUTPUT:
HOW = 238
DO = 147
YOU = 253
DO = 147
DO DO HOW YOU
Example 2:
INPUT: LOOK BEFORE YOU LEAP.
OUTPUT:
LOOK = 309
BEFORE = 435
YOU = 253
LEAP = 290
YOU LEAP LOOK BEFORE
Example 3:
INPUT: HOW ARE YOU#
OUTPUT: INVALID INPUT

6
Question 5:
An Evil number is a positive whole number which has even number of 1‟s in its
binary equivalent.
Example: Binary equivalent of 9 is 1001, which contains even number of 1‟s.
Thus, 9 is an Evil Number.
A few Evil numbers are 3, 5, 6, 9....
Design a program to accept a positive whole number „N‟ where N>2 and N<100.
Find the binary equivalent of the number and count the number of 1s in it and
display whether it is an Evil number or not with an appropriate message.
Test your program with the following data and some random data:
Example 1:
INPUT: N = 15
BINARY EQUIVALENT: 1111
NUMBER OF 1‟s: 4
OUTPUT: EVIL NUMBER

Example 2:
INPUT: N = 26
BINARY EQUIVALENT: 11010
NUMBER OF 1‟s: 3
OUTPUT: NOT AN EVIL NUMBER

Example 3:
INPUT: N = 145
OUTPUT: NUMBER OUT OF RANGE

Question 6:
A class Composite contains a two dimensional array of order [m x n]. The
maximum value possible for both „m‟ and „n‟ is 20. Design a class Composite to
fill the array with the first (m x n) composite numbers in column wise.

7
The details of the members of the class are given below:
Class name : Composite

Data members/instance variables:


arr[ ] [ ] : stores the composite numbers column wise
m : integer to store the number of rows
n : integer to store the number of columns

Member functions/methods:
Composite(int mm, int nn ) : to initialize the size of the matrix m=mm and n=nn
int isComposite( int p ) : returns 1 if number is composite otherwise returns 0
void fill ( ) : to fill the elements of the array with the first (m × n)
composite numbers in column wise
void display( ) : displays the array in a matrix form

Specify the class Composite giving details of the constructor(int,int), int


isComposite(int), void fill( ) and void display( ). Define a main( ) function to
create an object and call the functions accordingly to enable the task.

Question 7:
Design a class Sort which enables a word to be arranged in alphabetical order.

The details of the members of the class are given below :


Class name : Sort

Data members/instance variables:


str : stores a word
len : to store the length of the word

Methods/Member functions :
Sort( ) : default constructor
void readword( ) : to accept the word
void arrange ( ) : to arrange the word in alphabetical order using
any standard sorting technique.
8
void display( ) : displays the original word along with the
sorted word

Specify the class Sort giving details of the constructor, void readword( ), void
arrange( ) and void display( ). Define the main( ) function to create an object
and call the functions accordingly to enable the task.

Question 8:
A Krishnamurthy Number is a number in which the sum of the factorial of its
digits is equal to the number.
Example: 145 ( 1! + 4! + 5! = 145 ). Thus, 145 is a Krishnamurthy Number.
Design a class Krishnamurthy Number to check if the given number is a
Krishnamurthy Number or not.
Some of the members of the class are given below:
Class name : Krishnamurthy

Data member/instance variable:


N : integer to store number

Member functions/methods:
Krishnamurthy() : default constructor
void read( ) : to accept the number
int factorial(int x) : return the factorial of a number using recursive
technique

boolean isSpecial( ) : checks for the special number by invoking the function
factorial( ) and returns true if Special, otherwise
returns false
void display( ) : displays the result with an appropriate message

Specify the class Krishnamurthy, giving details of the Constructor, void read(),
int factorial(int), boolean isSpecial( ) and void display( ). Define the main()
function to create an object and call the member function according to enable the
task.

9
Question 9:
Design a class ROUND which will shift all the letters in a word by one index
towards left and the first letter will join at the end.
Example: AFRICA will become FRICAA.

The details of the members of the class are given below:


Class name : ROUND

Data members/instance variables:


Wrd : stores the input word in uppercase
Res : stores the output word

Methods/Member functions:
ROUND( ) : default constructor
void acceptword( ) : to accept the word in uppercase
String round(String s) : shift the letters of s as directed above
void display( ) : displays both the words

Specify the class ROUND giving details of the constructor, void acceptword(),
String round(String) and void display( ). Define the main( ) function to create
an object and call the functions accordingly to enable the task.

Question 10:
Design a class PigLatin which will convert the given word to Piglatin form. A
word can be converted to Piglatin form by shifting the entire letter from the front
to the first occurrence of a vowel to the end followed by “AY”.

Example: TRAIN will become AINTRAY


MUSIC will become USICMAY

The details of the members of the class are given below:


Class name : PigLatin

Data members/instance variables:


Str : stores a word in Uppercase
10
Newstr : stores the Piglatin word
Len : to store the length of the word

Methods/Member functions:
PigLatin( ) : default constructor
void readword( ) : to accept the word in uppercase
void convert( ) : convert the input word to its Piglatin form and store it in
newstr.
void display( ) : displays the original word along with the new word

Specify the class PigLatin giving details of the constructor, void readword( ),
void convert( ) and void display( ).Define the main( ) function to create an
object and call the functions accordingly to enable the task.

Question 11:
Design a class WORDSUM which will add the ASCII value of all the letters
present in the word.

The details of the members of the class are given below:

Class name : WORDSUM

Data members/instance variables:


Wrd : stores the input word in uppercase
len : stores the length of the word

Methods/Member functions:
WORDSUM( ) : default constructor
void acceptword( ) : to accept the word in uppercase
int sumASCII( ) : add the ASCII values of all the letters and return the
same.
void display( ) : displays the word with the sum

11
Specify the class WORDSUM giving details of the constructor, void
acceptword( ) , int sumASCII( ) and void display( ). Define the main( )
function to create an object and call the functions accordingly to enable the task.

Question 12:
Design a class Encrypt which will shift each letter by its position in the word.
Example: TRAIN will become UTDMS

The details of the members of the class are given below:


Class name : Encrypt

Data members/instance variables:


Str : stores a word in Uppercase
Newstr : stores the encrypted word
Len : to store the length of the

Word Methods/Member functions:


PigLatin( ) : default constructor
void readword( ) : to accept the word in uppercase
void encrypt( ) : shift the letters by its position and store in newstr.
void display( ) : displays the original word along with the new word

Specify the class Encrypt giving details of the constructor, void readword( ),
void encrypt( ) and void display( ). Define the main( ) function to create an
object and call the functions accordingly to enable the task.

12
INSTRUCTIONS
1. Program Questions must be printed
2. Written Algorithm for each program separately and attached with before starting each
programs.
3. Print the codes with comment lines in BlueJ Environment only and pasted on right side Do
Not take any snapshot or screenshot of the code
4. Print the Outputs in BlueJ Environment only and must be printed , Do not take any
snapshot or screenshot of the code
5. Variables list must be hand written and the headings are as follows:
- Variable Name Type Purpose
6. Function list must be handwritten and the headings are as follows.
Function Name Return Type Argument Name Argument Type Purpse
7. Finally write down the conclusion about your assignment and specify the software name
with version and the total time taken to complete the task.
8. Use only A4 pages to complete the assignment
9. Only print all the documents
10. Prepare an INDEX of this assignment only printout is acceptable top of the first page

13

You might also like