Exam Paper Print – Computer Sir Ki Class

Exam Paper: Exam Paper Print (Python) No. of Q.278
Q.B01A 2

Which of the following can be used as valid variable identifier(s) in Python
(i) total
(ii) 7Salute
(iii) Que\$tion
(iv) global

Q.B01B 1

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

Q.B01C 2

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

```TEXT=""GREAT
DAY""
for T in range[0,7]:
print TEXT(T)
print T+TEXT```

Q.B01D 2

Find and write the output of the following Python code:

```STR = ["90","10","30","40"]
COUNT = 3
SUM = 0
for I in [1,2,5,4]:
S = STR[COUNT]
SUM = float (S)+I
print SUM
COUNT-=1```

Q.B01E 3

Find and write the output of the following python code:

```class ITEM:
def __init__(self,I=101,N="Pen",Q=10): #constructor
self.Ino=I
self.IName=N
self.Qty=int(Q);
def Buy(self,Q):
self.Qty = self.Qty + Q
def Sell(self,Q):
self.Qty -= Q
def ShowStock(self):
print self.Ino,":",self.IName,"#",self.Qty
I1=ITEM()
I2=ITEM(100,"Eraser",100)
I3=ITEM(102,"Sharpener")
I1.Buy(10)
I2.Sell(25)
I3.Buy(75)
I3.ShowStock()
I1.ShowStock()
I2.ShowStock()```

Q.B01F 2

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

```SIDES=["EAST","WEST","NORTH","SOUTH"];
N=random.randint(1,3)
OUT=""
for I in range(N,1,-1):
OUT=OUT+SIDES[I]
print OUT
(i) SOUTHNORTH   (ii) SOUTHNORTHWEST
(iii) SOUTH      (iv) EASTWESTNORTH```

Q.B02A 2

List four characteristics of Object Oriented programming.

Q.B02B 2

```class Test:
rollno=1
marks=75
def __init__(self,r,m): #function 1
self.rollno=r
self.marks=m
def assign(self,r,m): #function 2
rollno = n
marks = m
def check(self): #function 3
print self.rollno,self.marks
print rollno,marks```

(i) In the above class definition, both the functions – function 1 as well as function
2 have similar definition. How are they different in execution?
(ii) Write statements to execute function 1 and function 2.

Q.B02C 4

Define a class RING in Python with following specifications

```Instance Attributes
- RingID  # Numeric value with a default value 101
- Radius  # Numeric value with a default value 10
- Area    # Numeric value
Methods:
- AreaCal()  # Method to calculate Area as
# 3.14*Radius*Radius
- NewRing()  # Method to allow user to enter values of
# RingID and Radius. It should also
# Call AreaCal Method
- ViewRing() # Method to display all the Attributes```

Q.B02D 2

Differentiate between static and dynamic binding in Python? Give suitable examples of each.

Q.B02E 2

Write two methods in Python using concept of Function Overloading (Polymorphism) to perform the following operations:
(i) A function having one argument as side, to calculate Area of Square as side*side
(ii) A function having two arguments as Length and Breadth, to calculate Area of Rectangle as Length*Breadth.

Q.B03A 3

What will be the status of the following list after the First, Second and Third pass of the bubble sort method used for arranging the following elements in descending order ?
Note: Show the status of all the elements after each pass very clearly underlining the changes.
152, 104, -100, 604, 190, 204

Q.B03B 3

Write definition of a method OddSum(NUMBERS) to add those values in the list of NUMBERS, which are odd.

Q.B03C 4

Write Addnew(Book) and Remove(Book) methods in Python to Add a new Book and Remove a Book from a List of Books, considering them to act as PUSH and POP operations of the data structure Stack.

Q.B03D 2

Write definition of a Method AFIND(CITIES) to display all the city names from a list of CITIES, which are starting with alphabet A.
For example:
If the list CITIES contains
[“AHMEDABAD”,”CHENNAI”,”NEW DELHI”,”AMRITSAR”,”AGRA”]
The following should get displayed
AHEMDABAD
AMRITSAR
AGRA

Q.B03E 2

Evaluate the following Postfix notation of expression:
2,3,*,24,2,6,+,/,-

Q.B04A 1

Differentiate between file modes r+ and w+ with respect to Python.

Q.B04B 2

Write a method in Python to read lines from a text file DIARY.TXT, and display those lines, which are starting with an alphabet ‘P’.

Q.B04C 3

Considering the following definition of class COMPANY, write a method in Python to search and display the content in a pickled file COMPANY.DAT, where CompID is matching with the value ‘1005’.

```class Company:
def __init__(self,CID,NAM):
self.CompID = CID #CompID Company ID
self.CName = NAM #CName Company Name
self.Turnover = 1000
def Display(self):
print self.CompID,":",self.CName,":",self.Turnover```

Q.B01A 2

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

Q.B01B 1

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

Q.B01C 2

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)```

Q.B01D 2

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()```

Q.B01E 3

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.Bno + 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()```

Q.B01F 2

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

Q.B02A 2

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

Q.B02B 2

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)```

Q.B02C 4

Write a class CITY in Python with following specifications

```Instance Attributes
- Code # Numeric value
- Name # String value
- Pop # Numeric value for 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.```

Q.B02D 2

How do we implement abstract method in python? Give an example for the same.

Q.B02E 2

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

Section-C

Q. 05A 2

Observe the following table and answer the parts(i) and(ii) accordingly
Table:Product

Pno Name Qty PurchaseDate
101 Pen 102 12-12-2011
102 Pencil 201 21-02-2013
103 Eraser 90 09-08-2010
109 Sharpener 90 31-08-2012
113 Clips 900 12-12-2011

(i) Write the names of most appropriate columns, which can be considered as candidate keys.
(ii) What is the degree and cardinality of the above table?

Q. 05B 6

Write SQL queries for (i) to (iv) and find outputs for SQL queries (v) to (viii), which are based on the tables.
TRAINER

TID TNAME CITY HIREDATE SALARY
101 SUNAINA MUMBAI 1998-10-15 90000
102 ANAMIKA DELHI 1994-12-24 80000
103 DEEPTI CHANDIGARG 2001-12-21 82000
104 MEENAKSHI DELHI 2002-12-25 78000
105 RICHA MUMBAI 1996-01-12 95000
106 MANIPRABHA CHENNAI 2001-12-12 69000

COURSE

CID CNAME FEES STARTDATE TID
C201 AGDCA 12000 2018-07-02 101
C202 ADCA 15000 2018-07-15 103
C203 DCA 10000 2018-10-01 102
C204 DDTP 9000 2018-09-15 104
C205 DHN 20000 2018-08-01 101
C206 O LEVEL 18000 2018-07-25 105

(i) Display the Trainer Name, City & Salary in descending order of their Hiredate.

(ii) To display the TNAME and CITY of Trainer who joined the Institute in the month of December 2001.

(iii) To display TNAME, HIREDATE, CNAME, STARTDATE from tables TRAINER and COURSE of all those courses whose FEES is less than or equal to 10000.

(iv) To display number of Trainers from each city.

(v) SELECT TID, TNAME, FROM TRAINER WHERE CITY NOT IN(‘DELHI’, ‘MUMBAI’);

(vi) SELECT DISTINCT TID FROM COURSE;

(vii) SELECT TID, COUNT(*), MIN(FEES) FROM COURSE GROUP BY TID HAVING COUNT(*)>1;

(viii) SELECT COUNT(*), SUM(FEES) FROM COURSE WHERE STARTDATE< ‘2018-09-15’;

Q. 06A 2

State any one Distributive Law of Boolean Algebra and Verify it using truth table.

Q. 06B 2

Draw the Logic Circuit of the following Boolean Expression:
((U + V’).(U + W)). (V + W’)

Q. 06C 1

Derive a Canonical SOP expression for a Boolean function F(X,Y,Z) represented by the following truth table:

X Y Z F(X,Y,Z)
0 0 0 1
0 0 1 1
0 1 0 0
0 1 1 0
1 0 1 0
1 1 0 0
1 1 1 1

Q. 06D 3

Reduce the following Boolean Expression to its simplest form using K-Map:
F(X,Y,Z,W)= Σ (0,1,2,3,4,5,8,10,11,14)

Q. 07A 2

Arun opened his e-mail and found that his inbox was full of hundreds of unwanted mails. It took him around two hours to delete these unwanted mails and find the relevant ones in his inbox. What may be the cause of his receiving so many unsolicited mails? What can Arun do to prevent this happening in future?

Q. 07B 1

Assume that 50 employees are working in an organization. Each employee has been allotted a separate workstation to work. In this way, all computers are connected through the server and all these workstations are distributed over two floors. In each floor, all the computers are connected to a switch. Identify the type of network?

Q. 07C 1

Your friend wishes to install a wireless network in his office. Explain him the difference between guided and unguided media.

Q. 07D 2

Write the expanded names for the following abbreviated terms used in Networkingand Communications:
(i) CDMA (ii) HTTP (iii) XML (iv) URL

Q. 07E 4

Multipurpose Public School, Bangluru is Setting up the network between its Different Wings of school campus. There are 4 wings
namedasSENIOR(S),JUNIOR(J),ADMIN(A)andHOSTEL(H).
Multipurpose Public School, Bangluru

Distance between various wings are given below:

 WingAtoWingS 100m WingAtoWingJ 200m WingAtoWingH 400m WingAtoWingJ 300m WingAtoWingH 100m WingAtoWingH 450m

Number of Computers installed at various wings are as follows:

 Wings NumberofComputers WingA 20 WingS 150 WingJ 50 WingH 25

(i)Suggest the best wired medium and draw the cable layout to efficiently connect various wings of Multipurpose PublicSchool, Bangluru.

(ii) Name the most suitable wing where the Server should be installed. Justify your answer.

(iii) Suggest a device/software and its placement that would provide data security for the entire network of the School.

(iv) Suggest a device and the protocol that shall be needed to provide wireless Internet access to all smartphone/laptop users in the campus of Multipurpose Public School, Bangluru.

Q. 05A 2

Differentiate between DDL & DMLcommands. Identify DDL & DML commands from the following:-
(UPDATE, SELECT, ALTER, DROP)

Q. 05B 6

Consider the following relations MobileMaster & MobileStock:-

MobileMaster

M_Id M_Id
M_Company
M_Name M_Price M_Price
M_Mf_Date
MB001 Samsung Galaxy 4500 2013-02-12
MB003 Nokia N1100 2250 2011-04-15
MB004 Micromax Unite3 4500 2016-10-17
MB005 Sony XperiaM 7500 2017-11-20
MB006 Oppo SelfieEx 8500 2010-08-21
106 MANIPRABHA CHENNAI 2001-12-12 69000

MobileStock

MobileMaster

S_Id M_Id M_Qty M_Supplier
S001 MB004 450 New Vision
S002 MB003 250 Praveen Gallery
S003 MB001 300 Classic Mobile Store
S004 MB006 150 A-one Mobiles
S005 MB003 150 The Mobile
S006 MB006 50 Mobile Centre

Write the SQL query for questions from (i) to (iv) & write the output of SQL command for questions from (v) to (viii) given below:-
(i) Display the Mobile company, Mobile name & price in descending order of their manufacturing date.
(ii) List the details of mobile whose name starts with „S..
(iii) Display the Mobile supplier & quantity of all mobiles except „MB003..
(iv) To display the name of mobile company having price between 3000 & 5000.
(v) SELECT M_Id, SUM(M_Qty) FROM MobileStock GROUP BY M_Id;
(vi) SELECT MAX(M_Mf_Date), MIN(M_Mf_Date) FROM MobileMaster;
(vii) SELECT M1.M_Id, M1.M_Name, M2.M_Qty, M2.M_Supplier FROM MobileMaster M1, MobileStock M2 WHERE M1.M_Id=M2.M_Id AND M2.M_Qty>=300;
(viii) SELECT AVG(M_Price) FROM MobileMaster;

Q. 06A 2

State & prove De-Morgan‟s law using truth table.

Q. 06B 2

Draw the equivalent logic circuit diagram of the following Boolean expression:-
(A‟ + B).C’

Q. 06C 1

Write the SOP form for the Boolean Function F(X,Y,Z) represented by the given truth table:-

X Y Z F
0 0 0 0
0 0 1 1
0 1 0 1
0 1 1 0
1 0 0 0
1 0 1 0
1 1 0 1
1 1 1 1

Q. 06D 3

Reduce the following Boolean expression using K-Map:-
F(U,V,W,Z)= ð(0,2,5,7,12,13,15)

Q. 07A 1

A teacher provides “http://www.XtSchool.com/default.aspx” to his/her students to identify the URL & domain name.

Q. 07B 1

Which out of the following does not come under Cyber Crime?
(i) Copying data from the social networking account of a person without his/her information & consent.
(ii) Deleting some files, images, videos, etc. from a friend‟s computer with his consent.
(iii) Viewing & transferring funds digitally from a person‟s bank account without his/her knowledge.
(iv) Intentionally making a false account on the name of a celebrity on a social networking site.

Q. 07C 1

Expand the following:-
1. GSM 2. TDMA

Q. 07D 1

What is the significance of cookies stored on a computer?

Q. 07E 1

Kabir wants to purchase a Book online and placed the order for that book using an e-commerce website. Now, he is going to pay the amount for that book online using his Mobile, he needs which of the following to complete the online transaction:-
1. A bank account,
2. A Mobile connection/phone which is attached to above bank account,
3. The mobile banking app of the above bank installed on that mobile,
4. Login credentials(UserId & Password) provided by the bank,
5. All of above.

Q. 07F 1

What do you mean by data encryption? For what purpose it is used for?

Q. 07G 4

Sanskar University of Himachal Pradesh is setting up a secured network for its campus at Himachal Pradesh for operating their day-to-day office & web based activities. They are planning to have network connectivity between four buildings. Answer the question (i) to (iv) after going through the building positions in the campus & other details which are given below:

The distances between various buildings of university are given as:-

Building 1 Building 2 Distance(in mtrs.)
Main Admin 50
Main Finance 100
Main Academic 70
Admin Finance 50
Finance Academic 70
Admin Academic 60

Number of computers:-

Building No. of Computers
Main 150
Admin 75
Finance 50
Academic 60

As a network expert, you are required to give best possible solutions for the given queries of the university administration:-
(a) Suggest cable layout for the connections between the various buildings,
(b) Suggest the most suitable building to house the server of the network of the university,
(c) Suggest the placement of following devices with justification:
1. Switch/Hub
2. Repeater
(d) Suggest the technology out of the following for setting-up very fast Internet connectivity among buildings of the university
1. Optical Fibre
2. Coaxial cable
3. Ethernet Cable

Q. 05A 2

Observe the following table CANDIDATE carefully and write the name of the RDBMS operation out of (i) SELECTION (ii) PROJECTION (iii) UNION (iv) CARTESIAN PRODUCT, which has been used to produce the output as shown in RESULT ? Also, find the Degree and Cardinality of the RESULT.

TABLE: CANDIDATE

NO NAME STREAM
C1 AJAY LAW
C2 ADITI MEDICAL
C3 ROHAN EDUCATION
C4 RISHAB ENGINEERING

RESULT

NO NAME
C3 ROHAN

Q. 05B 6

Write SQL queries for (i) to (iv) and find outputs for SQL queries (v) to (viii), which are based on the tables
TABLE : BOOK

Code BNAME TYPE
F101 The priest Fiction
L102 German easy Literature
C101 Tarzan in the lost world Comic
F102 Untold Story Fiction
C102 War Heroes Comic

TABLE: MEMBER

MNO MNANE CODE ISSUEDATE
M101 RAGHAV SINHA L102 2016-10-13
M103 SARTHAK JOHN F102 2017-02-23
M102 ANISHA KHAN C101 2016-06-12

(i) To display all details from table MEMBER in descending order of ISSUEDATE.

(ii) To display the BNO and BNAME of all Fiction Type books from the table BOOK

(iii) To display the TYPE and number of books in each TYPE from the table BOOK

(iv) To display all MNAME and ISSUEDATE of those members from table MEMBER who have books issued (i.e ISSUEDATE) in the year 2017.

(v) SELECT MAX(ISSUEDATE) FROM MEMBER;

(vi) SELECT DISTINCT TYPE FROM BOOK;

(vii) SELECT A.CODE,BNAME,MNO,MNAME FROM BOOK A, MEMBER B
WHERE A.CODE=B.CODE ;

(viii) SELECT BNAME FROM BOOK
WHERE TYPE NOT IN (“FICTION”, “COMIC”);

Q. 06A 2

State Distributive Laws of Boolean Algebra and verify them using truth table.

Q. 06B 2

Draw the Logic Circuit of the following Boolean Expression using only NAND Gates:
X.Y + Y.Z

Q. 06C 1

Derive a Canonical SOP expression for a Boolean function F, represented by the following truth table:

U V W F(U,V,W)
0 0 0 1
0 0 1 0
0 1 0 1
0 1 1 1
1 0 0 0
1 0 1 0
1 1 0 1
1 1 1 0

Q. 06D 3

Reduce the following Boolean Expression to its simplest form using K-Map:
F(X,Y,Z,W)= Σ (0,1,2,3,4,5,10,11,14)