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%
-
Less Than 24 Marks. Please Watch the concepts. Take The Test Again 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 oop concepts are followed in the below program?
class A: __b=10 def __init__(self,var): self.__var=var def m1(self): print(self.__var+self.__var) class B(A): def m2(self): print("hello") ob=B(10) ob.m1()
CorrectIncorrect -
Question 2 of 15
2. Question
Q2) What will be the output displayed by the below program?
class product: marketprice=None def initialize(self,marketprice): product.marketprice=marketprice class electronicproduct(product): marketprice=None def initialize(self,marketprice): electronicproduct.marketprice=marketprice class mobilephone(electronicproduct): def initialize(self,marketprice): electronicproduct.marketprice=marketprice prod=product() prod.initialize(12) eprod=electronicproduct() eprod.initialize(14) print(prod.marketprice) print(eprod.marketprice) eprod=prod print(eprod.marketprice)
CorrectIncorrect -
Question 3 of 15
3. Question
Q3) what will be the value returned by the function given below?
if a queue of integers is passed as parameter.Assumption: Queue class with the methods required are available
def checkqueue(inputqueue): tempqueue1=Queue(inputqueue.getmaxsize()) value=inputqueue.dequeue() tempqueue1.enqueue(value) while(not inputqueue.isempty()): var1=inputqueue.dequeue() if var1>value: value=var1 tempqueue1.enqueue(var1) tempqueue2=Queue(inputqueue.getmaxsize()) while(not tempqueue1.isempty()): var2=tempqueue1.dequeue() if(var2!=value): tempqueue2.enqueue(var2) value=tempqueue2.dequeue() while(not tempqueue2.isempty()): var3=tempqueue2.dequeue() if var3>value: value=var3 return value
CorrectIncorrect -
Question 4 of 15
4. Question
Q4) Consider a stack instack(Top to Bottom):4,3,10,8,6.
What will be the content of outstack top to bottom after executing the below function?instack is sent as the input parameter to the function given below
def function(instack): if instack.isempty(): return outstack=Stack(instack.getmaxsize()) value=1 while(not instack.isempty()): outstack.push((instack.pop()*value)-1) value+=1 if(outstack.pop()//value)<=value: outstack.push(outstack.pop()*outstack.pop()) return outstack
Assumption: Stack class and methods available
CorrectIncorrect -
Question 5 of 15
5. Question
Q5) what modifications should be done to the below program to run successfully?
from abc import ABCMeta, abstractmethod class A(metaclass=ABCMeta): def __init__(self,var1): self.var1=var1 @abstractmethod def show(self): pass @abstractmethod def display(self): pass class B(A): def __init__(self,var1,var2): super().__init__(var1) self.var2=var2 def display(self): print(self.var2) def show(self): pass ob=B(10,12) ob.show() ob.display()
CorrectIncorrectHint
metaclass= ABCMeta works similar to inheriting ABC
-
Question 6 of 15
6. Question
Q6) What will be the output displayed by the below program?
class parent: def __init__(self,num1,num2): self.num1=num1 self.num2=num2 def f1(self,num1): return self.num1+num1//2 class child(parent): def f2(self,num2): self.num2=num2+10 return self.f1(self.num2) class grandchild(child): def __init__(self,num1,num2): super().__init__(num1,num2) self.__num3=None def f2(self): self.__num3=super().f2(self.num1)+self.f1(self.num2) return super().f2(self.__num3) gc=grandchild(20,10) print(gc.f2())
CorrectIncorrect -
-
Question 7 of 15
7. Question
Q7) How many static variables, local variables, instance variables are there in the below code?
class sampleclass: __val1=20 val2=10 def __init__(self,num1): self.num1=num1 self.num2=0 def func(self,num2,num3): self.num2=num3+10 return self.num2 s1=sampleclass(4) s2=sampleclass(5)
CorrectIncorrect -
Question 8 of 15
8. Question
Q8) What will be the output displayed by the below program?
class bank: def __init__(self,branch,customerlist): self.branch=branch self.__customerlist=customerlist def getcustomerlist(self): return self.__customerlist def display(self,name,pin): for customer in self.__customerlist: if customer.getcustomername().lower()==name.lower(): print(customer.getcustomername(),customer.getaccount().getaccounttype()) class customer: def __init__(self,customername,account): self.__customername=customername self.__account=account def getcustomername(self): return self.__customername def getaccount(self): return self.__account class account: def __init__(self,accountno,accounttype,minimumbalance=5000): self.__accountno=accountno self.__accounttype=accounttype self.minimumbalance=minimumbalance def getaccountno(self): return self.__accountno def getaccounttype(self): return self.__accounttype a1=account(5698892,"joint",10000) a2=account(56947576,"savings") c1=customer("rajesh",a1) c2=customer("harish",a2) b1=bank("bombay",[c1,c2]) b1.display("HArisH",234)
CorrectIncorrect -
Question 9 of 15
9. Question
Q9) What will be the elements present in queue m1 and m2 after executing the below program?
Assumption: Queue class is providedm1=Queue(3) m2=Queue(3) for i in range(0,3): m1.enqueue(i**2) for i in range(0,3): if(i==2): break m2.enqueue(m1.dequeue()) m2.enqueue(6)
CorrectIncorrect -
Question 10 of 15
10. Question
Q10) What will be the output displayed by the below program?
def f(n): if n<1: return 1 elif n%2!=0: return f(n-1) else: return n*f(n-2) z=f(6) print(z)
CorrectIncorrect -
-
Question 11 of 15
11. Question
Q11) How many times * is displayed by the below program?
n1=5 n2=4 while(n2>=1): print("*") for i in range(1,n1+1): print("*") n2-=1 print("*")
CorrectIncorrect -
Question 12 of 15
12. Question
Q12) What will be the output displayed by the below program?
def function(v1, v2, v3): if(v1<=v2): if(v3>=v2): if(v1+v2>=v3): print(1) else: print(2) else: if(v1+v3>v2): print(8) else: print(6) function(150,1500,3500)
CorrectIncorrect -
-
Question 13 of 15
13. Question
Q13) what will be the line1 line2 and line3 statements to display the output 204 for the below function?
class A: _var=20 def _init_(self) : self._var = 10 def m1(self) : #Line1 @staticmethod def m2( ) : #Line2 obj=A( ) obj.m1( ) #Line3 print(A._var)
CorrectIncorrect -
Question 14 of 15
14. Question
Q14) What modification to be done in the program to work on elements in descending order?
def binarysearch(numlist,element): low=0 high=len(numlist)-1 mid=(low+high)//2 #line4 while(numlist[mid]!=element and low
numlist[mid]): #line6 low=mid+1 else: high=mid-1 mid=(low+high)//2 if(element==numlist[mid]): print("element at index position",mid) else: print("element not found") CorrectIncorrect -
Question 15 of 15
15. Question
Q15) What will be the output displayed by the below program?
class employee: __counter=100 def __init__(self,name): self.name=name employee.__counter+=1 self.id=employee.__counter @staticmethod def getcounter(): return employee.__counter e1=employee("hi") e2=employee("bye") e3=employee("hello") print(employee.getcounter()-100)
CorrectIncorrect