You are on page 1of 4

Class -XI

Computer Project Questions

Question 1
a) A binary file named “XYZ.DAT” contains the roll number (rn), contact (cnt) and
name(n) for number of students.
Write a Method to accept a roll number ‘rn’ and check the presence of the student
and display with an appropriate message.

The method declaration is as follows:


void findStu( int rn )
b)A character file named “emp.txt” contains the name , age, address and salary for n
number of employee.
Write a Method to read the all records from file and display with appropriate message.
The method declaration is as follows:
void displayAllEmp( )

Question 2
A special number is a number in which the sum of the factorial of each digit is equal to
the number itself.
For example:- 145 = 1! + 4! + 5! = 1 + 24 + 120
Design a class Special to check if a given number is a special number. Some of the
members of the class
are given below:
Class name : Special
Data members
N : Integer
Member functions
Special() : constructor to assign 0 to n
Special(int) : Parameterized constructor to assign a value to ‘n’
void sum() : calculate and display the sum of the first and last digit of n.
int fact(int): return factorial of given number using recursion.
void isSpecial() : check and display if the number n is a special number.

Specify the class Special giving details of the constructor, void sum() and void
isSpecial(). You need not write the main function.

Question 3
Write a program to accept a sentence as input. The words in the string are to be
separated by a blank. Each word must be in upper case. The sentence is terminated by
either “.”,”!” or “?”. Perform the following tasks:
(i) Obtain the length of the sentence (measured in words).
(ii) Arrange the sentence in alphabetical order of the words.
Test your program with the sample data and some random data:

Computer Project Questions - Class XI (St. John’s School - Jaunpur)


Example 1
INPUT:
NECESSITY IS THE MOTHER OF INVENTION.
OUTPUT:
LENGTH : 6
REARRANGED SENTENCE
INVENTION IS MOTHER NECESSITY OF THE
Example 2
INPUT:
BE GOOD TO OTHERS.
OUTPUT:
LENGTH : 4
REARRANGED SENTENCE
BE GOOD OTHERS TO

Question 4
Design a class Change to perform string related operations. The details of the class are
given below:
Class name : Change
Data members /instance variables:
str : stores a word
newstr: stores the reverse word
len: stores the length of the word

Member functions :
Change( ) : default constructor
void inputWord( ) : to accept a word
void reverse(String ) : find the reverse of given string and store in newstr using
recursion .
void checkPalindrome ( ) : check given word is palindrome or not , using
reverse (String)
void display( ) : displays both the words .

Specify the class Change giving details of the constructor, void inputWord(), void
reverse(), void checkPalindrome() and void display().

Question 5
A Transpose of any array is obtained by interchanging the elements of the rows and
columns.
A class Transarray contains a two dimensional integer array of order [ m x n].
The maximum value possible for both ‘m’ and ‘n’ is 20. Design a class Transarray

Computer Project Questions - Class XI (St. John’s School - Jaunpur)


to find the transpose of a given matrix. The details of the members of the class are
given below :

Class name : Transarray


Data members :
arr[ ][ ] : stores the matrix elements
m : integer to store the number of rows
n : integer to store the number of columns
Member functions :
Transarray() : default constructor
Transarray(int mm, int nn) to initialize the size of the matrix, m=mm, n=nn
void fillaray() : to enter the elements of the matrix
void transpose(Transarray A) to find the transpose of a given matrix
void disparray() : displays the array in a matrix form

Specify the class Transarray giving the details of the constructor and other
member functions. You need not to write the main function.

Question 6
Write a program to declare a square matrix A[ ] [ ] of order (M x M) where ‘M’ is the
number of rows and the number of columns such that M must be greater than 2 and less
than 20. Allow the user to input integers into this matrix. Display appropriate error
message for an invalid input. Perform the following tasks:
(a) Display the input matrix.
(b) Create a mirror image matrix.
(c) Display the mirror image matrix.
Test your program with the sample data and some random data:
Example 1
INPUT : M = 3
4 16 12
8 2 14
413
OUTPUT :
ORIGINAL MATRIX
4 16 12
8 2 14
413
MIRROR IMAGE MATRIX
12 16 4
14 2 8
316
Example 2
INPUT : M = 22
OUTPUT : SIZE OUT OF RANGE

Computer Project Questions - Class XI (St. John’s School - Jaunpur)


Question 7
Write a program to enter n numbers and arrange in ascending order using Insertion Sort.

Question 8
Write a program to enter n numbers and arrange in ascending order using Selection Sort.

Question 9
An ISBN (International Standard Book Number) is a ten digit code which uniquely
identifies a book. The first nine digits represent the Group, Publisher and Title of the book
and the last digit is used to check whether ISBN is correct or not. Each of the first nine
digits of the code can take a value between 0 and 9. Sometimes it is necessary to make the
last digit equal to ten; this is done by writing the last digit of the code as X.
To verify an ISBN, calculate 10 times the first digit, plus 9 times the second digit, plus 8
times the third and so on until we add 1 time the last digit. If the final number leaves no
remainder when divided by 11, the code is a valid ISBN.

For Example:
1. 0201103311 = 10*0 + 9*2 + 8*0 + 7*1 + 6*1 + 5*0 + 4*3 + 3*3 + 2*1 + 1*1 = 55
Since 55 leaves no remainder when divided by 11, hence it is a valid ISBN.
2. 007462542X = 10*0 + 9*0 + 8*7 + 7*4 + 6*6 + 5*2 + 4*5 + 3*4 + 2*2 + 1*10 = 176
Since 176 leaves no remainder when divided by 11, hence it is a valid ISBN.
3. 0112112425 = 10*0 + 9*1 + 8*1 + 7*2 + 6*1 + 5*1 + 4*1 + 3*4 + 2*2 + 1*5 = 71
Since 71 leaves no remainder when divided by 11, hence it is not a valid ISBN.
Design a program to accept a ten digit code from the user. For an invalid input, display an
appropriate message. Verify the code for its validity in the format specified below:
Test your program with the sample data and some random data:
Example 1
INPUT CODE : 0201530821
OUTPUT : SUM = 99
LEAVES NO REMAINDER – VALID ISBN CODE
Example 2
INPUT CODE : 035680324
OUTPUT : INVALID INPUT
Example 3
INPUT CODE : 0231428031
OUTPUT : SUM = 122
LEAVES REMAINDER – INVALID ISBN CODE

Question 10
Write a program in Java to accept the name and contact numbers of 25 people. The
program should ask the user for a contact number and search for it in the contact
numbers array using the Binary Search technique. If the number is found, then the
corresponding name is displayed otherwise a proper error message is displayed.

Computer Project Questions - Class XI (St. John’s School - Jaunpur)

You might also like