WorksheetsBasic Programming Concepts Quiz
Total questions: 10
Worksheet time: 8mins
What function is used to convert string values to integers?
int()
str()
float()
bool()
What sequence is used to create a newline at the end of statements?
(a)
Construct a block of code that asks the user for a number and prints three times that number. There is extra code to watch out for.
Which function is used to convert an integer to a string in Python?
int()
float()
list()
str()
What is the output of int('42') in Python?
42
'42'
4.2
Error
Which of the following will raise a ValueError in Python?
int('123')
int('abc')
int(True)
int(5.0)
Why will this code not run?
there has to be a number in the variable
there are supposed to be no spaces in the variable label
there are no caps in variables
What is a series of characters like letters or numbers, used in the context of programming?
function
wake word
variable
string
