Log in
Sign up for FREE
arrow_back
Library
XII CS PT1 cloned 9/17/2020
By Ranjeet Mamgain
star
star
star
star
star
Share
share
Last updated over 5 years ago
27 questions
Add this activity
Note from the author:
XII CS PT-1
1
1
1
1
1
1
1
1
1
1
4
2
2
2
3
1
1
1
1
1
1
1
1
1
3
3
2
Question 1
1.
Q1. A Function in python begins with keyword_____.
Question 2
2.
Q2. Name the statement that sends back value from a function.
Question 3
3.
Q3. A variable declared or defined within function body is known as _______
Question 4
4.
Q4. What is the output of the program given below?
x=20
def func(x):
x=2
func(x)
print('x is now',x)
Question 5
5.
Q5. More than one value(s) can be returned by a function in Python.
True
False
Question 6
6.
Q6. The variable declared inside the function is called a global variable.
True
False
Question 7
7.
Q7. A local variable having the same name as that of a global variable hides the global variable in its function.
True
False
Question 8
8.
Q8. Built in functions are created by users and are not a part of python library.
True
False
Question 9
9.
Q9. The first line of a function header begins with def keyword and ends with a colon(:)
True
False
Question 10
10.
Q10. The variable declared out siide all the functions is called __________
Question 11
11.
Q11. What will be the output of the following code? 4
def func(a,b=2,c=0.10):
return(a*b*c)
print(func(6100,1))
print(func(5000,c=0.05))
print(func(5000,3,0.12))
print(func(b=4,a=5000))
Question 12
12.
Q12 write a python function SUM to sum the numbers in a list
Sample List [4,6,3,5,6]
Expected output:24
visibility
View drawing
Question 13
13.
Q13. Write a python function to print the sum of even numbers from a given list
visibility
View drawing
Question 14
14.
Q14. What is the difference between local variable and global variable?
visibility
View drawing
Question 15
15.
Q15. What possible output(s) are expected
import random
AR=[20,30,40,50,60,70]
FROM=random.randint(1,3)
TO=random.randint(2,4)
for K in range(FROM,TO+1):
print(AR[K],end="#")
i) 10#40#70#
ii) 30#40#50#
iii)50#60#70#
iv)40#50#70#
Question 16
16.
Which of the following commands can be used to read “n”number of characters from a file using the file object named file
file.read(n)
file.read(n char)
n.file(read)
file.read(n bytes)
Question 17
17.
Which of the statements are true for read()
A. read () reads entire file and returns in form of list
B. read( ) reads file in any chosen data type
C. read ( ) reads entire file and returns the content in form of string and default argument is -1
D. read( ) function is a built in function
Question 18
18.
CSV files store data in
A .binary form
B. text (ASCII or UNICODE)
C. both A and B
None of the Above
Question 19
19.
Identify the correct option to open a file c:\text.dat for appending in Python Program
f1=open("c:/text.dat","wb")
f1=open("c:/text.dat","rw")
f1=open("c:\text.dat","r+")
f1=open("c:/text.dat","ab")
Question 20
20.
format is a text format, accessible to all applications across several platforms
CSV
jpeg
bitmap
png
Question 21
21.
method is used for random access of data in a CSV file
seek()
pack()
tell()
load()
Question 22
22.
method of pickle module is used to write an object into binary file
seek()
dump()
load()
pack()
Question 23
23.
method of pickle module is used to read data from a binary file
seek()
dump()
load()
pack()
Question 24
24.
Which of the following is not a valid mode to open a file?
ab
rw
r+
w+
Question 25
25.
Write a user-defined function in python that displays the number lines starting with 'H' in the file 'Para.txt'
visibility
View drawing
Question 26
26.
Write a function countmy() in Python to read the text file "Data.Txt" and count the number of times "my" occurs in the file.
visibility
View drawing
Question 27
27.
Differentiate between file modes r+ and w+
visibility
View drawing