A binary file “emp.dat” has structure [EID, Ename, designation, salary].
Share
Related Questions
- UGCNET-Oct2020-II: 24
- Consider the instance of the CUSTOMER and BRANCH relations shown in the following table.
- Mr. Santhosh purchased a movie DVD and he takes several copies without permission. He is a.........
- π(pi) Greek letter is used to denote ........ operation in relational algebra.
- % is a ........ operator
- Who proposed the idea of www.
- State True/False 1. Multiplication, division, modulus have equal priority 2. Logical and (&&) has less priority than logical or ()
- GATE 1998
- Consider the following C = A + B. Here A and B are called .......
- Declare a two dimensional array to store the elements of a matrix with order 3 × 5.
- The address of a variable is called......
- Identify the invalid literals from the following and write reason for each:
- Predict the output of the following code snippet.
- Mr. Dixon declared a variable as follows int 9age. Is it a valid identifier.
- Pick the odd one out from the following. Give reason. 1. for, while, do….while 2. if, switch, for
- Do samples provide better results than surveys? Give reasons for your answer.
- Jeena uses algorithm to represent a problem while Neena uses flowchart which is better? Justify your answer?
- The following are the phases in programming. The order is wrong rearrange them in correct order.
- Online railway reservation is an example of ....
- UGC NET July 2018 Q22
(i)
import pickle
def CreateEmp():
f1=open("emp.dat",'wb')
eid=input("Enter E. Id")
ename=input("Enter Name")
designation=input("Enter Designation")
salary=int(input("Enter Salary"))
l=[eid,ename,designation,salary]
pickle.dump(l,f1)
f1.close()
(ii)
import pickle
def display():
f2=open("emp.dat","rb")
try:
while True:
rec=pickle.load(f2)
if rec[3]>5000:
print(rec[0],rec[1],rec[2],rec[3])
except:
f2.close()