0% found this document useful (0 votes)
428 views2 pages

Computer Sci Class 12 Holiday Homework

The document provides homework instructions for a Computer Science class. It lists 16 questions for students to answer related to Python programming concepts like functions, lists, files, and dictionaries. Students are asked to write code snippets, define terms, and justify outputs to demonstrate their understanding of various Python topics.

Uploaded by

Aaryaraj Goswami
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)
428 views2 pages

Computer Sci Class 12 Holiday Homework

The document provides homework instructions for a Computer Science class. It lists 16 questions for students to answer related to Python programming concepts like functions, lists, files, and dictionaries. Students are asked to write code snippets, define terms, and justify outputs to demonstrate their understanding of various Python topics.

Uploaded by

Aaryaraj Goswami
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/ 2

COMPUTER SCIENCE (083)

CLASS: XII
Holiday Homework –Autumn Break

 Write the answer of following questions in home work copy

1) Write the output of the following Python code:


for i in range (5,20,5):
print ( i + '-' )
2) if the following code is executed, what will be the output of the following code?
s = “This is python language”
print (s [ 8 : : ] )
3) What is the difference between Packet switching and circuit switching techniques?
and
In networking, what is WAN? How is it different from LAN?
4) Expand the following terms:
i) GPS ii) ATM iii) GPRS iv) IRC
5) def simple_interest(p, r, t):
return (p*r*t)/100
print (simple_interest(100,5,2))

Identify the formal and actual parameters in the above code snippet. Define formal and
actual parameters in a function.
and
c = 10
def add():
global c
c=c+2
print("Inside add():", c)
add()
c=15
print("In main:", c)

output:
Inside add() : 12
In main: 15
Consider the above program and justify the output. What is the output if “global c “ is
not written in the function add().
6) Write a Python program to sum all the items in a list.
7) Write a Python program to get the largest number from a list.
8) Write a Python program to count the number of strings where the string length is 2 or
more and the first and last character are same from a given list of strings.
Sample List : ['abc', 'xyz', 'aba', '1221']
9) Write a Python program to remove duplicates from a list.
10) Write a Python program to generate and print a list of first and last 5 elements where
the values are square of numbers between 1 and 30 (both included).
11) Write a Python program to get a string from a given string where all occurrences of its
first char have been changed to '$', except the first char itself.
Sample String : 'restart'
Expected Result : 'resta$t'
12) A blood bank maintains data file “Blood.dat” that contains following information for
every donor: donor name, donor date of birth, donor address, donor phone number and
donor blood group. Write a complete program to do the following:
a) Create a file of the donor
b) Append a record in the file
c) Display the records
d) Given the blood group display name, address of the donor
e) Modify the existing information of the donor
13) Write an interactive menu driven program with the following four functions:
a) To create a text file called “Nation.txt”
b) Display the file
c) Append relevant content to the file
d) Make a copy of the file
e) Count the total number of “the” in the file
14) Create a binary file with name and roll number. search for a given roll number and
display the
name, if not found display appropriate message.
15) Write a program with a user -defined function with string as a parameter which replaces
all vowels in the string with ‘*’.
16) WAP to store students’ details like admission number, roll no, name and percentage in
a dictionary and display information on the basic of admission number.

*******

You might also like