Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
88% found this document useful (8 votes)
16K views

ISC 2024 Computer Science Practical Question

This document presents 3 problems to solve using Java programming. Problem 1 involves writing a program to accept a day number and year from the user and display the corresponding date, and future date N days later. Problem 2 involves writing a program to accept a sentence, count vowels/consonants in each word, and display the results in a bar graph. Problem 3 involves writing a program to declare and populate a matrix, display the original and rotated matrix, and calculate the sum of odd elements. Sample inputs/outputs are provided for testing each problem.

Uploaded by

FAISAL GHEYAS
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
88% found this document useful (8 votes)
16K views

ISC 2024 Computer Science Practical Question

This document presents 3 problems to solve using Java programming. Problem 1 involves writing a program to accept a day number and year from the user and display the corresponding date, and future date N days later. Problem 2 involves writing a program to accept a sentence, count vowels/consonants in each word, and display the results in a bar graph. Problem 3 involves writing a program to declare and populate a matrix, display the original and rotated matrix, and calculate the sum of odd elements. Sample inputs/outputs are provided for testing each problem.

Uploaded by

FAISAL GHEYAS
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Solve any one of the following Problems.

Question 1

Write a program in JAVA to accept day number (between 1 and 366) and year (yyyy) from the
user and display the corresponding date. Also accept ‘N’ from the user where (1<=N<=100) to
compute and display the future date ‘N’ days after the given date. Display error message if the
value of the day number or ‘N’ are not within the limit. Day number is calculated taking 1st
January of the given year as 1.
Test your program with given set of data and some random data
Example 1
INPUT: DAY NUMBER: 50
YEAR: 2023
N: 25
OUTPUT: ENTERED DATE: FEBRUARY 19, 2023
25 DAYS LATER: MARCH 16, 2023

Example 2
INPUT: DAY NUMBER: 321
YEAR: 2023
N: 77
OUTPUT: ENTERED DATE: NOVEMBER 17, 2023
77 DAYS LATER: FEBRUARY 2, 2024

Example 3
INPUT: DAY NUMBER: 400
YEAR: 2023
N: 125
OUTPUT: INCORRECT DAY NUMBER
INCORRECT VALUE OF ‘N’
Question 2

Write a program to accept a sentence which may be terminated by either ‘.’ , ‘?’ or ‘!’ only. The
words may be separated by a single blank spaces and are in UPPER CASE.
Perform the following tasks:
(a) Count number of vowels and consonants present in each word
(b) Generate the output of the frequency in form of a bar graph, where V denotes vowels and C
consonants as shown below:
Test your program for the following data and some random data:

Example 1

INPUT: HOW ARE YOU?

OUTPUT: WORD COUNT

HOW V
CC

ARE VV
C

YOU VV
C

Example 2

INPUT: GOOD DAY!

OUTPUT: WORD COUNT

GOOD VV
CC

DAY V
CC

Example 3

INPUT: LONG LIVE THE KING#

OUTPUT: INCORRECT TERMINATING CHARACTER. INVALID INPUT


Question 3
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.
(a) Display the input matrix
(b) Rotate the matrix by 2700 degrees anti clock wise and display the resultant matrix
(c) Calculate the sum of the odd elements of the matrix and display

Test your program for the following data and some random data:
Example 1
INPUT: M=3
N=4
ENTER ELEMENTS: 8, 7, 9, 3,-2, 0, 4, 5, 1, 3, 6, -4
OUTPUT: ORIGINALMATRIX
8 7 9 3
-2 0 4 5
1 3 6 -4
ROTATED MATRIX ( 2700 ANTI CLOCK WISE )
1 -2 8
3 0 7
6 4 9
-4 5 3
SUM OF THE ODD ELEMENTS = 28
Example 2
INPUT: M=3
N=2
ENTER ELEMENTS: 9, 13, 41, 5, 6, -5
OUTPUT: ORIGINALMATRIX
9 13 41
5 6 -5
ROTATED MATRIX ( 2700 ANTI CLOCK WISE )
5 9
6 13
-5 41
SUM OF THE ODD ELEMENTS = 63
Example 3
INPUT: M=2
N = 10
OUTPUT: INVALID INPUT

You might also like