Page 635 - ComputerScience_Class_11
P. 635
Member functions:
Delnum(int s) : Constructor to initialise size of the array
void readList() : to enter elements of the array
void sortList() : sorts the array in ascending order using standard sorting techniques
void packList() : calls sortList and then deletes duplicate elements from the sorted array
void dispList() : to display the array
Specify the class DelNum giving the details of the functions constructor, void readList(), void sortList, void packList() and void
dispList(). Also write the main function to create an object and call methods accordingly to enable the task.
Question 7. [10]
A class called Matrix is defined to check if a given matrix is a Sparse matrix or not. For a matrix having ‘r’ rows and ‘c’ columns, if
the number of 0’s in the matrix is greater than (r*c)/2, then it is called a Sparse matrix.
The details of the class is given below:
Class name : Matrix
Member data
int a[][] : A two dimensional array
int r,c : To store rows and columns
Member method
Martix(int rr,int cc) Parameterised constructor to initialise row and column
void accept() : To enter numbers in matrix a[][]
int count() : Counts and returns number of 0’s in the matrix
boolean isSparse() : Calls count() and returns true if it is a Sparse matrix false otherwise.
void display() : Displays the matrix. Also calls isSparse() and prints appropriate message
Specify class Matrix giving details of the constructor, void accept(), int count() , boolean isSparse() and void display(). Also define
the main() function to create an object and call the functions accordingly to enable the task.
Question 8. [10]
A class called TxtFile has been defined to perform following operations on a text file.
Class name : TxtFile
Data Members
text : stores the sentence
nam : Stores the name to be searched
Member functions
void enterRec() Stores a letter written to a friend in file “LETTER.DAT”
void searchName() : Accepts the name to be searched. Reads the file “LETTER.DAT”, counts
and prints how many times the name occurs in the letter.
Specify class TxtFile giving details of the void enterRec() and void searchName(). Also define the main function to create an object
and call methods accordingly to enable the task.
SECTION – C
Answer any two questions.
Each program should be written in such a way that it clearly depicts the logic of the problem.
This can be achieved by using mnemonic names and comments in the program.
(Flowcharts and Algorithms are not required.)
The programs must be written in Python.
Question 9. [5]
A car starts from rest and gradually accelerates as per the following conditions.
• During the first 2 minutes of motion it travels at a velocity of 100 m/min.
• The next 5 minutes it travels at a velocity of 250 m/min.
• The next 18 minutes it travels at a velocity of 350 m/min.
• After that it continues to travel at a constant velocity of 500 m/min
Write a code in python which takes time in minutes as input and prints the total distance travelled by the car in Kilometer.
Question 10. [5]
Write a program in python to enter any integer number in binary (base 2) and convert it to its decimal equivalent. Example if the
binary number is 100110 then its decimal equivalent is 38.
Question 11.
(a) Is your smart watch an IOT? Justify your answer with two points [2]
(b) Define Intellectual Property rights [1]
(c) Write one difference between AR and VR [2]
Sample Paper 633

