Trending ▼   ResFinder  

ISC Class XII Notes 2019 : Computer Science

6 pages, 22 questions, 0 questions with responses, 0 total responses,    0    0
Sagnik Biswas
Delhi Public School (DPS), Newtown, Kolkata
+Fave Message
 Home > sagnik_biswas >

Formatting page ...

LAB ASSIGNMENTS OF CLASS XII SL NO. Program Description Date 1 A super class Detail has been defined to store the details of a customer. Define a sub class Bill to compute the monthly telephone charge of the customer as per the chart given below: NUMBER OF CALLS RATE 1- 100 Only rental charge 101-200 60 paisa per call + rental charge 201-300 80 paisa per call + rental charge Above 300 1 rupee per call + rental charge The details of both the classes are given below: Class Name Data members name address telno rent Member functions void show() Class Name Data members n amt customer. Member functions Bill(..) data members of void cal() the charge void show() amount to be paid. : Detail : to store the name of the customer. : to store the address of the customer. : to store the phone number of the customer. : to store the monthly rental charge : Detail(..) : parameterized constructor to assign values to data members. : to display the detail of the customer. : Bill : to store the number of calls. : to store the amount to be paid by the : : parameterized constructor to assign values to both classes and to initialize amt = 0.0. : calculates the monthly telephone charge as per given above. : to display the detail of the customer and Specify the class Detail giving details of the constructor( ) and void show(). Uisng the concept of inheritance, specify the class Bill giving details of the constructor( ), void cal() and void show(). 2. Create a package Edible. Create an interface Fruit in Edible package with the following methodsString getTaste(); String getShape(); String getSeason(); void application(); Create 3 classes Grape, Mango and Sugarcane are implementing Fruit interface and implementing its method. Write main() method. 3. Given a square matrix M [ ] [ ] of order n . The maximum value possible for n is 10. Accept three different characters from the keyboard and fill the array according to the instruction given below. Fill the upper and lower elements formed by the intersection of the diagonals by character 1. Fill the left and right elements formed by the intersection of the diagonals by character 2. Fill both the diagonals by character 3. Output the result in format given below: Example 1 ENTER SIZE : 4 INPUT : FIRST CHARACTER * SECOND CHARACTER ? THIRD CHARACTER # OUTPUT : #**# ?##? ?##? #**# 4. 1. Create a package DateException 2. Create three exception class inside the packagei) InvalidDayException ii) InvalidMonthException iii) InvalidYearException The above exceptions are raised if the day/month/year is out of valid range or year is not within 2999 3. Create a class Calendar outside MyException package. The class reads a date and prints the calendar of the month from that date. The class should raise and handle the above exceptions. MONTH --------------------------------------------------Mon Tues Wed Thurs Fri Sat Sun 5. Class Krishnamurthy Data members- num Methods: int factorial(int, int )- returns factorial of num recursively void isKrishmurthy()- finds out the sum of factorial of digits and displays if the number is factorial or not. Write main() method. 6 Linear search through recursion. 7 Happy number using recursion. Class Happy int n Happy()- default constructor void getNum()- reads number int sum_sq_dig(int nn)- calculates and returns sum of square of digits recursively void isHappy()- checks and returns if the n is happy number or not void main()- calling interface 8 int binarySearch(int item, int lb, int ub)- recursively void bubbleSort(int n)- recursively 9 Class MyString Str- stores the string Revstr- stores the reverse string MyString(String)- constructor void reverse(int)- reverse a string recursively void checkPalindrome()- checks if str is a palindrome void pattern(int ) - print the said pattern Eg- Book B Bo Boo Book void changeCase(int )- changes and case of letters Eg BooK is bOOk 10 Quick Sort 11 Merge Sort 12 A Disarium number is a number in which the sum of the digits to the power of their respective position is equal to the number itself. Ex- 135 = 11+32+53 Class : Disarium num , size methods Disarium (int) void countDigit() - constructor - counts the total number of digits and assigns it to size. int sumOfDigits(int n, int p) - returns the sum of the digits of number (n) to the power of their respective positions(p) using recursive technique. void check() - checks whether the number is a disarium number or not 13 Question: The result of a quiz competition is to be prepared as follows: The quiz has five questions with four multiple choices (A, B, C, D), with each question carrying 1 mark for the correct answer. Design a program to accept the number of participants N such that N must be greater than 3 and less than 11. Create a double dimensional array of size (Nx5) to store the answers of each participant row-wise. Calculate the marks for each participant by matching the correct answer stored in a single dimensional array of size 5. Display the scores for each participant and also the participant(s) having the highest score. Example: If the value of N = 4, then the array would be: Note: Array entries are line fed (i.e. one entry per line) Test your program with the sample data and some random data: Example 1 INPUT : N = 5 Participant 1 D A B C C Participant 2 A A D C B Participant 3 B A C D B Participant 4 D A D C B Participant 5 B C A D D Key: B C D A A OUTPUT : Scores : Participant 1 D A B C C Participant 1 = 0 Participant 2 = 1 Participant 3 = 1 Participant 4 = 1 Participant 5 = 2 Highest score: Participant 5 Example 2 INPUT : N = 4 Participant 1 A C C B D Participant 2 B C A A C Participant 3 B C B A A Participant 4 C C D D B Key: A C D B B OUTPUT : Scores : Participant 1 = 3 Participant 2 = 1 Participant 3 = 1 Participant 4 = 3 Highest score: Participant 1 and Participant 4 14 Question: Write a program to declare a square matrix A[][] of order (M x M) where M must be greater than 3 and less than 10. Allow the user to input positive integers into this matrix. Perform the following tasks on the matrix: (a) Sort the non-boundary elements in ascending order using any standard sorting technique and rearrange them in the matrix. (b) Calculate the sum of both the diagonals. (c) Display the original matrix, rearranged matrix and only the diagonal elements of the rearranged matrix with their sum Example 1 INPUT :M = 4 9 8 15 7 2 13 6 12 1 8 3 23 5 4 11 8 OUTPUT: ORIGINAL MATRIX 9 8 15 7 2 13 6 12 1 8 3 23 5 4 11 8 REARRANGED MATRIX 9 8 15 7 2 3 8 12 1 6 13 23 5 4 11 8 DIAGONAL ELEMENTS 9 5 3 8 7 6 13 8 SUM OF THE DIAGONAL ELEMENTS = 59 15 Read a string of length not exceeding 30 and print the palindromic subsequence present in it. ex- abbaca 9 a,b,b,a,c,a,abba,bb,aca

Formatting page ...

Formatting page ...

Formatting page ...

Formatting page ...

Formatting page ...

 

  Print intermediate debugging step

Show debugging info


 

 

© 2010 - 2025 ResPaper. Terms of ServiceContact Us Advertise with us

 

sagnik_biswas chat