Sample Paper 1
Sample Paper 1
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
3
Question 2
4
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:
(a) 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"
(b) 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