TRACK: PYTHON
ASSIGNMENT 1
0 of 20 Questions completed
Questions:
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:
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)
print (2**3 + (5 + 6) **(1 + 1))
What will be the output of the following code snippet?
a = [1,2,3]
a = tuple(a)
a [0] = 2
print(a)
What will be the output of the following code snippet?
print (type (5 / 2))
print (type (5 // 2))
a = [1, 2, 3, 4, 5]
sum = 0
for ele in a:
sum += ele
print(sum)
What will be the output of the following code snippet?
count = 0
while (True):
if count % 3 == 0:
print (count, end = " ")
if (count > 15):
break ;
count += 1
What will be the output of the following code snippet?
def solve (a, b):
return b if a == 0 else solve (b % a, a)
print (solve (20, 50))
What will be the output of the following code snippet?
def solve(a):
a = [1, 3, 5]
a = [2, 4, 6]
print(a)
solve(a)
print(a)
What will be the output of the following code snippet?
def func():
global value
value = "Local"
value = "Global"
func()
print(value)
What will be the output of the following code snippet?
a = 3
b = 1
print(a, b)
a, b = b, a
print(a, b)
Which of the following types of loops are not supported in Python?
Which of the following is the proper syntax to check if a particular element is present in a list?
What will be the output of the following code snippet?
def thrive(n):
if n % 15 == 0:
print("thrive", end = “ ”)
elif n % 3 != 0 and n % 5 != 0:
print("neither", end = “ ”)
elif n % 3 == 0:
print("three", end = “ ”)
elif n % 5 == 0:
print("five", end = “ ”)
thrive(35)
thrive(56)
thrive(15)
thrive(39)
What will be the output of the following code snippet?
example = [“Sunday”, “Monday”, “Tuesday”, “Wednesday”];
print (example [-3:-1])
What will be the output of the following code snippet?
a = [1, 2]
print (a * 3)
What will be the output of the following code snippet?
example = [“Sunday”, “Monday”, “Tuesday”, “Wednesday”];
del example[2]
print(example)
What will be the type of the variable sorted_numbers in the below code snippet?
numbers = (4, 7, 19, 2, 89, 45, 72, 22)
sorted_numbers = sorted(numbers)
print(sorted_numbers)
What will be the output of the following code snippet?
numbers = (4, 7, 19, 2, 89, 45, 72, 22)
sorted_numbers = sorted(numbers)
odd_numbers = [x for x in sorted_numbers if x % 2 != 0]
print(odd_numbers) [‘Monday’, ‘Tuesday’]
What will be the output of the following code snippet?
def is_even(number):
message = f”{number} is an even number”
if number % 2 == 0
else f”{number} is an odd number”
return message
print(is_even(54))
What will be the output of the following code snippet?
dict1 = {'first’: 'sunday', 'second' : 'monday'}
dict2 = {1: 3, 2: 4}
dict1.update(dict2)
print(dict1)
What will be the output of the following code snippet?
a = [1, 2, 3, 4]
b = [3, 4, 5, 6]
c = [x for x in a if x not in b]
print(c)