100% found this document useful (1 vote)
12K views

ISC Sample Practical Papers 2023-2024

This document contains 3 sample paper questions that involve writing programs to solve various problems. Question 1 involves writing a program to check if a positive integer is a Hamming number based on its prime factors. Question 2 involves writing a program to accept a matrix from the user and check if it is a Doubly Markov matrix. Question 3 involves writing a program to check if a sentence entered by the user is a "snowball string".

Uploaded by

subratadey12
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
100% found this document useful (1 vote)
12K views

ISC Sample Practical Papers 2023-2024

This document contains 3 sample paper questions that involve writing programs to solve various problems. Question 1 involves writing a program to check if a positive integer is a Hamming number based on its prime factors. Question 2 involves writing a program to accept a matrix from the user and check if it is a Doubly Markov matrix. Question 3 involves writing a program to check if a sentence entered by the user is a "snowball string".

Uploaded by

subratadey12
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/ 8

SAMPLE PAPER 1

Solve any one of the following Problems.

Question 1

Hamming numbers are positive integer numbers whose prime factors include 2,3 and 5 only
Example:
n=6 is an hamming number as 6=2x3 .So its prime factors are limited to 2 ,3
n=8 is an hamming number as 8=2x2x2 and it has only 2 as its prime factors
n=90 is an hamming number as 90=2x3x3x5 which has only 2,3,5 as prime factors
n=14 is not a hamming number as 14=2x7 .It has 7 as one of its prime factor
n=44 is not a hamming number as 44=2x2x11. It has 11 as one of its prime factors
Design a program to accept any positive integer number and check if it is a Hamming number or
not. Display the result with an appropriate message in the format specified below. The program
should also generate error message if a negative number is entered.
Test your program for the following data and some random data.

Example 1
INPUT: Enter any number: 3600
OUTPUT: 3600= 2 x 2 x 2 x 2 x 3 x 3 x 5 x 5
3600 IS A HAMMING NUMBER

Example 2
INPUT: Enter any number: 5832
OUTPUT: 5832= 2 x 2 x 2 x 3 x 3 x 3 x 3 x 3 x 3
5832 IS A HAMMING NUMBER

Example 3
INPUT: Enter any number: 7854
OUTPUT: 7854= 2 x 3 x 7 x 11 x 17
7854 IS NOT A HAMMING NUMBER

Example 4
INPUT: Enter a number: -120
OUTPUT: NEGATIVE NUMBER ENTERED. INVALID INPUT

Question 2

Write a program to declare a square matrix M[][] of order ‘N’. Check if the matrix is a Doubly
Markov matrix or not. A matrix which satisfies the following conditions are Doubly Markov
matrix
(i) All elements are greater than or equal to 0
(ii) Sum of each row is equal to 1.
(iii) Sum of each column is equal to 1.
Accept ‘N’ from the user where 3 <= N <= 9. Display an appropriate error message if ‘N’ is not in
the given range or the entered numbers are negative. Allow the user to create a matrix and
check
whether the created matrix is a Doubly Markov matrix or not
Test your program for the following data and some random data:

Example 1
INPUT: N=3
Enter elements in the matrix: 0.5, 0.25, 0.25, 0.25, 0.75, 0.0, 0.25, 0.0, 0.75
OUTPUT: FORMED MATRIX
0.5 0.25 0.25
0.25 0.75 0.0
0.25 0.0 0.75
IT IS A DOUBLY MARKOV MATRIX

Example 2
INPUT: N=3
Enter elements in the matrix: 1.5, 3, 0.15, 0.25, 4, 1.0, 0.25, 1.0, 3
OUTPUT: FORMED MATRIX
1.5 3 0.15
0.25 4 1.0
0.25 1.0 3
IT IS NOT A DOUBLY MARKOV MATRIX

Example 3
INPUT: N=2
Enter elements in the matrix: 0.8, -4.0, 0.9, 3.5
OUTPUT: NEGATIVE NUMBERS ENTERED. INVALID ENTRY
Example 4
INPUT: N =12
OUTPUT: SIZE IS OUT OF RANGE. INVALID ENTRY

Question 3

A snowball string is a sentence where each word is arranged in ascending order of their length
and
is also consecutive.
For example “I am the Lord” is a snowball string as
Length of word ‘I’ is 1
Length of word ‘am’ is 2
Length of word ‘the’ is 3
Length of word ‘Lord’ is 4
The length of each word is one more than the previous word. Hence they are consecutive and
in
ascending order.
Write a program to enter any sentence and check if it is a snowball string or not. The words in
the
sentence may be separated by a one or more spaces and terminated by ‘.’ or ‘?’ only. The
program
will generate appropriate error message for any other terminating character.
Test your program for the following data and some random data:

Example 1
INPUT: He may give bonus.
OUTPUT: IT IS A SNOWBALL STRING

Example 2
INPUT: Is the cold water frozen?
OUTPUT: IT IS A SNOWBALL STRING

Example 3
INPUT: Look before you leap.
OUTPUT: IT IS NOT A SNOWBALL STRING

Example 4
INPUT: The child is father of the man!
OUTPUT: INCORRECT TERMINATING CHARACTER. INVALID INPUT

SAMPLE PAPER 2
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

Lucky numbers are a sequence of natural numbers that remain after removing second, third,
fourth,
fifth and so on numbers respectively from a sequence of consecutive natural numbers.
Consider the sequence of first 20 natural numbers :
Removing every second number produces the sequence 1, 3, 5, 7, 9, 11, 13, 15, 17, 19
Next removing every third number produces the sequence 1, 3, 7, 9, 13, 15, 19
Next removing every fourth number produces the sequence : 1, 3, 7, 13, 15, 19
Further deleting every fifth number we get the sequence : 1, 3, 7, 13, 19
Deletion of every sixth number is not possible and the five numbers that are lucky to escape
deletion
remain indefinitely.
Write a program to enter any positive natural number ‘N’ where (1<=N<=50) and generate
lucky
numbers less than the given natural number.
Test your program with the following set of data

Example 1
INPUT: N=10
OUTPUT: LUCKY NUMBERS LESS THAN 10 ARE : 1, 3 , 7

Example 2
INPUT: N=25
OUTPUT: LUCKY NUMBERS LESS THAN 25 ARE : 1, 3 , 7, 13, 19

Example 3
INPUT: N=100
OUTPUT: NUMBER NOT IN 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 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

9
SAMPLE PAPER 3
Solve any one of the following Problems.
Question 1
A Vampire number is a composite natural number with an even number of digits that can be
factored into two natural numbers each with half as many digits as the original number and not
both with trailing zeros, where the two factors contain precisely all the digits of the original
number, in any order of counting multiplicity.
Example: 1260 = 21 x 60 ( where, 21 and 60 contain precisely all the digits of the number )
Thus, 1260 is a Vampire number.
Accept two positive integers m and n, where m is less than n and the values of both ‘m’ and ‘n’
must be greater than or equal to 1000 and less than or equal to 9999 as user input. Display all
Vampire numbers that are in the range between m and n (both inclusive) and output them
along
with the frequency, in the format specified below:
Test your program for the following data and some random data.
Example 1
INPUT: m = 1002
n = 1640
OUTPUT: THE VAMPIRE NUMBERS ARE:
1260 1395 1435 1530
FREQUENCY OF VAMPIRE NUMBER IS: 4
Example 2
INPUT: m = 1810
n = 7800
OUTPUT: THE VAMPIRE NUMBERS ARE:
1827 2187 6880
FREQUENCY OF VAMPIRE NUMBER IS: 3
Example 3
INPUT: m = 8105
n = 9999
OUTPUT: THE VAMPIRE NUMBERS ARE:
NIL
FREQUENCY OF VAMPIRE NUMBER IS: 0
Example 4
INPUT: m = 174
n = 4500
OUTPUT: INVALID INPUT
10
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.
(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
8793
-2 0 4 5
1 3 6 -4
ROTATED MATRIX ( 2700 ANTI CLOCK WISE )
1 -2 8
307
649
-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 )
59
6 13
-5 41
SUM OF THE ODD ELEMENTS = 63
Example 3
INPUT: M = 2
N = 10
OUTPUT: INVALID INPUT
11
Question 3
Keyword cipher is a form of encryption technique. A keyword is used as the key, and it
determines the letter matching the cipher alphabet to the plain alphabet. Repeats of letters in
the
word are removed, then the cipher alphabet is generated with the keyword matching to A, B, C,
etc. until the keyword is used up, whereupon the rest of the cipher text letters are used in
alphabetical order, excluding those already used in the key.
Encryption:
The first line of input contains the keyword which you wish to enter. The second line of input
contains the string which you have to encrypt.
Plaintext: A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Encrypted: K R Y P T O S A B C D E F G H I J L M N Q U V W X Z
With KRYPTOS as the keyword, all A’s become K’s, all B’s becoming R’s, and so on.
Example:
Encrypting the message: KNOWLEDGE IS POWER when, Keyword is KRYPTOS
Decoded message: DGHVETPST BM IHVTL
Write a program to accept a Coded text in upper case and a Keyword. Using the above
technique
decrypt the text and display.
Note: All the messages are encoded in uppercase. Whitespace, special characters, and
numbers remains unchanged.
Test your program for the following inputs:
Example 1
INPUT: ENTER KEYWORD: SECRET
ENTER TEXT TO BE DECODED: ZLJEFT DTOT
OUTPUT: DECODED TEXT: ZOMBIE HERE
Example 2
INPUT: ENTER KEYWORD: STAR WARS
ENTER TEXT TO BE DECODED: SPPSAG SP RSVJ
OUTPUT: DECODED TEXT: ATTACK AT DAWN
Example 3
INPUT: ENTER KEYWORD: PLAYERS
ENTER TEXT TO BE DECODED: Haln de yokl
OUTPUT: INVALID TEXT

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy