Join Now
Home Aptitude Reasoning DI VA GK CA CA Hindi Quiz Placements
What is the output of the following code?
x = 5 print("x =", x)
x = 5
x
5
x, 5
==
!=
<=
<>
file = open(filename, "r")
file = open("r", filename)
file = open(filename, "w")
None of the above
x = 1
y = "Hello"
z = 3.14
2 = a
What is the result of the following code?
x = ["apple", "banana", "cherry"] print(len(x))
3
6
p
open_file("example.txt")
open("example.txt")
file.open("example.txt")
with open("example.txt") as file:
print(7 % 3)
2
1
7
string1.join(string2)
string1.concat(string2)
string1 + string2
All of the above
x = [1, 2, 3] y = x y[0] = 4 print(x)
[1, 2, 3]
[4, 2, 3]
[1, 4, 3]
[1, 2, 4]
x = 2 y = 5 z = x + y print("The sum of", x, "and", y, "is", z)
The sum of 2 and 5 is 7
The sum of x and y is z
The sum of x and y is 7