NEW
Font size
WorksheetsPythonDataStructure
Total questions: 21
Worksheet time: 5mins
name = 'Dave'
print (name)
Choose the statement that assigns 4 to the power of 3 to the variable new_var...
new_var = 4 ** 3
new_var = 3 ** 4
new var = 3 ** 4
new_var = 4 ^^ 3
7
9
A python is a non-venomous snake
done
A python is a non-venomous snake
A python is a non-venomous snake
done
A python is a non-venomous snake
A python is a non-venomous snake
A python is a non-venomous snake
done
To display the following on screen
Hello World!
the following command should be used:
print(Hello World!)
print("Hello World!")
print("Hello World" + !)
print"(Hello World!)"
x = 5
y = 6
print("x*y")
The code above displays the following:
11
x*y
Syntax Error
30
cakeAmount = raw_input()
print "We have", cakeAmount, " cakes"
The above code is run. You type:
six
Select the correct output.
We have six cakes
We have 6 cakes
We havesix cakes
Syntax Error
age = input("Enter Age (as integer): ")
newAge = age + 20
print ("your age in 20 years is:", newAge)
you enter
15
value of age is 15
value of newAge is 35
output is: your age in 20 years is: 35
value of age is 15
value of newAge is 20
output is: your age in 20 years is: 20
value of age is 15
value of newAge is "age + 20"
output is: your age in 20 years is: 35
value of age is 15
value of newAge is 35
output is: your age in 20 years is:35
people = ["John", "Rob", "Bob"]
print (people[4])
what would this result be?
people = ["John", "Rob", "Bob"]
print (people[-1])
what would this result be?
Find T ?
T=144 / 2 + 5 * 9 - ( 8 -3 )
106
688
112
684
Find the Output:
Item = {"ECE" , "CSE" , "EEE" , "CIVIL"}
Item.add (2,"MECH")
print(Item)
{ "ECE" , "MECH" , "CSE" , "EEE" , "CIVIL" }
{ "ECE" , "CSE" , "MECH" , "EEE" , "CIVIL" }
{ "ECE" , "CSE" , "EEE" , "CIVIL" }
{ "ECE" , "CSE" , "EEE" ,"MECH" , "CIVIL" }
what is the output of the following code ?
var1 = 1
var2 = 2
var3 = "3"
print (var + var2 var3)
Error. Mixing operators between numbers and strings are not supported
6
33
123
Which of the following function convert a string to a float in python ?
float(X)
int(x[,base])
long(X[,base])
str(X)
what is the output of the above program ?
[ 'AB' , 'CD' ]
[ 'ab' , 'cd' ]
[ AB , CD ]
ERROR
find p ?
p = ( 35 , 46 , 73 , 21 )
p.append( -2 , 24 )
print (p)
( 35 , 46 , 73 , 24 , 21 )
error
( 35 , 46 , 24 , 73 , 21 )
( 35 , 24 , 73 , 21 )
Find the output ?
infytq
INFYTQ
ERROR
print("Hello world!" * 2 * "Hello world!")
print("Hello world!" * 2)
