Total 20 Questions. Each Carry 2 Marks.
Total Time 40 Min.
Quiz Summary
0 of 20 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 20 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 32 Marks. Watch the practice videos and take the test again after ten days.
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- Current
- Review
- Answered
- Correct
- Incorrect
-
Question 1 of 20
1. Question
Q1) What is the output displayed by the below program?
def dictitems(dict1): try: dict2={} for key in dict1.keys(): dict2[key]=int(dict1[key])+key dict1[key]=dict2[key+1] except IndexError: print("index error occurred") except ValueError: print("value error occurred") finally: print("finally done") print("inside method") try: dictitems({1:1,2:31,3:33}) print("function call done") except KeyError: print("key error occurred") except: print("some error occurred") print("outside method")
CorrectIncorrect -
Question 2 of 20
2. Question
Q2) What will be the output displayed by the below program?
class vehicle: def __init__(self,registrationnumber): self.registrationnumber=registrationnumber def run(self): print("the vehicle is not running") def start(self): print("the vehicle has started") def stop(self): print("the vehicle has stopped") class fourwheeler(vehicle): def run(self): print("the four wheeler is running") super().run() def stop(self): super().stop() class car(fourwheeler): def __init__(self,registrationnumber,iscommercial): super().__init__(registrationnumber) self.iscommercial=iscommercial def run(self): print("the car is running") super().run() def start(self): print("the car started") if(self.iscommercial==True): super().run() else: super().start() ob=car(3111,True) ob.start()
CorrectIncorrect -
Question 3 of 20
3. Question
Q3) What is the output displayed by the below program?
def function(string,list1): num=1 while(num!=len(string)-1): if(len(string)%2==0 or string[num] in ('a','b','c')): list1.append(string[num-1]) num+=1 list1=function(string[num:],list1) break return list1 print(function("Analytically",[]))
CorrectIncorrect -
Question 4 of 20
4. Question
Q4) Choose a valid function call for the given code snippet?
def student(firstname,degree="B.E.",sem="sixth"): print(firstname + "is studying in " + sem + "studying" + degree)
CorrectIncorrect -
Question 5 of 20
5. Question
Q5) What will be the output displayed by the below code?
def function(inputlist): midposition=len(inputlist)//2 low=0 high=len(inputlist)-1 while(inputlist[midposition]<inputlist[low]): low=low+2 if(low<=high): temp=inputlist[low] inputlist[low]=inputlist[high] inputlist[high]=temp return inputlist list1=[39,45,22,51,62,12,6] sublist=function(list1[:5]) print(sublist)
CorrectIncorrect -
Question 6 of 20
6. Question
Q6) Consider the function given below.
def displayvalues(input1,input2): for i in range(0,len(input1)): if(input1[i]%input2==0): print(input1[i])
Which of the following function calls will execute the function displayvalues successfully?
CorrectIncorrect -
Question 7 of 20
7. Question
Q7) Consider inputqueue(Front to Rare) 4-3-1.
What will be the content of bookedqueue after executing the function ticketbooking?
The function ticketbooking take inputqueue as a parameter.Assumption: Class Queue and its methods available.
def ticketbooking(inputqueue): bookedqueue=Queue(10) bookedqueue.enqueue(0) while(not inputqueue.isempty()): booked=bookedqueue.dequeue() bookedqueue.enqueue(booked) for num in range(1,inputqueue.dequeue()): bookedqueue.enqueue(num) return bookedqueue
CorrectIncorrect -
Question 8 of 20
8. Question
Q8) Consider the following statements.
1) public attributes can only be accessed inside the class 2) In python prefixing the attribute with leading double underscores makes it private 3) private attributes can be accessed outside the class using getter methods 4) methods can not be made private
Which of the statements is True?
CorrectIncorrect -
Question 9 of 20
9. Question
Q9) consider the following linked list
list1(Head to Tail) 4–2–7
list2(Head to Tail) 5–8–9What will be the content of outqueue:(Front to Rear) after executing the function comparelist ?
The function take list1 and list2 as input parameters.def comparelist(list1,list2): temp1=list1.gethead()#gethead() return head node temp2=list2.gethead() temp=Stack(5) outqueue=Queue(10) while(temp1!=None and temp2!=None): if(temp1.getdata()<temp2.getdata()):#getdata(return data in node outqueue.enqueue(temp2.getdata()) temp1=temp1.getnext()#getnext() return the address of next node elif(temp1.getdata()>temp2.getdata()): temp.push(temp1.getdata()) temp2=temp2.getnext() while(not temp.isempty()): temp3=temp.pop() if (temp3%2)==0: outqueue.enqueue(temp3) return outqueue
Assumption: Stack, Queue, List classes available
CorrectIncorrect -
Question 10 of 20
10. Question
Q10) The below-given code results in a compilation error. which option is correct?
from abc import * class abstractone(ABC): var1=100 var2=200 def display(self): print("display method in abstract class") @abstractmethod def abstractmethod1(self): pass class concreteone(abstractone): def __init__(self): self.varthree=300 def display(self): print("this is display method in concrete") c=concreteone()
CorrectIncorrect -
Question 11 of 20
11. Question
Q11) Which design process is followed by the below program?
def search(listofelements,elementtobesearched): for i in range(len(listofelements)): if(listofelements[i]==elementtobesearched): return i return -1
CorrectIncorrect -
Question 12 of 20
12. Question
Q12) Which of the hash functions is best if the following elements 2,4,6,18,84, and 90 are to be stored in the hash table?
CorrectIncorrect -
Question 13 of 20
13. Question
Q13) Rajesh has written the below code and he found the accountbalance is accessed outside the Account class.
Help him to choose the correct option to prevent the access accountbalance outside.class Account: def __init__(self,accountname,accountbalance): self.accountname=accountname self.accountbalance=accountbalance
CorrectIncorrect -
Question 14 of 20
14. Question
Q14) What will be the output displayed by the below code?
class exam: def __init__(self,marks): self.marks=marks def identifyperformance(self): if self.marks>=92: return "tp" else: return "ap" class employee: def __init__(self,empname): self.empname=empname self.__salary=15000 def setempname(self, empname): self.empname=empname def computesalary(self): return self.__salary+500 class trainee(employee): def __init__(self,empname,exam): super().__init__(empname) self.__exam=exam def computesalary(self): salary=super().computesalary() if self.__exam.identifyperformance()=="tp": return salary+salary//10 else: return salary exam=exam(92) trainee=trainee("rajesh",exam) print(trainee.computesalary())
CorrectIncorrect -
-
Question 15 of 20
15. Question
Q15) consider the following bubble sort code given below. which sorts the given list in descending order.
def bubblesort(inputlist): num=len(inputlist) for i in range(num): for j in range(0,num-i-1): if inputlist[j]<inputlist[j+1]: temp=inputlist[j] inputlist[j]=inputlist[j+1] inputlist[j+1]=temp print(inputlist) inputlist=[2,1,6,3,7] bubblesort(inputlist)
The index position of element 3 after 2 iterations of bubble sort is?
CorrectIncorrect -
-
Question 16 of 20
16. Question
Q16) What will be the output displayed by the below program?
def findspecialprice(productpricelist): if (len(productpricelist)==2): return productpricelist[1] else: price=findspecialprice(productpricelist[1:]) if price-1 > productpricelist[0]: return price else: return productpricelist[0] productpricelist=[15,16,14,11,12] amount=findspecialprice(productpricelist) print(amount)
CorrectIncorrect -
-
Question 17 of 20
17. Question
Q17) How many reference variables and objects are present?
class car: counter=100 types=["SUV","HatchBack","coupe"] def __init__(self,model=None,doors=4): self.model=model self.doors=doors car1=car() car2=car() car3=car1 car1=car() car4=car2 car2=car1
CorrectIncorrect -
Question 18 of 20
18. Question
Q18) What will be the output displayed by the below program?
class square: def __init__(self,length): self.length=length def calculatearea(self): return self.lenth*self.length class rectangle(square): def __init__(self,length,breadth): super().__init__(length) self.__breadth=breadth def calculatearea(self): return self.length*self.__breadth def getbreadth(self): return self.__breadth class cuboid(rectangle): def __init__(self,length,breadth,height): super().__init__(length,breadth) self.__height=height def calculatesurfacearea(self): return 2*(super().calculatearea()+(self.getbreadth()*self.__height)+(self.length*self.__height)) box=cuboid(20,10,10) print("surface area : ",box.calculatesurfacearea()) print("area of one side : ",box.calculatearea())
CorrectIncorrect -
Question 19 of 20
19. Question
Q19) Consider the inputlinkedlist(Head to Tail): ‘1’–‘Test’–’32’–‘6’
what will be the content of inputlinkedlist from Head to Tail after executing the below function?The function below is taking inputlinkedlist and str1=’3′ as input parameters
Assumption: Linked list class with necessary methods are available
def mll(inputlinkedlist,str1): temp=inputlinkedlist.gethead() #gethead() returns the head node while(temp.getnext().getnext()!=None): #getnext() return next node address if str1 in temp.getnext().getdata(): #getdata() returns the data in node inputlinkedlist.add(temp.getdata()) #add will add the given input at the end of the list temp=temp.getnext() elif (temp.getdata().isdigit()): inputlinkedlist.add(temp.getdata()) temp=temp.getnext() return inputlinkedlist
CorrectIncorrect -
Question 20 of 20
20. Question
Q20) What will be the output displayed by the below program?
class invalidlengthexception(Exception): pass class mobile: def __init__(self,mobileno): self.__mobileno=mobileno def validatemobileno(self): try: if (len(self.__mobileno)!=10): raise invalidlengthexception else: print("valid mobile number") except invalidlengthexception: print("invalid length inside class") print("inside class") mob=mobile("97568") try: mob.validatemobileno() print("outside class") except invalidlengthexception: print("invalid length outside")
CorrectIncorrect