NEW
Font size
WorksheetsQ1 Introduction to Python
Total questions: 15
Worksheet time: 11mins
What is Python?
A type of snake
A high-level programming language
A popular web browser
A type of pasta
Who is the creator of Python?
Linus Torvalds
Mark Zuckerberg
Steve Jobs
Guido van Rossum
Which of the following is true about Python's indentation?
It is optional and doesn't affect the code's execution
It is used for code organization and is required for code blocks
It is only used for comments
It is used to create loops in Python
What does the "print" function do in Python?
It takes user input
It displays text or values on the screen
It performs mathematical calculations
It creates a new variable
What is the result of the expression 5 + 3 * 2?
10
16
11
26
Which symbol is used for comments in Python?
//
#
/* */
--
Which data type is used to store a sequence of characters in Python?
int
float
str
bool
How do you declare and initialize a variable in Python?
var x = 5
let x = 5
x = 5
int x = 5
Which of the following is a valid way to create a list in Python?
(1, 2, 3)
[1, 2, 3]
{1, 2, 3}
"1, 2, 3"
What is the purpose of the "if" statement in Python?
To create a loop
To define a function
To execute code conditionally
To perform mathematical calculations
What is the output of the following code snippet?
my_list = [1, 2, 3, 4, 5]
print(my_list[2])
2
3
4
5
Which of the following is a valid Python comment for a multi-line statement?
// This is a comment
# This is a comment
/* This is a comment */
''' This is a comment '''
Which of the following is an example of a Python keyword
function
variable
None of the above
What is the primary purpose of the "elif" keyword in Python?
To define a function
To specify the exception handling code
To add an "else if" condition in an if-else statement
To create a loop
What is the result of the following code snippet?
x = 10
y = 5
result = x > y
result is assigned the value 10
result is assigned the value True
result is assigned the value False
This code will result in an error
