Name the Python Library modules which need to be imported to invo

Subject

Computer and Communication Technology

Class

CBSE Class 12

Pre Boards

Practice to excel and get familiar with the paper pattern and the type of questions. Check you answers with answer keys provided.

Sample Papers

Download the PDF Sample Papers Free for off line practice and view the Solutions online.
Advertisement

 Multiple Choice QuestionsShort Answer Type

1.

Out of the following, find those identifiers, which can not be used for naming Variable or Functions in a Python program:

_Cost, Price*Qty, float, Switch,
Address One, Delete, Number12, do

164 Views

Advertisement

2.

Name the Python Library modules which need to be imported to invoke the following functions
(i) load()
(ii) pow()


The Python Library modules which need to be imported to invoke the given functions are,

(i) pickle

(ii) math

56 Views

Advertisement
3.

Rewrite the following code in python after removing all syntax error(s). Underline each correction done in the code.

for Name in [Amar, Shveta, Parag]
     IF Name[0]='S':
          print(Name)

64 Views

4.

Find and write the output of the following python code:

Numbers=[9,18,27,36]
for Num in Numbers:
	for N in range(1, Num%8):
		print(N,;'#',end= '' )
	print()

55 Views

Advertisement
5.
Find and write the output of the following python code:
class Notes:

	def __init__(self,N=100,Nt='CBSE'): #constructor
		self.Nno=N
		self.NName=Nt

	def Allocate(self, N,Nt):
		self.Nno= self.Nno + N
		self.NName= Nt + self.NName

	def Show(self):
		print(self.Nno,'#',self.NName)

s=Notes()
t=Notes(200)
u=Notes(300,'Made Easy')
s.Show()
t.Show()
u.Show()
s.Allocate(4, 'Made ')
t.Allocate(10,'Easy ')
u.Allocate(25,'Made Easy')
s.Show()
t.Show()
u.Show()
55 Views

6.

What are the possible outcome(s) executed from the following code? Also, specify the maximum and minimum values that can be assigned to variable PICKER.

import random
PICK=random.randint(0,3)
CITY=['DELHI','MUMBAI','CHENNAI','KOLKATA']
for I in CITY:
	for J in range(1,PICK):
		print(I,end='')
		print()
i ii
DELHIDELHI
MUMBAIMUMBAI
CHENNAICHENNAI
KOLKATAKOLKATA
DELHI
DELHIMUMBAI
DELHIMUMBAICHENNAI
iii iv
DELHI
MUMBAI
CHENNAI
KOLKATA
DELHI
MUMBAIMUMBAI
KOLKATAKOLKATAKOLKATA

63 Views

7.

What is the difference between Multilevel and Multiple inheritance? Give suitable examples to illustrate both.

80 Views

8.

What will be the output of the following python code considering the following set of inputs?

JAYA
My 3 books
PICK2
2120

Also, explain the try and except used in the code.

Counter=0
while True:
	try:
		Number=int(raw_input('Give a Number'))
		break
	except ValueError:
		Counter=Counter+2
		print('Reenter Number')
print(Counter)

70 Views

Advertisement
9.

Write a class CITY in Python with following specifications
Instance Attributes

-Code   # Numeric value
-Name # String value
-Pop      #Numeric value of population
-KM      # Numeric value
-Density #Numeric value for Population Density

Methods:
CalDen()# Method to calculate Density as Pop/KM
Record()# Method to allow user to enter values
Code,Name,Pop,KM and call CalDen() method
See()# Method to display all the members also display
              a message Highly Populated Area
              if the Density is more than 12000

67 Views

10.

What is the significance of super() method? Give an example of the same.

70 Views

Advertisement