Questions
ayuda
option
My Daypo

ERASED TEST, YOU MAY BE INTERESTED ONpython basic 3

COMMENTS STATISTICS RECORDS
TAKE THE TEST
Title of test:
python basic 3

Description:
python basic part 3

Author:
AVATAR
smart tech junior
(Other tests from this author)


Creation Date:
21/04/2021

Category:
Others

Number of questions: 25
Share the Test:
Facebook
Twitter
Whatsapp
Share the Test:
Facebook
Twitter
Whatsapp
Last comments
No comments about this test.
Content:
We are developing an online shopping application. Consider the code d =input('Enter day of the week:') discount_percentage = 3 if d== 'Monday': discount_percentage+=5 elif d== 'Tuesday': discount_percentage+=7 elif d== 'Saturday': discount_percentage+=10 elif d== 'Sunday': discount_percentage+=20 else: discount_percentage+=2 To get 5 as discount_percentage, which of the following input should be provided end-user? Monday Tuesday Thursday Saturday Sunday.
We are developing a gold loan application for the XYZ company. amount=float(input('Enter Loan Amount:')) interest_rate=0 if amount > 0 and amount<= 50000: interest_rate = 10 elif amount > 50000 and amount<100000: interest_rate = 12 elif amount >= 100000 and amount<150000: interest_rate = 16 else: interest_rate = 22 For which of the following user input interest_rate will be 12. 50000 50001 100000 100001 150000.
We are developing an application for leave approval in XYZ Company. days=int(input('Enter number of days for leave:')) cause=input('Enter the cause:') if days==1: print('Leave will be approved immediately') elif days>1 and days<=3: if cause=='Sick': print('Leave will be approved immediately') else: print('Needs Lead Approval') elif days>3 and days<5: if cause=='Sick': print('Needs Manager Approval') else: print('Needs Director Approval') elif days>=5 and days<=10: print('Needs Director Approval') In which of the following cases, 'Needs Director Approval' will be printed to the console? days = 2 and cause='Sick' days = 3 and cause='Personal' days = 4 and cause='Sick' days = 4 and cause='Official' .
Consider the following code: marks=[30,40,50,45,50,100] average=sum(marks)//len(marks) grades={1:'A',2:'B',3:'C',4:'D'} if average>=90 and average<=100: key=1 elif average>=80 and average<90: key=2 elif average>=50 and average<80: key=3 else: key=4 print(grades[key]) Which grade will be printed to the console? A B C D.
Consider the code: a=12 b=4 s='He shall not be happy if he does not work' In which of the following cases result value will become 9 result=3 if None else a/b result=s.find('not') if s else None result=s.rfind('not') if s else None result=5 if len(s)>4 else 6.
We are developing loan collection agent application. Consider the code: collected_amount=3000 commission=0 if collected_amount <= 2000: commission=50 elif collected_amount> 2500 and collected_amount<3000: commission=100 elif collected_amount>2500: commission=150 if collected_amount>=3000: commission+=200 What will be the value of commission? 350 200 150 100.
You are developing an online shopping application. Consider the code: order_value=1500 state='ap' delivery_charge=0 if state in ['up','mp','ts']: if order_value<=1000: delivery_charge=50 elif order_value>1000 and order_value<2000: delivery_charge=100 else: delivery_charge=150 else: delivery_charge=25 if state in ['lp','kp','ap']: if order_value>1000: delivery_charge+=20 if order_value<2000 and state in ['kp','ap']: delivery_charge+=30 else: delivery_charge+=15 print(delivery_charge) What is the result? 65 85 75 55.
Consider the code: l=[10,20,[30,40],[50,60]] count=0 for i in range(len(l)): if type(l[i])==list: count=count+1 print(count) What is the result? 1 2 3 4.
Consider the code: l=[10,(20,),{30},{},{},[40,50]] count=0 for i in range(len(l)): if type(l[i])==list: count+=1 elif type(l[i])==tuple: count+=2 elif type(l[i])==set: count+=3 elif type(l[i])==dict: count+=4 else: count+=5 print(count) What is the result? 17 18 19 20.
Consider the code: t = (2,4,6,8,10,12) d = {1:'A',2:'B',3:'C',4:'D',5:'E',6:'F'} result=1 for t1 in t: if t1 in d: result+=t1 print(result) What is the result? 12 13 19 6.
Consider the code: t = (2,4,6,8,10,12) d = {1:'A',2:'B',3:'C',4:'D',5:'E',6:'F'} result=1 for t1 in t: if t1 in d: continue else: result+=t1 print(result) What is the result? 29 30 31 32.
Consider the code: values = [[3, 4, 5, 1], [33, 6, 1, 2]] v = values[0][0] for lst in values: for element in lst: if v > element: v = element print(v) What is the result? 3 2 1 4.
Consider the code def get_names(): names=['Sunny','Bunny','Chinny','Vinny','Pinny'] return names[2:] def update_names(elements): new_names=[] for name in elements: new_names.append(name[:3].upper()) return new_names print(update_names(get_names())) What is the result? ['CHI', 'VIN', 'PIN'] ['VIN', 'PIN'] ['CH', 'VI', 'PI'] ['SU', 'BU'].
Consider the following code def my_list(x): lst.append(a) return lst my_list('chicken') my_list('mutton') print(my_list('fish')) to print the following to the console ['chicken','mutton','fish'] x should be replaced with a,lst=[] a,lst=() a,lst={} a,lst=None.
Consider the following code: def f1(x=0,y=0): return x+y Which of the following method calls are not valid? Options are : f1() (Correct) f1('10','20') (Correct) f1(10) (Correct) f1('10') f1() f1('10','20') f1(10) f1('10').
Consider the following code: def f1(x=0,y=0): return x*y Which of the following method calls are not valid? f1() f1('10','20') f1(10) f1('10').
Consider the following code: numbers=[100,20,10,70,50,60,40,30,90,80] #Insert Code Here print('The highest Number:{} and Least Number:{}'.format(high,low)) Which of the following code should be inserted to print Highest Number as 100 and Least Number as 10 def find_numbers(): numbers.sort() return numbers[0],numbers[-1] low,high=find_numbers() def find_numbers(): numbers.sort() return numbers[0],numbers[len(numbers)] low,high=find_numbers() def find_numbers(): numbers.sort() return numbers[0],numbers[-1] low=find_numbers() high=find_numbers() def find_numbers(): numbers.sort() return numbers[2],numbers[0] low,high=find_numbers().
Consider the code: numbers=[100,20,10,70,50,60,40,30,90,80] def find_numbers(): numbers.sort() return numbers[0],numbers[-1] low=find_numbers() high=find_numbers() #Line-1 To print 10 100 to the console which of the following code we have to take at Line-1 print(low,high) print(low[0],high[-1]) print(low[-1],high[0]) print(low[2],high[0]).
Consider the code: def calculate(amount=6,factor=3): if amount>6: return amount*factor else: return amount*factor*2 Which of the following function calls returns 30 calculate() calculate(10) calculate(5,2) calculate(1).
Consider the following code def fib_seq(n): if n==0: return 0 elif n==1: return 1 else: return fib_seq(n-1)+fib_seq(n-2) for i in range(7): print(fib_seq(i),end=',') What is the result? 0,1,1,2,3,5,8, 0,1,2,4,8,16,32, 0,1,0,2,0,4,0, None of these.
You are developing a Python application for online game. You need to create a function that meets the following criteria: The function is named update_score The function receives the current score and a value. The function adds the value to the current score. The function returns the new score. Which of the following is a valid function to fulfill this requirement? update_score(score,value): new_score=score+value return new_score def update_score(score,value): new_score=score+value return new_score def update_score(score,value): new_score=score+value pass new_score def update_score(): new_score=score+value return new_score.
The XYZ company is creating a program that allows customers to log the number of miles biked.The program will send messages based on how many miles the customer logs. Consider the following python code: Line-1: name=input('Enter Your Name:') return name Line-2: calories=miles*calories_per_mile return calories distance=int(input('How many miles did you bike this week:')) burn_rate=50 biker=get_name() calories_burned=calc_calories(distance,burn_rate) print(biker,", You burned about",calories_burned," calories") The lines Line-1 should be replaced with: Line-1 should be replaced with def get_name(): Line-1 should be replaced with def get_name(name): Line-1 should be replaced with def get_name(biker):.
The XYZ company is creating a program that allows customers to log the number of miles biked.The program will send messages based on how many miles the customer logs. Consider the following python code: Line-1: name=input('Enter Your Name:') return name Line-2: calories=miles*calories_per_mile return calories distance=int(input('How many miles did you bike this week:')) burn_rate=50 biker=get_name() calories_burned=calc_calories(distance,burn_rate) print(biker,", You burned about",calories_burned," calories") The lines Line-2 should be replaced with: Line-2 should be replaced with def calc_calories(miles,calories_per_mile): Line-2 should be replaced with def calc_calories(miles,burn_rate): Line-2 should be replaced with def calc_calories():.
We are developing a mathematical function to find area for the given circle. if r is the radius then area is : pi*r**2Which of the following is valid function for this requirement? import math def find_area(r): return math.pi*math.fmod(r,2) import math def find_area(r): return math.pi*math.fabs(r) import math def find_area(r): return math.pi*math.pow(r,2) None of these.
Consider the python code: import random print(int(random.random()*5)) Which of the following is true? It will print a random int value from 0 to 5 It will print a random int value from 1 to 5 It will print a random int value from 0 to 5 It will print a random int value from 0 to 4 It will print 5.
Report abuse Consent Terms of use