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




Name the Python Library modules which need to be imported to invoke the
following functions
(i) ceil() (ii) randint()
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
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
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()
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
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.
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
Differentiate between static and dynamic binding in Python? Give suitable examples of each.
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.
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
Write definition of a method OddSum(NUMBERS) to add those values in the list of NUMBERS, which are odd.
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.
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
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’.
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
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 |
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”);
Draw the Logic Circuit of the following Boolean Expression using only NAND Gates:
X.Y + Y.Z
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 |
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)
Differentiate between Radio Link and Microwave in context of wireless communication technologies.
Amit used a pen drive to copy files from his friend’s laptop to his office computer. Soon his office computer started abnormal functioning. Sometimes it would restart by itself and sometimes it would stop functioning totally. Which of the following options out of (i) to (iv), would have caused the malfunctioning of the computer.
Justify the reason for your chosen option:
(i) Computer Worm
(ii) Computer Virus
(iii) Computer Bacteria
(iv) Trojan Horse
Jai is an IT expert and a freelancer. He recently used his skills to access the Administrator password for the network server of Megatech Corpn Ltd. and provided confidential data of the organization to its Director, informing him about the vulnerability of their network security. Out of the following options (i) to (iv), which one most appropriately defines Jai.
Justify the reason for your chosen option:
(i) Hacker
(ii) Cracker
(iii) Operator
(iv) Network Admin
Hi Speed Technologies Ltd is a Delhi based organization which is expanding its office setup to Chandigarh. At Chandigarh office campus, they are planning to have 3 different blocks for HR, Accounts and Logistics related work. Each block has number of computers, which are required to be connected in a network for communication, data and resource sharing. As a network consultant, you have to suggest the best network related solutions for them for issues/problems raised in (i) to (iv), keeping in mind the distances between various blocks/locations and other given parameters.
Shortest distances between various blocks/locations:
HR Block to Accounts Block | 400 Metres |
Accounts Block to Logistics Block | 200 Metres |
Logistics Block to HR Block | 150 Metres |
DELHI Head Office to CHANDIGARH Office | 270 Km |
Number of Computers installed at various blocks are as follows:
HR Block | 70 |
Account Block | 50 |
Logistics Block | 40 |
(i) Suggest the most appropriate block/location to house the SERVER in the CHANDIGARH Office (out of the 3 Blocks) to get the best and effective connectivity. Justify your answer.
(ii) Suggest the best wired medium and draw the cable layout (Block to Block) to efficiently connect various Blocks within the CHANDIGARH office compound.
(iii) Suggest a device/software and its placement that would provide data security for the entire network of CHANDIGARH office.
(iv) Which of the following kind of network, would it be
(a) PAN
(b) WAN
(c) MAN
(d) LAN