Total 15 Questions. Each Carry 2 Marks.
Total Time 30 Min.
Quiz Summary
0 of 15 Questions completed
Questions:
Information
You have already completed the quiz before. Hence you can not start it again.
Quiz is loading…
You must sign in or sign up to start the quiz.
You must first complete the following:
Results
Results
0 of 15 Questions answered correctly
Your time:
Time has elapsed
You have reached 0 of 0 point(s), (0)
Earned Point(s): 0 of 0, (0)
0 Essay(s) Pending (Possible Point(s): 0)
Categories
- Not categorized 0%
-
If you score less than 24 Marks. Watch the videos again and Take the test after ten days.
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- Current
- Review
- Answered
- Correct
- Incorrect
-
Question 1 of 15
1. Question
Q1) What is the output displayed by the below program?
class A: b=10 def __init__(self,b): self.b=b b=100 ob=A(20) print(ob.b)
CorrectIncorrect -
-
Question 2 of 15
2. Question
Q2) Given inputqueue front to rear: 3,7,6,2,5,6,3,2.
What will be the elements in outputqueue front to rear after executing the below function?def function(inputqueue): outputqueue=Queue(10) while(not inputqueue.isempty()): var=inputqueue.dequeue() if var<=5: outputqueue.enqueue(inputqueue.dequeue()+1) else: outputqueue.enqueue(outputqueue.dequeue()+inputqueue.dequeue()) return outputqueue
Assumption: Class Queue and its methods are available.
CorrectIncorrect -
Question 3 of 15
3. Question
Q3) Consider stack stack1 with the following elements top to bottom: 14,35,22,10,5,20.
What will be the content of stack2 top to bottom after executing the below function?
stack1 is given as a parameter to the function.def stackfunction(stack1): stack2=Stack(5) while(not stack1.isempty()): if(stack1.pop()%5==0): break else: if( not stack1.isempty()): stack2.push(stack1.pop()*2) if(stack2.isempty()): stack1.pop() else: stack2.push(10) return stack2
Assumption: Class Stack and its methods are available.
CorrectIncorrect -
Question 4 of 15
4. Question
Q4) What will be the output displayed by the below program?
class A: def __init__(self,num): self.__num=num def setnum(self,num): self.__num=num def getnum(self): return self.__num def m1(self,var): return self.__num+var class B: def __init__(self,aref): self.aref=aref self.num1=10 def m2(self,val): self.aref.setnum(self.num1+val) def m3(self): return self.aref.m1(3)+self.num1 oba=A(5) obb=B(oba) obb.m2(3) print(obb.m3())
CorrectIncorrect -
-
Question 5 of 15
5. Question
Q5) what would be the content of temp after executing the below function?
If the inputstack(bottom to top) : 1,4,9,16,25,49,81,100 is sent as parameter to function.Assumption: Class Stack with necessary methods available
import math def checkfunction(inputstack): temp=Stack(10) while(not (inputstack.isempty())): num=inputstack.pop() numsqrt=math.sqrt(num)#sqrt return square root of number if(numsqrt%2==0): temp.push(int(numsqrt)) else: val=temp.pop() temp.push(num+val) return temp
CorrectIncorrect -
Question 6 of 15
6. Question
Q6) What will be the output displayed after executing the below function?
def modifylist(inlist): templist=list(inlist) outlist=[] num=len(inlist) for i in inlist: if(i>=num): outlist.append(i) else: templist.remove(i) num-=1 outlist=outlist+templist return outlist inlist=[7,5,4,6,1,2] z=modifylist(inlist) print(z)
CorrectIncorrect -
Question 7 of 15
7. Question
Q7) What should be written in line1 to line4 to display Savings Account: 1001 6000.0 500.0?
class account: def __init__(self,accountnumber,amount): self.accountnumber=accountnumber self.amount=amount def displayaccountdetails(self): print(self.accountnumber," ",self.amount,end=" ") class savingsaccount(account): def __init__(self,accountnumber,amount,minimumbalance=0.0): #line1 self.minimumbalance=500.0 def displayaccountdetails(self): print("Savings Account : ",end ="") #line2 print(self.minimumbalance) a=account(1001,6000.0) #line3 #line4
CorrectIncorrect -
Question 8 of 15
8. Question
Q8) What will be the output displayed by the below program?
class Invalid_Id_Exception(Exception): pass class Invalid_Marks_Exception(Exception): pass class student: def __init__(self,sid,marks): self.__sid=sid self.__marks=marks def awardscolarship(self): try: if(not self.__sid.count("1")>2 or self.__sid.find("B")!=-1): raise Invalid_Id_Exception if(self.__marks<0): raise Invalid_Marks_Exception("Marks Entered is Invalid") print("student is awarded with scholarship") except Invalid_Id_Exception: print("student id is wrong inside method") except Invalid_Marks_Exception as e: print(e) print("inside method") try: s=student("B1110",-70) s.awardscolarship() print("inside main") except Invalid_Id_Exception: print("student id is wrong outside method") except: print("some error occurred")
CorrectIncorrect -
Question 9 of 15
9. Question
Q9) What are the elements present in list1 after executing the below program?
def function(string,list1): num=1 while(num!=len(string)): if(len(string)%2==0 or string[:-1].count('a')>=1): list1.append(string[num]) num+=1 list1=function(string[num:],list1) break return list1 print(function("Irradiation",[]))
CorrectIncorrect -
Question 10 of 15
10. Question
Q10) How many incorrect options are present? Options given below.
class shirt: def __init__(self): self.color="red" self.size="medium" s1=shirt() #line1 s2=s1 #line2 s1.color="yellow" #line3 s2.color="green" #line4 s2=shirt() #line5 s2.size="large" #line6
at the end of line two, both s1 and s2 refer to the same shirt object
at the end of line three, the color of s1 is yellow and the color of s2 is red
at the end of line five, there is no reference variable which points to the shirt object created at line one
at the end of line six, the shirt object created at line five will have a size largeCorrectIncorrect -
-
Question 11 of 15
11. Question
Q11) Consider the inputlinkedlist given. inputlinkedlist(Head to Tail): 7,2,4,1,10
What is the content of inputlinkedlist after executing the below function?
The function takes the head of inputlinkedlist as an input parameter.Assumptions: linked list class and methods are available
def calculatetotal(head): total=0 if(head==None): return temp=head.getnext()#getnext return next node address while(temp!=None and temp.getnext()!=None): if(temp.getdata()<temp.getnext().getdata()): #getdata return the data of the node total+=temp.getnext().getdata%temp.getdata() else: total+=temp.getdata() temp=temp.getnext() temp.setdata(total)#setdata will save the value in the data of the node
CorrectIncorrect -
Question 12 of 15
12. Question
Q12) What is the output displayed by the below program?
class child: nooftoffees=80 totaltoffeeseaten=2 def __init__(self,name): self.name=name child.addtoffee(len(self.name)) child.totaltoffeeseaten+=2 def eattoffee(self,num): child.nooftoffees-=num child.totaltoffeeseaten+=num @staticmethod def addtoffee(num): child.nooftoffees+=num//2 c1=child("Deepu") c2=child("Heman") c1.eattoffee(2) child.addtoffee(6) c1.addtoffee(3) c2.eattoffee(4) print(child.nooftoffees) print(child.totaltoffeeseaten)
CorrectIncorrect -
Question 13 of 15
13. Question
Q13) What is the output displayed by the below program?
def function(inputlist): mid=len(inputlist)//2 low=0 high=len(inputlist)-1 while(inputlist[mid]<inputlist[low]): low=low+1 if(low<high): temp=inputlist[low]+4 inputlist[low]=inputlist[high-2] inputlist[high-2]=temp return inputlist[:-2] list1=[36,22,11,38,70,8,20] sublist=function(list1[:-1]) print(sublist)
CorrectIncorrect -
Question 14 of 15
14. Question
Q14) Choose the statement which is correct to the below code.
def f1(arg1,*arg2): for num in arg2: if(arg1>num): return num def f2(arg3, arg4=10): if(arg3
CorrectIncorrect -
Question 15 of 15
15. Question
Q15) What is the output displayed by the below program?
class bus: def __init__(self,busfare): self.busfare=busfare self.__finalbusfare=0 def getfinalbusfare(self): return self.__finalbusfare def setfinalbusfare(self,busfare): self.__finalbusfare=busfare def calculatefinalbusfare(self,nooflanguages=0): self.__finalbusfare=self.busfare+nooflanguages*(self.busfare//3) class volvobus(bus): def __init__(self,busfare,additionaltax): super().__init__(busfare) self.additionaltax=additionaltax+5 def calculatefinalbusfare(self,nooflanguages=0): super().calculatefinalbusfare(nooflanguages) finalamount=self.getfinalbusfare()+self.additionaltax finalamount=finalamount-(finalamount*(4/100)) self.setfinalbusfare(finalamount) obj=volvobus(100,10) obj.calculatefinalbusfare(6) print("Fare : ",obj.getfinalbusfare())
CorrectIncorrect