Given the list below, answer the following question:
mylist = ["Europe", "Asia", "North America", "South America", "Africa", "Australia", 2009, 2140, 12.5, 6.25]
?What is the result of mylist[2]?
Options are :
Considering the dictionary below (showing the population of some of the Eastern European countries) answer the following question.??
ee_countries = {"Croatia": "4.09M", "Russia": "143.8M", "Poland": "38.1M", "Romania": "19.5M", "Bulgaria": "6.9M", "Hungary": "9.6M", "Serbia": "6.8M", "Estonia": "1.3M" }??
Which is the correct way of adding Moldova to the dictionary, having a population of 4.1M?
Options are :
Given the set below
??set1 = {62, 100, 4001, 82, 550, 4001, 228, 82.0, 21}??
What is the result of set1.add(450)?
Options are :
Considering the following string referenced by the fact variable, please select the correct answer to the question below.
fact = "Values live until nothing references them. Python keeps track of how many references each value has, and automatically cleans up values that have none."
What is the string method that will turn all lowercase characters to uppercase and vice-versa?
Options are :
Considering the dictionary below (showing the population of some of the Eastern European countries), answer the following question.
ee_countries = {"Ukraine": "43.7M", "Russia": "143.8M", "Poland": "38.1M", "Romania": "19.5M", "Bulgaria": "6.9M", "Hungary": "9.6M", "Moldova": "4.1M", "Estonia": "1.3M"}
What is the result of sorted(ee_countries.values())[-2] ?
Options are :
Given the tuple below, answer the following question.??
mytuple = (100, 250, 300, 250, 500, 650, 700, 500, 900)??
How would you find the location (index) of the first occurrence of 500 in mytuple???
Options are :
Given the code below, answer the following question.
- ?set1 = {62, 100, 4001, 82, 550, 4001, 228, 82.0, 21}
- len(set1)
What is the length of set1?
Options are :
Options are :
Given the code below, answer the following question.
- ??mytuple = (150, 350, 400, 250, 600)
- (a, b, c, d, e) = mytuple??
What is the result of d % 10?
Options are :
Considering the dictionary below (showing the population of some of the Eastern European countries) answer the following question.
??ee_countries = {"Croatia": "4.09M", "Russia": "143.8M", "Poland": "38.1M", "Romania": "19.5M", "Bulgaria": "6.9M", "Hungary": "9.6M", "Serbia": "6.8M", "Estonia": "1.3M" }??
Which is the correct way of deleting Estonia from the dictionary?
Options are :
You created the following program to locate a conference room and display room name.
- rooms={1:'Left Conference Room',2:'Right Conference Room'}
- room=input('Enter the room number:')
- if not room in rooms:#Line-3
- print('Room does not exist')
- else:
- print('The room name is:'+rooms[room])
Your team reported that the program sometimes produces incorrect results.
You need to troubleshoot the program. Why does Line-3 Fail to find the rooms?
Options are :
Consider the following code:
- def f1(x=0,y=0):
- return x+y
Which of the following method calls are valid?
Options are :
We are developing a 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 the commission?
Options are :
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?
Options are :
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
Options are :
Consider the following code:
- numbers=[0,1,2,3,4,5,6,7,8,9]
- index=0
- while (index<10)#Line-1
- print(numbers[index])
- if numbers(index) = 6 # Line-2
- break
- else:
- index += 1
To print 0 to 6, which changes we have to perform in the above code?
Options are :
You are writing a Python program to validate employee numbers.
The employee number must have the format dd-ddd-dddd and consists of only numbers and dashes. The program must print True if the format is correct, otherwise print False.
- employee_number=input('Enter Your Employee Number(dd-ddd-dddd):')
- parts=employee_number.split('-')
- valid=False
- if len(parts) == 3:
- if len(parts[0])==2 and len(parts[1])==3 and len(parts[2])==4:
- if parts[0].isdigit() and parts[1].isdigit() and parts[2].isdigit():
- valid=True
- print(valid)
Which of the following is True about this code?
Options are :
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?
Options are :
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?
Options are :
You want to add comments to your code so that other team members can understand it.
What should you do?
Options are :
We are developing one school automation application. If the student marks between 80 and 100, then we have to offer 'A' grade.
Which code block we have to use?
Options are :
Consider the following code:
- marks=[30,40,50,45,50,100]
- average=sum(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?
Options are :
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?
Options are :
You are coding a math utility by using python.
You are writing a function to compute roots
The function must meet the following requirements
- If a is non-negative, return a**(1/b)
- If a is negative and even, return "Result is an imaginary number"
- if a is negative and odd,return -(-a)**(1/b)
Which of the following root function should be used?
Options are :
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?
Options are :
The XYZ Book Company needs a way to determine the cost that a student will pay for renting a Book.
The Cost is dependent on the time of the Book is returned.
However, there are also special rates on Saturday and Sundays.
The Fee Structure is shown in the following list:
- The cost is $3.00 per night.
- If the book is returned after 9 PM, the student will be charged an extra day.
- If the Book is rented on a Sunday, the student will get 50% off for as long as they keep the book.
- If the Book is rented on a Saturday, the student will get 30% off for as long as they keep the book.
Below is the code to meet these requirements.
- # XYZ Book Rented Amount Calculator
- ontime=input('Was Book returned before 9 pm? y or n:').lower()
- days_rented=int(input('How many days was book rented?'))
- day_rented=input('What day the Book rented?').capitalize()
- cost_per_day=3.00
- if ontime == 'n':
- days_rented=days_rented+1
- if day_rented=='Sunday':
- total=(days_rented*cost_per_day)*0.5
- elif day_rented=='Saturday':
- total=(days_rented*cost_per_day)*0.7
- else:
- total=(days_rented*cost_per_day)
- print('The Cost of Book Rental is:$',total)
If the Book rented on 'Sunday', the number of days Book rented is 5 and Book returned after 9 PM then what is the result?
Options are :
The XYZ organics company needs a simple program that their call center will use to enter survey data for a new coffee variety. The program must accept input and return the average rating based on a five-star scale.The output must be rounded to two decimal places.
Consider the code:
- sum=count=done=0
- average=0.0
- while(done != -1):
- rating=float(input('Enter Next Rating(1-5),-1 for done'))
- if rating == -1:
- break
- sum+=rating
- count+=1
- average=float(sum/count)
- #Line-1
Which of the following print() statements should be placed at Line-1 to meet requirements?
Options are :
We are developing a sports application. Our program should allow players to enter their names and score. The program will print player name and his average score. Output must meet the following requirements:
The user name must be left-aligned. If the user name is fewer than 20 characters, additional space must be added to the right. The average score must be 3 places to the left of the decimal point and one place to the right of a decimal point ( like YYY.Y).
Consider the code:
- name=input('Enter Your Name:')
- score=0
- count=0
- sum=0
- while(score != -1):
- score=int(input('Enter your scores: (-1 to end)'))
- if score==-1:
- break
- sum+=score
- count+=1
- average_score=sum/count
- #Line-1
Which print statement we have to take at Line-1 to meet requirements.
Options are :
We are creating a function to calculate the power of a number by using python.
We have to ensure that the function is documented with comments.
Consider the code(Line numbers included for reference):
- 01 # The calc_power function calculates exponents
- 02 # x is the base
- 03 # y is the exponent
- 04 # The value of x raided to the y power is returned
- 05 def calc_power(x, y):
- 06 comment="#Return the value"
- 07 return x**y #raise x to the power y
Which of the following statements are true?
Options are :
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?
Options are :
Given the list below, answer the following question:
mylist = ["Europe", "Asia", "North America", "South America", "Africa", "Australia", 2009, 2140, 12.5, 6.25]
What is the result of len(mylist) * 25 / 5?
Options are :
Considering the dictionary below (showing the population of some of the Eastern European countries), answer the following question.??
ee_countries = {"Croatia": "4.09M", "Russia": "143.8M", "Poland": "38.1M", "Romania": "19.5M", "Bulgaria": "6.9M", "Hungary": "9.6M", "Serbia": "6.8M", "Estonia": "1.3M" }??
Which is the correct way of returning the population of Estonia (only the numerical part)??
Options are :
Given the range below, answer the following question.
myrange = range(10, 28, 3)
What is the result of list(myrange)[6]?
Options are :
Given the list below answer the following question.
list1 = ["Hello", "Hi", "Greetings", "Cheers", "Hi", "hello", "Greetings!"]
What would be the correct result of set(list1) ?
Options are :
Options are :
Considering the following string referenced by the fact variable, please select the correct answer to the question below. fact = "Python is the general-purpose language. Python is widely used in data analytics and machine learning.�?
What is the correct result of: "language" in fact.title()
Options are :
Considering the dictionary below (showing the population of some of the Eastern European countries) answer the following question.??
ee_countries = {"Ukraine": "43.7M", "Russia": "143.8M", "Poland": "38.1M", "Romania": "19.5M", "Bulgaria": "6.9M", "Hungary": "9.6M", "Moldova": "4.1M", "Estonia": "1.3M"}
??What is the result of max(ee_countries.keys()) ?
Options are :
Considering the dictionary below, answer the following question.
ee_countries = {"Ukraine": "43.7M", "Russia": "143.8M", "Poland": "38.1M", "Romania": "19.5M", "Bulgaria": "6.9M", "Hungary": "9.6M", "Moldova": "4.1M", "Estonia": "1.3M"}
?How can you create a copy of the ee_countries dictionary and save it using a new variable?
Options are :
What is the result of:
not(25 % 5 == 33 % 10) or (10 ** 4 > 3000)
Options are :
Options are :
What is the result of the code below?
int('0011', 2)
Options are :
Options are :
What is the result of:
bool(0.0)
Options are :
Given the range below, answer the following question.??
myrange = range(5, 15)
What is the result of tuple(myrange)?
Options are :
Given the tuple below answer the following question.?
mytuple = (100, 250, 300, 450, 500, "Python", "Java", "C++")??
What is the result of the below???
(mytuple + (410, 430, 450, 205 * 2, 900 // 2, 445)).count(450)
Options are :
What is the result of:
- x = 150 + 3 ** 3 % (18 % 5)
- print(x)
Options are :
Given the range below, answer the following question.??
myrange = range(11)[::2]??
What is the result of list(myrange)??
Options are :
Options are :
Given the range below answer the following question.
myrange = range(3, 15, 2)
What is the result of list(myrange)?
Options are :
Considering the following string referenced by the fact variable, please select the correct answer to the question below.
fact = "Python is the general-purpose language. Python is widely used in data analytics and machine learning" What would be the result of fact.index("he") * fact.count("P") ?
Options are :
Given the list below, answer the following question:
mylist = ["Europe", "Asia", "North America", "South America", "Africa", "Australia", 2009, 2140, 12.5, 6.25]
Options are :
Considering the dictionary below (showing the population of some of the Eastern European countries), answer the following question.
?ee_countries = {"Croatia": "4.09M", "Russia": "143.8M", "Poland": "38.1M", "Romania": "19.5M", "Bulgaria": "6.9M", "Hungary": "9.6M", "Serbia": "6.8M", "Estonia": "1.3M" }??
What is the correct way of removing all the key-value pairs from the dictionary (result should be an empty dictionary)?
Options are :
Given the string below, answer the following question.
fact = "Python is the general-purpose language. Python is widely used in data analytics and machine learning.�?
How would you extract the �?language’ substring (excluding the surrounding white spaces) using positive indexes?
Options are :
Given the sets below answer the following question.??
set1 = {26, 200, 2001, 92, 550}?set2 = {334, 92, 29, 650, 550, 25, 1002}??
Which of the following lines of code results in {26, 200, 2001}?
Options are :
What is the result of the code below???
- mylist = ['1.3M', '143.8M', '19.5M', '38.1M', '4.1M', '43.7M', '6.9M', '9.6M']
- str(mylist)
Options are :
Given the range below, answer the following question.
??myrange = range(0, 10)??
What is the result of list(myrange)?
Options are :
Given the list below, answer the following question:
mylist = ["Europe", "Asia", "North America", "South America", "Africa", "Australia", 2009, 2140, 12.5, 6.25]
How would you skip every second element of mylist, so that you get this list: ['Europe', 'North America', 'Africa', 2009, 12.5]?
Options are :
Given the tuple below answer the following question??
mytuple = (200, 350, 100, 150, 400, "Python", "Javascript", "C#")??
What is the result of mytuple[7:]?
Options are :
Given the string below, answer the following question. fact = "Python is the general-purpose language. Python is widely used in data analytics and machine learning."
What is the result of fact[::-1]?
Options are :
What is the result of:
- num1 = 10 * 2.5
- type(num1)
Options are :
Consider the following expression
- result=8//6%5+2**3-2
- print(result)
What is the result?
Options are :
Consider the Python code:
- a=5
- b=10
- c=2
- d=True
- x=a+b*c
- y=a+b/d
- if(condition):
- print('Valid')
- else:
- print('invalid')
To print 'Valid' to the console, which condition we have to take for if statement?
Options are :
Which of the following expression will generate max value?
Options are :
Consider the following python code:
- temp=94.3
- pin='20101'
- value=+32E5
The types of weight, zip, and value variables respectively:
Options are :
Which of the following code snippet will produce the output:
- Boy
- Cat
- Dog
Options are :
Consider the lists:
- numbers=[10,20,30,40,50]
- alphabets=['a','b','c','d','e']
- print( numbers is alphabets)
- print( numbers == alphabets)
- numbers=alphabets
- print( numbers is alphabets)
- print( numbers == alphabets)
What is the result?
Options are :
Consider the code
- s='AB CD'
- list=list(s)
- list.append('EF')
- print(list)
What is the result?
Options are :
You have the following code:
- a=3
- b=5
- a += 2**3
- a -= b//2//3
- print(a)
What is the result?
Options are :
Consider the expression:
result=a-b*c+d
Which of the following are valid?
Options are :
Consider the list:
list=['Apple','Banana','Carrot','Mango']
Which of the following are valid ways of accessing 'Mango':
Options are :
Consider the code:
- start=input('How old were you at the time of joining?')
- end=input('How old are you today?')
Which of the following code is valid to print Congratulations message?
Options are :
In which of the following cases we will get the same result?
Options are :
Which of the following is valid python operator precedence order?
Options are :
You are writing a Python program. You required to handle data types properly. Consider the code segment:
- a=10+20
- b='10'+'20'
- c='10'*3
Identify the types of a, b, and c?
Options are :
- a=bool(0)
- b=bool(3)
- c=bool(0.5)
- d=bool(0.0)
Which variables represent True?
Options are :
Consider the code
- a = 2
- a += 1
- # Line - 1
To make 'a' value as 9, which expression required to place at Line-1?
Options are :
Consider the code:
- x = 8
- y = 10
- result = x//3*3/2+y%2**2
- print(result)
What is the result?
Options are :
Consider the following lists:
- n1=[10,20,30,40,50]
- n2=[10,20,30,40,50]
- print(n1 is n2)
- print(n1 == n2)
What is the output?
Options are :
You are writing a python program that evaluates an arithmetic expression.
The expression is described as b equals a multiplied by negative one, then raised to the second power, where a is the value which will be input and b is the result.
a = eval(input('Enter a number for the expression:'))
Which of the following is a valid expression for the given requirement?
Options are :
You are writing a Python program to read two int values from the keyboard and print the sum.
- x=input('Enter First Number:')
- y=input('Enter Second Number:')
- #Line-1
Which of the following code we have to write at Line-1 to print the sum of given numbers?
Options are :
Consider the following code
- x= 'Peter'
- y= 'Peter'
- result=condition
- print(result)
For which of the following condition True will be printed to the console?
Options are :
Consider the following code segments:
# Code Segment-1
- a1='10'
- b1=3
- c1=a1*b1
# Code Segment-2
- a2=10
- b2=3
- c2=a2/b2
# Code Segment-3
- a3=2.6
- b3=1
- c3=a3/b3
After executing Code Segments 1, 2, and 3 the result types of c1, c2, and c3 are: -
Options are :
Suppose you are developing a python application for your company.
A list named employees contains 600 employee names, the last 3 being company management. You need to slice employees to display all employees excluding management. Which two code segments we should use?
Options are :
Consider the code
- a=1
- b=2
- c=4
- d=6
Which of the following expression results in -4?
Options are :
You are developing a python application for your company.
A list named employees contains 500 employee names.
In which cases we will get IndexError while accessing employee data?
Options are :
Consider the following python code:
- age=0
- minor=False
- name='Peter'
What are the types of age, minor, and name variables respectively:
Options are :
In which cases, True will be printed to the console?
- subjects=['java','python','sap']
- more_subjects=['java','python','sap']
- extra_subjects=more_subjects
Options are :
Consider the following expression
result=(2*(3+4)**2-(3**3)*3)
What is the result value?
Options are :
Consider the code:
- x='ACROTE'
- y='APPLE'
- z='TOMATO'
Which of the following won't print 'CAT' to the console?
Options are :
Consider the code:
- s='Python is easy'
- s1=s[6:-4]
- #Line-1
- print(len(s2))
To print 2 as output, which code we have to insert at Line-1
Options are :