Log in
Sign up for FREE
arrow_back
Library

2020-21 XII CS PT1

star
star
star
star
star
Last updated over 5 years ago
17 questions
Note from the author:
Questions As per cbse for class XII including chapter revision python, function and text file handling
1
1
3
3
2
3
Question 6
6.

What is the difference between mutable and immutable data types?. Name them.

2
1
2
2
3
2
2
2
3
3
5
Question 1
1.

Is Python a Compiler language or an interactive 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”)

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

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.

Question 7
7.

Write a python program to create a dictionary containing a book I’d and title taken from the user.

Question 8
8.

Python can have three types of functions: Name them.

Question 9
9.

Write the forms to importing python module statements

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.

Question 13
13.

What are the different file processing mode supported by python?

Question 14
14.

What is the difference between readline() and readlines() function?

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.

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”

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.