0% found this document useful (0 votes)
5 views3 pages

Accounting Class Notes

The document contains practical programming questions focused on generating Goldbach numbers, manipulating matrices, and analyzing sentences for pangrams. Each question includes specific input requirements, expected outputs, and examples to guide implementation. The tasks emphasize error handling for invalid inputs and require the use of basic programming constructs.

Uploaded by

ashcoway148
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)
5 views3 pages

Accounting Class Notes

The document contains practical programming questions focused on generating Goldbach numbers, manipulating matrices, and analyzing sentences for pangrams. Each question includes specific input requirements, expected outputs, and examples to guide implementation. The tasks emphasize error handling for invalid inputs and require the use of basic programming constructs.

Uploaded by

ashcoway148
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/ 3

QUESTIONS FOR PRACTICAL PRACTICE

Question 1
A number is said to be a Goldbach number, if the number can be expressed as the addition of
two odd prime number pairs. If we follow the above condition, then we can find that every even
number larger than 4 is a Goldbach number because it must have any pair of odd prime
number pairs.
Example: 6 = 3,3 ( ONE PAIR OF ODD PRIME )
10 = 3,7 and 5 , 5 ( TWO PAIRS OF ODD PRIME )
Write a program to enter any positive EVEN natural number ‘N’ where (1<=N<=50) and
generate odd prime twin of ‘N’
Test your program for the following data and some random data.
Example 1
INPUT: N = 14
OUTPUT: ODD PRIME PAIRS ARE: 3, 11
7, 7
Example 2
INPUT: N = 20
OUTPUT: ODD PRIME PAIRS ARE: 17, 3
13, 7
Example 3
INPUT: N = 44
OUTPUT: ODD PRIME PAIRS ARE: 41, 3
37, 7
31, 13
Example 4
INPUT: N = 25
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 both M and N must be greater than 2 and less
than10. Allow the user to input integers into this matrix. Display appropriate error message for
an invalid input.
Perform the following tasks on the matrix.
Display the input matrix
Shift each row one step upwards so the first row will become the last row 2nd row will be the 1st row
and so on
Display the rotated matrix along with the highest element and its location in the matrix

Test your program for the following data and some random data:
Example 1
INPUT: M =3
N=4
Enter elements in the matrix:
100 90 87 76
200 500 167 998
77 567 89 254
OUTPUT: FORMED MATRIX AFTER ROTATING:
200 500 167 998
77 567 89 254
100 90 87 76
Highest element: 998 ( Row: 0 and Column: 3 )
Example 2
INPUT: M =4
N=3
Enter elements in the matrix:
54 120 187
78 55 289
134 67 89
63 341 122
OUTPUT: FORMED MATRIX AFTER ROTATING:
78 55 289
134 67 89
63 341 122
54 120 187
Highest element: 341 ( Row: 2 and Column: 1 )
Example 3
INPUT: M = 2
N=3
OUTPUT: SIZE IS OUT OF RANGE. INVALID ENTRY
Question 3
Write a program to accept a sentence which may be terminated by either ‘.’ ,‘?’or ‘!’ only. The
words may be separated by a single blank space and should be case-insensitive.
Perform the following tasks:
Determine if the accepted sentence is a Pangram or not.

[A Pangram is a sentence that contains every letter of the alphabet at least once.]
Example: "The quick brown fox jumps over the lazy dog"
Display the first occurring longest and shortest word in the accepted sentence.

Test your program for the following data and some random data:
Example 1
INPUT: Pack my box with five dozen liquor jugs.
OUTPUT: IT IS A PANGRAM
LONGEST WORD: dozen
SHORTEST WORD: my
Example 2
INPUT: THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG.
OUTPUT: IT IS A PANGRAM
LONGEST WORD: QUICK
SHORTEST WORD: THE
Example 3
INPUT: Hello my World.
OUTPUT: IT IS NOT A PANGRAM
LONGEST WORD: Hello
SHORTEST WORD: my
Example 4
INPUT: Alas ! it failed #
OUTPUT: INVALID INPUT

You might also like