Computer Science Question Paper
Computer Science Question Paper
Computer Science Question Paper
Paper – 2
(PRACTICAL)
(Maximum Marks: 30)
Time allowed:
Day 1 - Planning session: 90 minutes
Day 2 - Examination session: 90 minutes
(On Day 1, candidates are allowed additional 15 minutes for only reading the paper.
They must NOT start writing during this time.)
This paper consists of three problems from which candidates are required to attempt
any one problem.
----------------------------------------------------------------------------------------------------------------------
Candidates are expected to do the following:
-------------------------------------------------------------------------------------------------------------------
This Paper consists of 4 printed pages
Question 1
Design a program which takes two integer parameters namely number of the day
( between 1 and 366 ) and the year ( in 4 digits ) as inputs and displays the date i.e. day, month
and year.
Also find the corresponding date exactly after (N) days of the present date by accepting the
value of (N) from the use, where the value of (N) is in the limit ( 1 <= N <= 100 )
Design your program which will enable the output in the format given below:
Sample 1
INPUT: DAY NUMBER : 233
YEAR : 2020
DATE AFTER : 17
OUTPUT:
20TH. AUGUST 2020
DATE AFTER 17 DAYS :
6TH. SEPTEMBER 2020
Sample 2
INPUT: DAY NUMBER : 360
YEAR : 2020
DATE AFTER : 45
OUTPUT:
25TH. DECEMBER 2020
DATE AFTER 45 DAYS :
8TH. FEBRUARY 2021
------------------------------------------------------------------------------------------------------------------------
2
(b) Arrange the words contained in the sentence according to the size of the words in
ascending order. If two words are of the same length then the first occurring
comes first. The sentence should begin with a capital alphabet in both the cases
i.e. Input and Output.
(c) Display both the sentences separately with each sentence beginning with a capital
alphabet.
Design your program which will enable the output in the format given below:
Sample 1
INPUT: the lines are printed in reverse order.
OUTPUT:
The lines are printed in reverse order.
In the are lines order printed reverse.
Sample 2
OUTPUT:
Print the sentence in ascending order.
In the print order sentence ascending.
Sample 3
OUTPUT:
I love my country.
I my love country.
-----------------------------------------------------------------------------------------------------------------------
3
Turn over
Question 3
A MOBIUS function M(N) returns the value -1 or 0 or 1 for a natural number (N) by
the following conditions are defined :
When,
M(N) =1 if N=1.
M(N) =0 if any prime factor of N is contained more than once.
M ( N ) = ( -1 ) P if N is the product of ‘P’ distinct prime factors.
Write a program to accept a positive natural number (N) and display the MOBIUS result
with proper message.
Design your program which will enable the output in the format given below:
Sample 1
INPUT: 78
OUTPUT: 78 = 2 x 3 x 13
NUMBER OF DISTINCT PRIME FACTORS = 3
M(78) = -1
Sample 2
INPUT: 34
OUTPUT: 34 = 2 x 17
NUMBER OF DISTINCT PRIME FACTORS = 2
M(34) = 1
Sample 3
INPUT: 12
OUTPUT: 12 = 2 x 2 x 3
DUPLICATE PRIME FACTORS
M(12) = 0
Sample 4
INPUT: 1
OUTPUT: 1 = 1
NO PRIME FACTORS
M(1) = 1
In addition to the above, the practical file of the candidate containing the practical work
related to programming assignments done during the year will be evaluated as follows:
• Programming assignments done throughout the year (by the teacher) [10marks]
• Programming assignments done throughout the year (by the Visiting Examiner) [5marks]
------------------------------------------------------------------------------------------------------------------------
4