Join Now
Home Aptitude Reasoning DI VA GK CA CA Hindi Quiz Placements
What is the output of the following code snippet?
my_tuple = (1, 2, 3, 4) print(my_tuple.index(3))
0
1
2
3
my_list = [1, 2, 3, 4] print(sum(my_list))
10
2.5
5
x = 5y = 7print("The sum of", x, "and", y, "is", x + y)
The sum of 5 and 7 is 12
The sum of x and y is x + y
The sum of and is
The sum of x and y "is" x + y
my_dict = {"apple": 1, "banana": 2, "orange": 3}print(len(my_dict))
None of the above
my_list = [1, 2, 3, 4] print(my_list[2])
4
my_dict = {"apple": 1, "banana": 2, "orange": 3}print(my_dict["banana"])
apple
banana
print("My name is", "John", "and I am", 25, "years old.")
My name is John and I am 25 years old.
My name is and I am years old.
John 25
print("5 + 5 =", 5 + 5)
5 + 5 = 10
5 + 5
5 + 5 =10
my_list = [1, 2, 3, 4] new_list = [x**2 for x in my_list] print(new_list)
[1, 2, 3, 4]
[1, 4, 9, 16]
[2, 4, 6, 8]
my_tuple = (1, 2, 3, 4) print(my_tuple[1:3])
(1, 2)
(2, 3)
(2, 3, 4)
(1, 2, 3)