0% found this document useful (0 votes)
5 views

Comp Note

The document contains problems related to programming concepts like checking if a number is prime or composite, generating calendar, finding frequency of numbers, packing boxes in cartons, generating future dates, checking for circular prime numbers, finding palindromic words in a sentence.
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views

Comp Note

The document contains problems related to programming concepts like checking if a number is prime or composite, generating calendar, finding frequency of numbers, packing boxes in cartons, generating future dates, checking for circular prime numbers, finding palindromic words in a sentence.
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

Evil no

conjecture gold bach

happy no

Piglatin no

Bin to dec

Fib rec

Niven

Mobius

Sq mat

Lucky no

snowball

fascinating

smith

Write a program to accept a sentence and check whether it is terminated by ‘.’ or


‘? ‘ or ‘!’ . Display the words using default delimiter (space) and the first
character of each word should be converted into Upper Case.

to print possible combinations of numbers (234, 243,324,342,etc)

Shuffle the matrix(2D)(1st row becomes the last, 2nd row becomes the 1st & so on..)
— by object

Clockwise Spiral matrix/circular matrix in java

A class Composite contains a two dimensional array of order [m x n]. The maximum
value possible for both ‘m’ and ‘n’ is 20. Design a class Composite to fill the
array with the first (m x n)composite numbers in column wise. The details of the
members of the class are given below:
[Class name: CompositeData members/instance variables:
arr[ ] [ ] : stores the composite numbers column wiseM : integer to store the
number of rows N : integer to store the number of columns
Member functions/methods:
Composite(int mm, int nn ) : to initialize the size of the matrix m=mm and n=nnint
isComposite( int p ) : returns 1 if number is composite otherwise returns 0void
fill ( ) : to fill the elements of the array with the first (m × n)composite
numbers in column wisevoid display( ):displays the array in a matrix formSpecify
the class
Composite giving details of the constructor(int,int), int isComposite(int),
voidfill( ) andv oid display( ). Define a main( ) function to create an object and
call the functionsaccordingly to enable the task.

WAP to display calender of any month of any year

Write a program to input and store n integers (n > 0) in a single subscripted


variable and print each number with its frequency. The output should contain number
and its frequency in two different columns.
A company manufactures packing cartons in four sizes, i.e. cartons to accommodate 6
boxes, 12 boxes, 24 boxes and 48 boxes. Design a program to accept the number of
boxes to be packed (N) by the user (maximum up to 1000 boxes) and display the
break-up of the cartons used in descending order of capacity (i.e. preference
should be given to the highest capacity available, and if boxes left are less than
6, an extra carton of capacity 6 should be used.)

A Prime-Adam integer is a positive integer (without leading zeroes) which is a


prime as well as an Adam number.
Prime number: A number which has only two factors, i.e. 1 and the number itself.
Example: 2, 3, 5, 7, etc.

Design a program to accept a day number (between 1 and 366), year (in 4 digits)
from the user to generate and display the corresponding date. Also, accept N (1 <=
N <= 100) from the user to compute and display the future date corresponding to ‘N’
days after the generated date. Display an error message if the value of the day
number, year and N are not within the limit or not according to the condition
specified.

A Circular Prime is a prime number that remains prime under cyclic shifts of its
digits. When the leftmost digit is removed and replaced at the end of the remaining
string of digits, the generated number is still prime. The process is repeated
until the original number is reached again.
A number is said to be prime if it has only two factors 1 and itself. Accept a
positive number N and check whether it is a circular prime or not. The new numbers
formed after the shifting of the digits should also be displayed.A number is said
to be prime if it has only two factors 1 and itself.

A palindrome is a word that may be read the same way in either direction.
Accept a sentence in uppercase which is terminated by either “.”, “?” or “!”. Each
word of the sentence is separated by a single blank space.

Perform the following tasks:


(a) Display the count of palindromic words in the sentence.
(b) Display the palindromic words in the sentence.

Example of palindromic words:


MADAM, ARORA, NOON

You might also like