WorksheetsPython Ch. 1 & 2
Total questions: 10
Worksheet time: 5mins
Name
Class
Date
1.
Which of the following is the IDLE mode where we can write and save code?
a)
Interactive
b)
Shell
c)
Script
d)
None of the above
2.
The input() function always returns which type of value?
a)
int
b)
string
c)
user input
d)
float
3.
What is it called when you combine 2 strings into one?
a)
Addition
b)
Return value
c)
Modular design
d)
Concatenation
4.
Which of the following operations will perform integer division?
a)
/
b)
//
c)
%
d)
*
5.
Which of the following operations performs division and returns the remainder?
a)
/
b)
//
c)
%
d)
*
6.
What will the following code display?
var = "Hello"
print(var*3)
var = "Hello"
print(var*3)
a)
HelloHelloHello
b)
Hello Hello Hello
c)
hello3
d)
Syntax error
7.
What will the following operation return in Python?
3/2
3/2
a)
1
b)
1.5
8.
What will the following return in python if the user enters the number 5?
float(input("What is the number?))
float(input("What is the number?))
a)
5
b)
5.0
c)
0.5
d)
None of the above
9.
What is the string method in the following code?
var = "Hello"
var.lower()
var = "Hello"
var.lower()
a)
var
b)
"Hello"
c)
var.lower()
d)
.lower()
10.
What are the argument(s) in the following code?
print(int(var))
print(int(var))
a)
print(int(var))
b)
int(var)
c)
int(var) and var
d)
var
100 %
