WorksheetsUnderstanding Python
Total questions: 20
Worksheet time: 6mins
To display something on the screen, use this command:
print()
Print()
screen()
write()
display()
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!)"
name = 'Dave'
print (name)
Which operator performs a division?
-
+
/
*
Which of the following is correct?
Comments are for programmers for better understanding of the program.
Python Interpreter ignores comment.
You can write multi-line comments in Python using triple quotes, either ''' or """.
All of the above
In the following code, n is a/an _______?
n = '5'
integer
string
tuple
operator
What is used to take input from the user in Python?
cin
scanf()
input()
<>
Which of the following is correct?
Variable name can start with an underscore.
Variable name can start with a digit.
Keywords cannot be used as a variable name.
Variable name can have symbols like: @, #, $ etc.
What is the output of the following code?
numbers = [2, 3, 4]
print(numbers)
2, 3, 4
2 3 4
[2, 3, 4]
[2 3 4]
What is the output of the following code?
print(3 >= 3)
3 >= 3
True
False
None
Which one will display when this code is run?
a = 10
b = 5
if b > a
print("b is bigger")
True
False
In For loop
for i in range (0, 10, 1)
the range got represent what?
start
stop
step
All of the above
.pop() can use in where?
dictionary
list
both
Choose the correct syntax of the replace function:
x.Replace(x)
x.replace(y)
x.replace(3,x)
x.replace("j","3")
The correct syntax for converting the string myname to lowercase is :
myNAME.lower[ ]
myname.lower( )
myname.upper( )
myname_lower(12 )
