Out of the following, find those identifiers, which can not be used for naming Variable or Functions in a Python program:
Total*Tax, While, class, switch,
3rdRow, finally, Column31, _Total




Name the Python Library modules which need to be imported to invoke the following functions
(i) sqrt()
(ii) dump()
Rewrite the following code in python after removing all syntax error(s). Underline each correction done in the code.
for Name in [Ramesh,Suraj,Priya] IF Name[0]='S': print(Name
Find and write the output of the following python code:
Values=[10,20,30,40] for Val in Values: for I in range(1, Val%9): print(I,"*",end= "" ) print()
Find and write the output of the following python code:
class Book: def __init__(self,N=100,S="Python"): #constructor self.Bno=N self.BName=S def Assign(self, N,S): self.Bno= self.Bno + N self.BName= S + self.BName def ShowVal(self): print(self.Bno,"#",self.BName) s=Book() t=Book(200) u=Book(300,"Made Easy") s.ShowVal() t.ShowVal() u.ShowVal() s.Assign(5, "Made ") t.Assign(15,"Easy ") u.Assign(25,"Made Easy") s.ShowVal() t.ShowVal() u.ShowVal()
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 PICKER=random.randint(0,3) COLOR=["BLUE","PINK","GREEN","RED"]; for I in COLOR: for J in range(1,PICKER): print(I,end="") print()
(i) | (ii) | (iii) | (iv) |
BLUE PINK GREEN RED |
BLUE BLUEPINK BLUEPINKGREEN BLUEPINKGREENRED |
PINK PINKGREEN GREENRED |
BLUEBLUE PINKPINK GREENGREEN REDRED |
What is the difference between Multilevel and Multiple inheritance? Give suitable examples to illustrate both.
What will be the output of the following python code considering the following set of inputs? AMAR THREE A123 1200 Also, explain the try and except used in the code. Start=0 while True: try: Number=int(raw_input(“Enter Number”)) break except ValueError: Start=Start+2 print(“Reenter an integer”) print(Start)
Write a class CITY in Python with following specifications
Instance Attributes -Ccode # Numeric value -CName # String value -Pop # Numeric value for Population -KM # Numeric value -Density # Numeric value for Population Density Methods: -DenCal() # Method to calculate Density as Pop/KM -Record() # Method to allow user to enter values Ccode,CName,Pop,KM and call DenCal() method -View() # Method to display all the members also display a message ”Highly Populated City” if the Density is more than 10000
What will be the status of the following list after the First, Second and Third pass of the selection 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.
12, 14, 54, 64, 90, 24
For a given list of values in descending order, write a method in python to search for a value with the help of Binary Search method. The method should return position of the value and should return ‐1 if the value not present in the list.
Write Insert(City) and Delete(City) methods in python to add City and Remove City considering them to act as Insert and Delete operations of the data structure Queue.
Write a method in python to find and display the prime numbers between 2 to N. Pass N as argument to the method.
Evaluate the following postfix notation of expression. Show status of stack after every operation.
12,2,/,34,20,-,+,5,+
Write a statement in Python to perform the following operations:
● To open a text file “MYPET.TXT” in write mode
● To open a text file “MYPET.TXT” in read mode
Write a method in python to write multiple line of text contents into a text file daynote.txt line.
Consider the following definition of class Employee, write a method in python to search and display the content in a pickled file emp.dat, where Empno is matching with ‘A0005’.
class Employee: def __init__(self,E,NM): self.Empno=E self.EName=NM def Display(self): print(self.Empno,"-",self.EName)
Observe the following PARTICIPANTS and EVENTS tables carefully and write the name of the RDBMS operation which will be used to produce the output as shown in RESULT ? Also, find the Degree and Cardinality of the result.
PNO | NAME |
---|---|
1 | Aruanabha Tariban |
2 | John Fedricks |
3 | Kanti Desai |
EVENTCODE | EVENTNAME |
---|---|
1001 | IT Quiz |
1002 | Group Debate |
RESULT
PNO | NAME | EVENTCODE | EVENTNAME |
---|---|---|---|
1 | Aruanabha Tariban | 1001 | IT Quiz |
1 | Aruanabha Tariban | 1002 | Group Debate |
2 | John Fedricks | 1001 | IT Quiz |
2 | John Fedricks | 1002 | Group Debate |
3 | Kanti Desai | 1001 | IT Quiz |
3 | Kanti Desai | 1002 | Group Debate |
Write SQL queries for (i) to (iv) and find outputs for SQL queries (v) to (viii), which are based on the tables
Table: VEHICLE
VCODE | VEHICLETYPE | PERKM |
---|---|---|
V01 | VOLVO BUS | 150 |
V02 | AC DELUXE BUS | 125 |
V03 | ORDINARY BUS | 80 |
V05 | SUV | 30 |
V04 | CAR | 18 |
Note: PERKM is Freight Charges per kilometer
Table: TRAVEL
CNO | CNAME | TRAVELDATE | KM | VCODE | NOP |
---|---|---|---|---|---|
101 | K.Niwal | 2015-12-13 | 200 | V01 | 32 |
103 | Fredrick Sym | 2016-03-21 | 120 | V03 | 45 |
105 | Hitesh Jain | 2016-04-23 | 450 | V02 | 42 |
102 | Ravi Anish | 2016-01-13 | 80 | V02 | 40 |
107 | John Malina | 2015-02-10 | 65 | V04 | 2 |
104 | Sahanubhuti | 2016-01-28 | 90 | V05 | 4 |
106 | Ramesh Jaya | 2016-04-06 | 100 | V01 | 25 |
Note:
- Km is Kilometers travelled
- NOP is number of passengers travelled in vehicle
(i) To display CNO, CNAME, TRAVELDATE from the table TRAVEL in descending order of CNO.
(ii) To display the CNAME of all the customers from the table TRAVEL who are traveling by vehicle with code V01 or V02.
(iii) To display the CNO and CNAME of those customers from the table TRAVEL who travelled between ’2015-12-31’ and ‘2015-05-01’.
(iv) To display all the details from table TRAVEL for the customers, who have travel distance more than 120 KM in ascending order of NOP.
(v) SELECT COUNT(*),VCODE FROM TRAVEL GROUP BY VCODE HAVING COUNT(*)>1;
(vi) SELECT DISTINCT VCODE FROM TRAVEL;
(vii) SELECT A.VCODE,CNAME,VEHICLETYPE
FROM TRAVEL A,VEHICLE B
WHERE A.VCODE=B.VCODE AND KM<90;
(viii) SELECT CNAME,KM*PERKM
FROM TRAVEL A,VEHICLE B
WHERE A.VCODE=B.VCODE AND A.VCODE=’V05′;
Verify the following using Boolean Laws.
X’+ Y’Z = X’.Y’.Z’+ X’.Y.Z’+ X’Y.Z+ X’.Y’.Z+ X.Y’.Z
Derive a Canonical SOP expression for a Boolean function G, represented by the following truth table:
A | B | C | G(A,B,C) |
---|---|---|---|
0 | 0 | 0 | 1 |
0 | 0 | 1 | 0 |
0 | 1 | 0 | 1 |
1 | 0 | 0 | 0 |
1 | 0 | 1 | 0 |
1 | 1 | 0 | 1 |
1 | 1 | 1 | 1 |
Reduce the following Boolean Expression to its simplest form using K-Map:
F(P,Q,R,S)= Σ(0,4,5,8,9,10,11,12,13,15)
Write two advantages of 3G over 2G Mobile Telecommunication Technologies in terms of speed and services?
Categories the following under Client side and Server Side script category?
(i) Java Script
(ii) ASP
(iii) VB Sript
(iv) JSP
Intelligent Hub India is a knowledge community aimed to uplift the standard of skills and knowledge in the society. It is planning to setup its training centers in multiple towns and villages pan India with its head offices in the nearest cities. They have created a model of their network with a city, a town and 3 villages as follows.
As a network consultant, you have to suggest the best network related solutions for their issues/problems raised in (i) to (iv), keeping in mind the distances between various locations and other given parameters.
Shortest distances between various locations:
VILLAGE 1 to YTOWN | 2 KM |
VILLAGE 2 to YTOWN | 1.5 KM |
VILLAGE 3 to YTOWN | 3 KM |
VILLAGE 1 to VILLAGE 2 | 3.5 KM |
VILLAGE 1 to VILLAGE 3 | 4.5 KM |
VILLAGE 2 to VILLAGE 3 | 3.5 KM |
CITY Head Office to YHUB | 30 KM |
Number of Computers installed at various locations are as follows:
YTOWN | 100 |
VILLAGE 1 | 10 |
VILLAGE 2 | 15 |
VILLAGE 3 | 15 |
CITY OFFICE | 5 |
Note:
In Villages, there are community centers, in which one room has been given as training center to this organization to install computers. The organization has got financial support from the government and top IT companies.
(i) Suggest the most appropriate location of the SERVER in the YHUB (out of the 4 locations), to get the best and effective connectivity. Justify your answer.
(ii) Suggest the best wired medium and draw the cable layout (location to location) to efficiently connect various locations within the YHUB.
(iii) Which hardware device will you suggest to connect all the computers within each
location of YHUB?
(iv) Which service/protocol will be most helpful to conduct live interactions of Experts from Head Office and people at YHUB locations?