top of page
Home: Blog2
Writer's pictureAnuj Yadav

OPA Solution for Unix, Python, MCQ 22-05-2020

Updated: Jun 4, 2020

UNIX Solution:(15 marks)

There was only one question. There were 20 minutes allocated for this section.




Solution:


read s
char=`echo "$s" | wc -c`
word=`echo "$s" | wc -w`
avg=`expr $char / $word`
echo $avg

Python Solution:(35 marks)

There was only one OOPs question. There were 50 minutes allocated for this section.








Solution:


class D:
	def __init__(self,did,dn,s,cf):
		self.did=did
		self.dn=dn
		self.s=s
		self.cf=cf
class H:
	def __init__(self,dd):
		self.dd=dd
	def s(self,n):
		l=[]
		for i in self.dd:
			if self.dd[i].dn==n:
				l.append(self.dd[i])
		return l
	def c(self,sp):
		s=0
		for i in self.dd:
			if self.dd[i].s==sp:
				s=s+self.dd[i].cf
                return s
n=int(input())
d=dict()
for i in range(n):
	did=int(input())
	dn=input()
	s=input()
	cf=int(input())
	o=D(did,dn,s,cf)
	d[i]=o
# print(d)
n=input()
sp=input()
h=H(d)
l=h.s(n)
if len(l)==0:
	print("No Doctor Exits with the given DoctorName")
else:
	for i in l:
		print(i.did)
		print(i.dn)
		print(i.s)
		print(i.cf)
r=h.c(sp)
if r==0:
	print("No Doctor with the given specialization",end="")
else:
	print(r,end="")

MCQ SOLUTION:(50 marks)

NOTE: My score was 31/50, So every answer is not correct. I will update the answers shortly.

There was 50 MCQs and time was 50 minutes.



1.


2.


3.


4.


5.


6.


7.


8.


9.


10.


11.


12.


13.


14.


15.


16.


17.


18.


19.


20.


21.


22.


23.


24.


25.


27.


28.


29.


30.


31.


32.



33.


34.


35.

36.


37.


38.


39.




40.


41.


42.


43.


44.


45.


46.


47.


48.


49.


50.

28 views0 comments

Recent Posts

See All

Comments


Home: Subscribe

CONTACT

 Kanpur, India

8299229032

  • twitter

Thanks for submitting!

Home: Contact
bottom of page