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
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
Name the Python Library modules which need to be imported to invoke the
following functions
(i) load()
(ii) pow()
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)
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()
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()
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 |
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?
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)
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.
What will be the status of the following list after the First, Second and Third pass of the insertion sort method used for arranging the following elements in descending order?
22, 24, 64, 34, 80, 43
Note: Show the status of all the elements after each pass very clearly underlining the changes.
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(Place) and Delete(Place) methods in python to add Place and Remove Place 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.
22,11,/,14,10,-,+,5,-
Write a statement in Python to perform the following operations:
Write a method in python to write multiple line of text contents into a text file myfile.txt line.
Consider the following definition of class Staff, write a method in python to search and display the content in a pickled file staff.dat, where Staffcode is matching with ‘S0105’.
class Staff: def __init__(self,S,SNM): self.Staffcode=S self.Name=SNM def Show(self): print(self.Staffcode," ", self.Name)
Observe the following STUDENTS and EVENTS tables carefully and write the name of the RDBMS operation which will be used to produce the output as shown in LIST ? Also, find the Degree and Cardinality of the LIST.
STUDENTS
NO | NAME |
---|---|
1 | Tara Mani |
2 | Jaya Sarkar |
3 | Tarini Trikha |
EVENTS
EVENTCODE | EVENTNAME |
---|---|
1002 | Programming |
1002 | IT Quiz |
LIST
NO | NAME | EVENTCODE | EVENTNAME |
---|---|---|---|
1 | Tara Mani | 1001 | Programming |
1 | Tara Mani | 1002 | IT Quiz |
2 | Jaya Sarkar | 1001 | Programming |
2 | Jaya Sarkar | 1002 | IT Quiz |
3 | Tarini Trikha | 1001 | Programming |
3 | Tarini Trikha | 1002 | IT Quiz |
Write SQL queries for (i) to (iv) and find outputs for SQL queries (v) to (viii), which are based on the tables
Table: VEHICLE
CODE | VTYPE | PERKM |
---|---|---|
101 | VOLVO BUS | 160 |
102 | AC DELUXE BUS | 150 |
103 | ORDINARY BUS | 90 |
105 | SUV | 40 |
104 | CAR | 20 |
Note:
– PERKM is Freight Charges per kilometer
– VTYPE is Vehicle Type
Table: TRAVEL
NO | NAME | TDATE | KM | CODE | NOP |
---|---|---|---|---|---|
101 | Janish Kin | 2015-11-13 | 200 | 101 | 32 |
103 | Vedika Sahai | 2016-04-21 | 100 | 103 | 45 |
105 | Tarun Ram | 2016-03-23 | 250 | 102 | 42 |
102 | John Fen | 2016-02-13 | 90 | 102 | 40 |
107 | Ahmed Khan | 2015-01-10 | 75 | 104 | 2 |
104 | Raveen | 2016-05-28 | 80 | 105 | 4 |
106 | Kripal Anya | 2016-02-06 | 200 | 101 | 25 |
Note:
– NO is Traveller Number
- KM is Kilometer travelled
– NOP is number of travellers travelled in vehicle
- TDATE is Travel Date
(i) To display NO, NAME, TDATE from the table TRAVEL in descending order of NO.
(ii) To display the NAME of all the travellers from the table TRAVEL who are traveling by vehicle with code 101 or 102.
(iii) To display the NO and NAME of those travellers from the table TRAVEL who
travelled between ’2015-12-31′ and ’2015-04-01’.
(iv) To display all the details from table TRAVEL for the travellers, who have
travelled distance more than 100 KM in ascending order of NOP.
(v) SELECT COUNT(*),CODE FROM TRAVEL
GROUP BY CODE HAVING COUNT(*)>1;
(vi) SELECT DISTINCT CODE FROM TRAVEL;
(vii) SELECT A.CODE,NAME,VTYPE
FROM TRAVEL A,VEHICLE B
WHERE A.CODE=B.CODE AND KM<90;
(viii) SELECT NAME,KM*PERKM
FROM TRAVEL A,VEHICLE B
WHERE A.CODE=B.CODE AND A.CODE=’105’;
Verify the following using Boolean Laws.
A’+ B’.C = A’.B’.C’+ A’.B.C’+ A’.B.C + A’.B’.C+ A.B’.C
Derive a Canonical POS expression for a Boolean function F, represented by the following truth table:
P | Q | R | F(P,Q,R |
---|---|---|---|
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 |
Reduce the following Boolean Expression to its simplest form using K-Map:
F(X,Y,Z,W)= (2,6,7,8,9,10,11,13,14,15)
Which protocol helps us to browse through web pages using internet browsers? Name any one internet browser.
Write two advantages of 4G over 3G Mobile Telecommunication Technologies in terms of speed and services?
Categories the following under Client side and Server Side script category?
(i) VB Sript
(ii) ASP
(iii) JSP
(iv) Java Script
Uplifting Skills Hub India is a knowledge and skill community which has an aim to uplift the standard of knowledge and skills 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 B_TOWN | 2 KM |
VILLAGE 2 to B_TOWN | 1.0 KM |
VILLAGE 3 to B_TOWN | 1.5 KM |
VILLAGE 1 to VILLAGE 2 | 3.5 KM |
VILLAGE 1 to VILLAGE 3 | 4.5 KM |
VILLAGE 2 to VILLAGE 3 | 2.5 KM |
A_CITY Head Office to B_HUB | 25 Km |
Number of Computers installed at various locations are as follows:
B_TOWN | 120 |
VILLAGE 1 | 15 |
VILLAGE 2 | 10 |
VILLAGE 3 | 15 |
A_CITY OFFICE | 6 |
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 B_HUB (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 B_HUB.
(iii) Which hardware device will you suggest to connect all the computers within each location of B_HUB?
(iv) Which service/protocol will be most helpful to conduct live interactions of Experts from Head Office and people at all locations of B_HUB?