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

Advertisement

11.

What is operator overloading with methods? Illustrate with the help of an example using a python code.


Operator overloading is an ability to use an operator in more than one form.
Examples:
In the following example operator + is used for finding the sum of two integers:
     a = 7
     b = 5
     print(a+b) #gives the output: 12

Whereas in the next example, shown below the same + operator is used to add two strings:
     a = 'Indian '
     b = 'Government'
     print(a+b) #gives the output: Indian Government

67 Views

Advertisement
12.

Write a method in python to display the elements of list thrice if it is a number and display the element terminated with '#' if it is not a number.

For example, if the content of the list is as follows:

ThisList=['41','DROND','GIRIRAJ','13','ZARA']
414141
DROND#
GIRlRAJ#
131313
ZARA#

50 Views

13.

What will be the status of the following list after the fourth pass of bubble sort and fourth pass of selection sort used for arranging the following elements in descending order?
14, 10, –12, 9, 15, 35

69 Views

14.

Write a method in python to search for a value in a given list (assuming that the elements in the list are in ascending order) with the help of Binary Search method. The method should return –1 if the value does not present else it should return the position of the value present in the list.

56 Views

Advertisement
15.

Write PUSH (Books) and POP (Books) methods in python to add Books and remove Books considering them to act as Push and Pop operations of Stack.

64 Views

16.

Write a method in python to find and display the prime numbers between 2 to N. Pass N as an argument to the method.

63 Views

17.

Evaluate the following postfix notation of expression. Show status of the stack after every operation.
84, 62, –, 14, 3, *, +

60 Views

18.

Differentiate between the following:

  1. f = open(‘diary.txt’, ‘r’)
  2. f = open(‘diary.txt’, ‘w’)

54 Views

Advertisement
19.

Write a method in python to read the content from a text file diary.txt line by line and display the same on screen.

58 Views

20.

Consider the following definition of class Member, write a method in python to write the content in a pickled file member.dat.

class Member:
	def_init_(self,Mno,N) :
	self.Memno=Mno
	self.Name=N
	def Show(self):
		Display (self.Memno, '#',self.Name)
	def store_data(self):
		piFile = open('member.dat','wb')
		pickle.dump(self, piFile)
		piFile.close()

62 Views

Advertisement