



Name the function/method required to
(i) check if a string contains only alphabets
(ii) give the total length of the list.
Rewrite the following code in python after removing all syntax error(s). Underline each correction done in the code.
def Sum(Count) #Method to find sum S=0 for I in Range(1,Count+1): S+=I RETURN S print Sum[2] #Function Call print Sum[5]
Find and write the output of the following python code :
for Name in ['John','Garima','Seema','Karan']: print Name if Name[0]== 'S': break else : print 'Completed!' print 'Weldone!'
Find and write the output of the following python code:
class Emp: def __init__(self,code,nm): #constructor self.Code=code self.Name=nm def Manip (self) : self.Code=self.Code+10 self.Name='Karan' def Show(self,line): print self.Code,self.Name,line s=Emp(25,'Mamta') s.Show(1) s.Manip() s.Show(2) print s.Code+len(s.Name)
What are the possible outcome(s) executed from the following code? Also specify the maximum and minimum values that can be assigned to variable COUNT.
TEXT="CBSEONLINE" COUNT=random.randint(0,3) C=9 while TEXT[C]!='L': print TEXT[C]+TEXT[COUNT]+'*', COUNT=COUNT+1 C=C1 (i) (ii) (iii) (iv) EC*NB*IS* NS*IE*LO* ES*NE*IO* LE*NO*ON*
What will be the output of the following python code ? Explain the try and except used in the code.
A=0 B=6 print 'One' try: print 'Two' X=B/A Print 'Three' except ZeroDivisionError: print B*2 print 'Four' except: print B*3 print 'Five'
Write a class PHOTO in Python with following specifications:
Instance Attributes
-Pno # Numeric value -Category # String value -Exhibit # Exhibition Gallery with String value Methods: -FixExhibit() # A method to assign Exhibition # Gallery as per Category as # shown in the following table
Category | Exhibit |
Antique | Zaveri |
Modern | Johnsen |
Classic | Terenida |
Register() # A function to allow user # to enter values of Pno, Category # and call FixExhibit() method ViewAll{) # A function to display all the data # members
What is operator overloading with methods? Illustrate with the help of an example using a python code.
Write a method in python to display the elements of list twice, if
it is a number and display the element terminated with ‘*’ if it is
not a number.
For example, if the content of list is as follows :
MyList=[‘RAMAN’,’21’,’YOGRAJ’, ‘3’, ‘TARA’]
The output should be
RAMAN*
2121
YOGRAJ*
33
TARA*
What will be the status of the following list after fourth pass of bubble sort and fourth pass of selection sort used for arranging the following elements in descending order ?
34,6,12,3,45,25
Write a method in python to search for a value in a given list (assuming that the elements in list are in ascending order) with the help of Binary Search method. The method should return -1, if the value not present else it should return position of the value present in the list.
Write PUSH (Names) and POP (Names) methods in python to add Names and Remove names considering them to act as Push and Pop operations of Stack.
Write a method in python to find and display the composite 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.
34,23,+,4,5,*,-
Differentiate between the following:
(i) f = open (‘diary. txt’, ‘a’)
(ii) f = open (‘diary. txt’, ‘w’)
Write a method in python to read the content from a text file story.txt line by line and display the same on screen.
Consider the following definition of class Student. Write a method in python to write the content in a pickled file student.dat
class Student: def_init_(self,A,N} : self.Admno=A self.Name=N def Show(self}: print (self.Admno, "#" , self.Name}
Observe the following table carefully and write the names of the most appropriate columns, which can be considered as (i) candidate keys and (ii) primary key.
Code | Item | Qty | Price | Transaction Date |
---|---|---|---|---|
1001 | Plastic Folder 14” | 100 | 3400 | 2014-12-14 |
1004 | Pen Stand Standard | 200 | 4500 | 2015‐01‐31 |
1005 | Stapler Mini | 250 | 1200 | 2015-02-28 |
1009 | Punching Machine Small | 200 | 1400 | 2015-03-12 |
1003 | Stapler Big | 100 | 1500 | 2015-02-02 |
Consider the following DEPT and EMPLOYEE tables. Write SQL queries for (i) to (iv) and find outputs for SQL queries (v) to (viii).
Table: DEPT
DCODE | DEPARTMENT | LOCATION |
---|---|---|
D01 | INFRASTRUCTURE | DELHI |
D02 | MARKETING | DELHI |
D03 | MEDIA | MUMBAI |
D05 | FINANCE | KOLKATA |
D04 | HUMAN RESOURCE | MUMBAI |
Table: EMPLOYEE
ENO | NAME | DOJ | DOB | GENDER | DCODE |
---|---|---|---|---|---|
1001 | George K | 2013-09-02 | 1991-09-01 | MALE | D01 |
1002 | Ryma Sen | 2012-12-11 | 1990-12-15 | FEMALE | D03 |
1003 | Mohitesh | 2013-02-03 | 1987-09-04 | MALE | D05 |
1007 | Anil Jha | 2014-01-17 | 1984-10-19 | MALE | D04 |
1004 | Manila Sahai | 2012-12-09 | 1986-11-14 | FEMALE | D01 |
1005 | R SAHAY | 2013-11-18 | 1987-03-31 | MALE | D02 |
1006 | Jaya Priya | 2014-06-09 | 1985-06-23 | FEMALE | D05 |
Note: DOJ refers to date of joining and DOB refers to date of Birth of employees.
(i) To display Eno, Name, Gender from the table EMPLOYEE in ascending order of Eno.
(ii) To display the Name of all the MALE employees from the table EMPLOYEE.
(iii) To display the Eno and Name of those employees from the table EMPLOYEE w ho are born between ‘1987-01-01’ and ‘1991-12-01’.
(iv) To count and display FEMALE employees who have joined after ‘1986-01-01’.
(v) SELECT COUNT(*),DCODE FROM EMPLOYEE GROUP BY DCODE HAVING COUNT(*)>1;
(vi) SELECT DISTINCT DEPARTMENT FROM DEPT;
(vii) SELECT NAME, DEPARTMENT FROM EMPLOYEE E, DEPT D WHERE E.DCODE=D.DCODE AND EN0<1003;
(viii) SELECT MAX(DOJ), MIN(DOB) FROM EMPLOYEE;
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 | 1 |
0 | 0 | 1 | 0 |
0 | 1 | 0 | 0 |
0 | 1 | 1 | 1 |
1 | 0 | 0 | 1 |
1 | 0 | 1 | 0 |
1 | 1 | 0 | 0 |
1 | 1 | 1 | 1 |
Reduce the following Boolean Expression to its simplest form using K-Map :
F(X,Y,Z,W) = ∑(0,1,4,5,6,7,8,9,11,15)
Out of the following, which is the fastest (i) wired and (ii) wireless medium of communication?
Infrared, Coaxial Cable, Ethernet Cable, Microwave, Optical Fiber
Out of the following, which all comes under cyber crime?
(i) Stealing away a brand new hard disk from a showroom.
(ii) Getting in someone’s social networking account without his consent and posting on his behalf.
(iii) Secretly copying data from server of a organization and selling it to the other organization.
(iv) Looking at online activities of a friends blog.
Xcelencia Edu Services Ltd. is an educational organization. It is planning to set up its India campus at Hyderabad with its head office at Delhi. The Hyderabad campus has 4 main buildings -
ADMIN, SCIENCE, BUSINESS and MEDIA.
You as a network expert have to suggest the best network related solutions for their problems raised in (i) to (iv), keeping in mind the distances between the buildings and other given parameters.
Shortest Distances between various buildings:
ADMIN to SCIENCE | 65M |
ADMIN to BUSINESS | 100M |
ADMIN to ARTS | 60M |
SCIENCE to BUSINESS | 75M |
SCIENCE to ARTS | 60M |
BUSINESS to ARTS | 50M |
DELHI Head Office to HYDERABAD Campus | 1600KM |
Number of Computers installed at various building are as follows:
ADMIN | 100 |
SCIENCE | 85 |
BUSINESS | 40 |
ARTS | 12 |
DELHI Head Office | 20 |
(i) Suggest the most appropriate location of the server inside the HYDERABAD campus (out of the 4 buildings), to get the best connectivity for maximum no. of computers. Justify your
answer.
(ii) Suggest and draw the cable layout to efficiently connect various buildings ‘within the HYDERABAD campus for connecting the computers.
(iii) Which hardware device will you suggest to be procured by the company to be installed to protect and control the intemet uses within the campus?
(iv) Which of the following will you suggest to establish the online face]to]face communication between the people in the Admin Office of HYDERABAD campus and DELHI Head Office?
(a) E]mail (b) Text Chat (c) Video Conferencing (d) Cable TV