0% found this document useful (0 votes)
190 views5 pages

Holiday Assignment Xii

This document contains instructions for a Computer Science holiday homework assignment for Class 12. It lists 50 questions covering topics like functions, variables, classes, inheritance, files, and data structures. Students are instructed to answer all questions in short and long form in a separate notebook. The questions cover concepts like default arguments, scopes, parameters, operators, sequences, dictionaries, classes, inheritance, polymorphism, exceptions, files, and data structures like stacks and queues.

Uploaded by

Suman Vashist
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
0% found this document useful (0 votes)
190 views5 pages

Holiday Assignment Xii

This document contains instructions for a Computer Science holiday homework assignment for Class 12. It lists 50 questions covering topics like functions, variables, classes, inheritance, files, and data structures. Students are instructed to answer all questions in short and long form in a separate notebook. The questions cover concepts like default arguments, scopes, parameters, operators, sequences, dictionaries, classes, inheritance, polymorphism, exceptions, files, and data structures like stacks and queues.

Uploaded by

Suman Vashist
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/ 5

DPS MIS, DOHA- QATAR

Holiday Homework (2015 16)


CLASS: XII
General Instructions:
SUBJECT: COMPUTER SCIENCE
(i) The holiday homework contains chapter wise short answers questions and
long answers questions.
(ii) The students are required to attempt them in a separate notebook.
__________________________________________________________________________
1. What are default arguments? How are they useful?
2.

7.

What is scope of a variable? What types of scopes can be there in Python.


What is the difference between the formal parameters and actual parameters?
What are their alternative names? Also, give a suitable Python code to
illustrate both.
How are nongraphic characters represented in Python?
What is Type casting? How is implicit type conversion different from explicit
type conversion?
Write the corresponding python expressions for the following mathematical
expressions:
(i)(a2+b2+c2)
(ii) 2-ye2y+4y
What are mutable and immutable types? List immutable and mutable types
of Python.
How do you add key: value pairs to an existing dictionary?

8.

How are lists different from strings when both are sequences?

9.

How are tuples different from lists when both are sequences?

3.
4.
5.

6.

10. How are dictionaries different from lists?


11. What is the length of the tuple shown below?
t=((((a,1), b, c), d,2), e, 3)
12. What is an object? What is a class? How is an object different from a class?
13. How are the terms abstraction and encapsulation related?
14. Why classes are called Abstract data type?
15. What is polymorphism? Give an example illustrating polymorphism.
Page 1 of 5

16. How are methods different from ordinary functions?


17. How private members are different from public members of a class?
18. What do you understand by operator overloading? Rewrite the expression by
using built-in method for operating overloading:
(i) a**b
(ii) a%b
19. What are instance variables? How are they different from class variables?
20. What are the differences between instance methods and static method?
21. What is the role of __del__( ) method in a class? Explain with the help of an
example.
22. What is the role of __init__( ) method in a class? Explain with the help of an
example.
23. What is self-reference? Why is it important?
24. What do you understand by static binding and dynamic binding?
25. Define inheritance. Explain the different type of inheritance with example
code.
26. What is method overriding? What is its significance?
27. What is super() function? What is its significance?
28. Explain : (i) Linear search method and (ii) Binary search
29. What is circular queue?
30. What are infix expression? What are postfix expression?
31. Convert X: A+(B*C-(D/EF)*G)*H into postfix form showing stack status
after every step in tabular form.
32. What is stack? What basic operation can be performed on them?
33. What is queue? What basic operation can be performed on them?
34. Write equivalent infix expression for : 10, 3, *, 7, 1, -, *, 23, +
35. What is the role of file object in data file handling?
36. Write statements to place the file pointer :
(i) to beginning of file
(ii) to 25th byte from the beginning
(iii) to 10 bytes behind the current position of file pointer
Page 2 of 5

(iv) to 15 bytes ahead of current position of file pointer


37. What is the difference between w and a modes?
38. What is an Exception? When is Exception Handling required?
39. What is the purpose of the finally clause of a try-catch-finally statement?
40. When do you need multiple except handlers exception catching blocks?
41. Declare a class to represent fixed-deposit account of 5 customers, with the
following data members: Name of the depositor, Account Number, Time
Period (1 or 3 or 5 years), Amount. The class also contains following member
functions:
(a) To initialize data members.
(b) For withdrawal of money (after half of the time period has passed)
(c) To display the data members.
42. Predict the output and justify your answer:
class base:
def __init__(self,arg):
self.v1=arg
class derived(base):
def __init__(self,arg):
self.v2=arg
obj=derived(10)
print obj.v1, obj.v2
The output is:
a. None None
b. None 10- incorrect
c. 10 None
d. 10 10
e. Error is generated by program
43. Write a program to implement a stack for book-details (bookno, book name).
That is now, each item node of the stack contains two types of informationbookno and name. Implement the above using push and display operation.
44. A file sports.dat contains information in following format: Event
Participant. Write a function that would read contents from file sports.dat
and creates a file named Athletic. dat copying only those records from
sports.dat where the event name is Athletics.
45. Imagine a ticket booth at a fair. People passing by are requested to purchase a
ticket. A ticket is priced as Rs. 2.50/-. The booth keeps track of the number of
people that have visited and of the total amount of money collected. Model
this ticket selling booth with a class called ticbooth including following
Page 3 of 5

members:
Data Members:
Number of people visited
Total amount of money collected
Members Functions:
To assign initial values (assign 0 to both data members)
To increment only people total in case ticket is not sold out
To increment people total as well as amount total if a ticket is sold out
To display the two totals
To display the number of tickets sold out (a tricky one)
Include a program to test this class.
46. Define a class represent a book in a library. Include the following members:
Data Members:
Book Number
Book Name
Author
Publisher
Price
No. of copies
No. of copies issued
Members Functions:
To assign initial values
To issue a book after checking for its availability (Increment No. of
copies)
To return a book (Decrement No. of copies)
To display book information
47. Define a class ITEMINFO in Python with the following description:
Data Members:
ICode (Item Code)
Item (Item Name)
Price (Price of each item)
Qty (quantity in stock)
Discount (Discount percentage on the item)
Netprice (Final Price)
Members Functions:
A member function FindDisc( ) to calculate discount as per the
following rule:
If Qty<=10 Discount is 0
If Qty (11 to 20) Discount is 15
If Qty>=20 Discount is 20
A constructor( __init__ method) to assign the value with 0 for ICode,
Price, Qty, Netprice and Discount and null for Item respectively.
Page 4 of 5

A function Buy( ) to allow user to enter values for ICode, Item, Price, Qty

and call function FindDisc( ) to calculate the discount and


Netprice(Price*Qty-Discount).
A Function ShowAll( ) to allow user to view the content of all the data
members.
48. Declare the base class 'employee' with employee's number, name,
designation, address, phone number.
Define and declare the function getdata() and putdata() to get the employee's
details and print employee's details.
Declare the derived class salary with basic pay, DA, HRA, Gross pay, PF,
Income tax and Net pay.
Declare and define the function getdata1() to call getdata() and get the basic
pay.
Define the function calculate() to find the net pay.
Define the function display() to call putdata() and display salary details .
Create the derived class object.
Read the number of employees.
Call the function getdata1() and calculate() to each employees.
Call the display() function.
49. Create a binary file with the name CUSTOMER.DAT having the record
structure for class student:
Customer
No. Numeric
Customer
Type Character (Preferred/not preferred)
Name
Record with in a record(first, last and middle name)
Address
string[50]
Phone_no
string [7]
balance
float
Bill_date
Record within a record (dd/mm/yy)
Print a "Customer Status Report" using the above file as input. Write a menu
driven program to print
- A report of all customers
- A line only for those customers who have a balance greater than Rs. 10,000
while other customers are ignored along with the customer no., name, phone
no. And balance due.
50. Create a binary file Student containing students records having their name,
roll no., and marks in Computer science. Write procedures to perform the
following:
(i) Display all names along with their marks.
(ii) Insert a student record at the appropriate rollno.
(iii) Delete a particular student.

Page 5 of 5

You might also like