top of page
Home: Blog2

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.


ree

ree

ree

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.


ree

ree

ree

ree

ree

ree

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.



ree

1.


ree

2.


ree

3.


ree

4.


ree

5.


ree

6.


ree

7.


ree

8.


ree

9.


ree

10.


ree

11.


ree

12.


ree

13.


ree

14.


ree

15.


ree

16.


ree

17.


ree

18.


ree

19.


ree

20.


ree

21.


ree

22.


ree

23.


ree

24.


ree

25.


ree

27.


ree

28.


ree

29.


ree

30.


ree

31.


ree

32.


ree

ree

33.


ree

34.


ree

35.

ree

36.


ree

37.


ree

38.


ree

39.


ree

ree

ree

40.


ree

41.


ree

42.


ree

43.


ree

44.


ree

45.


ree

46.


ree

47.


ree

48.


ree

49.


ree

50.

Comments


Home: Subscribe

CONTACT

 Kanpur, India

8299229032

  • twitter

Thanks for submitting!

Home: Contact

8299229032

  • twitter

©2020 by Flash851. Proudly created with Wix.com

bottom of page