Log in
Sign up for FREE
arrow_back
Library
2020-21 XII CS PT1
By Dharmender Singh
star
star
star
star
star
Share
share
Last updated over 5 years ago
17 questions
Add this activity
Note from the author:
Questions As per cbse for class XII including chapter revision python, function and text file handling
1
2
3
4
5
6
7
zoom_in
1
1
3
3
2
3
Question 6
6.
What is the difference between mutable and immutable data types?. Name them.
2
8
9
10
11
12
13
14
15
16
17
zoom_in
1
2
2
3
2
2
2
3
3
5
Question 1
1.
Is Python a Compiler language or an interactive language?
A) A Compiler language
B) An interpreter language
Question 2
2.
Consider the code. What will be the output?
b=12
d=b
If id(b)==id(d):
print(“Id are same”)
else:
print(“Id are not same”)
A) Id are same
B) Id are not same
C) No output
D) Error
Question 3
3.
Find errors in the following code (if any) and correct the code by rewriting it and underlining the corrections:
x=int(“Enter value of x”)
for in range[0,11]:
if x=y
print x+y
Else:
Print x-y
visibility
View drawing
Question 4
4.
Write the output of the following code when executed:
Text=“KVina@com”
Tl=len(Text)
NewText=“”
for i in range(0,Tl ):
if Text[i].isupper():
NewText=NewText+Text[i].lower()
elif Text[i].isalpha():
NewText=NewText+Text[i].upper()
else:
NewText=NewText+ “##”
print(NewText)
Question 5
5.
Write a python program to calculate the length of a string without using len() function.
visibility
View drawing
Question 7
7.
Write a python program to create a dictionary containing a book I’d and title taken from the user.
visibility
View drawing
Question 8
8.
Python can have three types of functions: Name them.
A) Modules
B) Short Function
C) User-defined Function
D) Long Function
E) Built-in Function
Question 9
9.
Write the forms to importing python module statements
A) import statement
B) insert statement
C) use statement
D) from - import
Question 10
10.
What is the difference between local variables and global variables? Also give suitable python code to illustrate both.
Question 11
11.
What is an argument? How many types of actual arguments? Write name also.
Question 12
12.
Write a python function to sum all the items/numbers in a list.
visibility
View drawing
Question 13
13.
What are the different file processing mode supported by python?
A) r
B) w
C) o
D) a
Question 14
14.
What is the difference between readline() and readlines() function?
visibility
View drawing
Question 15
15.
Write a function countword() in python to read the text file “abc.txt” and count the number of times “is” occurs in the file.
visibility
View drawing
Question 16
16.
Write a method in python to read lines from a text file “xyz.txt” and display those lines which start with the alphabet “H”
visibility
View drawing
Question 17
17.
a) A ___________ function links the file object with the file on the disk.
b) A ___________ function breaks the link of the file object and the file on the disk.
c) A ___________ function read all lines and stores in the list.
d) A ___________ function is used to convert a sentence string into word list.
e) A ___________ function is used to write a list in a text file.