Selection Control
Selection Control
num1=100
num2=200
num3=6
if(5>=num3):
if(num1>100 or num2>150):
print ("1")
print("2")
else:
print ("3")
A.1
B.2
C.3
2.What should be the value of num1 and num2 to get the output as "1"?
print("1")
elif((num1-num2)<=1 or (num1%num2)==0):
print("2")
else:
print ("3")
A.num1=11, num2=2
B.num1=0, num2=5
C.num1=5, num2=1
D.num1=-10,num2=2
Code 1:
if(value1=="ABC"):
if(value2=="A"):
value4=10
else:
value4=8
elif(value1=="XYZ"):
if(value2=="A"):
value4=8
else:
value4=6
print(value4)
Code 2:
if(value2=="A"):
value4=10
else:
value4=8
if(value2=="A"):
value4=8
else:
value4=6
print(value4)
Code 3:
if(value2=="A"):
value4=10
else:
value4=8
if(value2=="A"):
value4=8
else:
value4=6
print(value4)
A. Code1& 2
B. Code 2&3
C. Code3&1
D. None
a = -10
b = -200
C=2000
d = 4000
if(d%c!=0):
print(11)
else:
print(22)
else:
if(b/a >0):
if(a<b or d%c!=0):
print(33)
else:
print(44)
1.11
2.22
3.44
4.33
else:
scholarship=0
A. 79, 87, 91, 99
B. 78, 80, 92, 99
C. 74, 77, 90, 100
D. 74, 75, 76, 84, 85, 86, 94, 95, 96, 97
6.What will be the output of the following Python code snippet?
def func (var1, var2, var3):
if(var1<=var2):
if(var3>-var2):
if(var1+var2>-var3):
print(-1)
else:
print(-2)
else:
if(var1+var3>var2):
print (-3)
else:
print (-4)
func(156,2100,9500)
A. -2
B. -3
C. -4
D. -1
low=0
high=len(num_list)-1-
mid=(low+high)//2
if(element>num_list[mid]):-
low=mid+1
else:
high=mid-1
mid=(low+high)//2
if(element == num_list[mid]):
print Element is in the list at index", mid)
else:
Identify the most efficient test data set for testing the below code using Logic Coverage' technique.
if item type-"Fashion":
amount-amount-0.1* amount
amount-amount-0.15*amount
else:
if amount>2000:
amount-amount-0.07*amount
A. item type: "Fashion" with amount as 100, "Electronics" with amount as 2001
B. item type: "Fashion" with amount as 700, "Electronics" with amount as 7000, Sports" with amount as-
1500
C. item type: "Fashion" with amount as 800, "Electronics" with amount as 14999, "Sports" with amount
as 2300
D. Item type: "Fashion" with amount as 760, "Electronics" with amount as 5030, "Lifestyle" with amount
as 230
9.Consider the following Python code that depicts BINARY SEARCH algorithm for the list of elements
sorted in ASCENDING ORDER
low=0
high=len(num_list)-1
mid3(low+high)//2
if(element>num_list[mid]):
low=mid+1
else:
high=mid-1
mid%=(low+high)//2
if(element == num_list[mid]):
else:
3,6,7,9,15,20
A. 3
B. 4
C. 2
D. 5
10.Consider the below code written by Peter. He wants to test his code using "Logic Coverage"
technique.
years old =6
if (motorcycle_type =="Bike") :
mileage=45
mileage=40
else:
mileage= 25
mileage=35
else:
mileage=20