Thanks to visit codestin.com
Credit goes to www.scribd.com

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

Chapterwise QB Xii Cs Function File

The document covers key concepts related to working with functions and file handling in Python. It includes questions about function headers, return statements, and the correct syntax for function definitions and calls. Additionally, it addresses file handling concepts such as reading and writing to text and binary files, as well as specific programming tasks involving functions.

Uploaded by

subhayu112007
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)
5 views2 pages

Chapterwise QB Xii Cs Function File

The document covers key concepts related to working with functions and file handling in Python. It includes questions about function headers, return statements, and the correct syntax for function definitions and calls. Additionally, it addresses file handling concepts such as reading and writing to text and binary files, as well as specific programming tasks involving functions.

Uploaded by

subhayu112007
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

CHAPTER: WORKING WITH FUNCTIONS

1. Which of the following components are part of a function header in Python?


a. Function Name
b. Return Statement
c. Parameter List
d. Both a and c
2. Which of the following statement returns single/multiple values from function in Python?
a. Function Name
b. Return Statement
c. Parameter List
d. Both a and c
3. Which of the following is used in function body?
a. Function Name
b. Return Statement
c. Formal parameters List
d. Both a and c
4. Which of the following can be used in main function of Python program?
a. Function Name
b. Return Statement
c. Actual Parameter List
d. Both a and c
5. Which of the following function header is correct?
a. def cal_si(p=100, r, t=2)
b. def cal_si(p=100, r=8, t)
c. def cal_si(p, r=8, t)
d. def cal_si(p, r=8, t=2)
6. Which of the following is the correct way to call a function?
a. my_func()
b. def my_func()
c. return my_func
d. call my_func()
7. What will be the output of the following Python
code?
def add (num1, num2):
sum = num1
+ num2 sum =
add(20,30)
print(sum)
a. 50 b. 0 c. Null d. None
8. What will be the output of the following code?
def my_func(var1=100, var2=200):
var1+=10
var2 = var2 - 10
return var1+var2
print(my_func(50),my_func())
a. 100 200 b. 150 300 c. 250 75 d. 250 300
[3 MARKS EACH]
9. WAP to calculate square, cube and factorial of a given input number using functions.
10. WAP to calculate area and perimeter of a rectangle using functions.
11. WAP to calculate area and perimeter of a square using functions.
12. Write a function to accept a number and return its unit digit.
CHAPTER: FILE HANDLING
[1 MARK EACH]
1. Import pickle is required for
A. text file B. binary file C. CSV file
2. The function changes the position of the file pointer.
A. tell() B) seek C) read() D) wirte()
3. is the process of converting python object hierarchy into a byte stream
A. Sorting B. Pickling C. Converting D. Unpickling
4. To write in Binary file () is used
A. read() B. write() C. dump() D. load()
5. To read from Binary file () is used
A. read() B. write() C. dump() D. load()
[2 MARKS EACH]
6. What is a Data file?
7. What is the difference between text file and binary file?
8. What is CSV file?
9. What are the functions used to read and write from text file?
10. What are the functions used to read and write from binary file?
12. What are the functions used to read and write from CSV file?
13. What is the difference between read() and readline()?
14. What do you mean by appending in a file?
15. Write a function in python to count the number of lines in a text file ‘STORY.TXT’ Which is starting with
an alphabet ‘C’.
16. WAP in python that copies a text file ‘Source.txt’ onto ‘Destination.txt’ baring the Lines starting with
a ‘#’ sign.
17. A text file contains alphanumeric text (say an.txt).Write a program that reads this text file and prints only
the numbers or digits from the file.

You might also like