WorksheetsIntroduction to Python Quiz
Total questions: 30
Worksheet time: 5mins
What is the primary purpose of Python in real-world applications?
Data Analysis
Game Development
Web Development
All of the above
Which of the following is the first step in setting up Python?
Installing Python
Learning syntax
Debugging code
Writing a program
What will the following code print? print('Hello, Universe!')
Hello, universe
Hello, Universe!
hello, Universe!
hello universe!
How can you take user input in Python?
read() function
get() function
input() function
scan() function
Which of the following is NOT a Python data type?
complex
char
float
int
What type of data does the 'str' data type represent?
Numeric values
Textual data
None of the above
Boolean values
Which of the following is a sequence type in Python?
dict
int
list
None of the above
What is the output of the following code? print(type(3.14))
<class 'int'>
<class 'float'>
<class 'str'>
Error
Which of the following is a mapping type in Python?
dict
tuple
list
range
What is the purpose of the 'type' function in Python?
To check the data type
To create a variable
To convert data types
To assign datatype
If you want to store multiple values in a single variable, which data type would you use?
float
list
str
int
What will the following code return?
a='Hello World'
print(a[0:8])
Hello Wor
Hello Worl
Hello W
Hello Wo
Which of the following is a correct way to declare a variable in Python?
x==10
var x = 10
x := 10
x = 10
What is the output of the following code? print('Hello' + ' World!')
Hello World
HelloWorld!
Hello World!
Hello + World!
Which of the following data types can store decimal numbers?
complex
str
float
int
What is the result of the expression 5 + 3 * 2?
16
13
11
10
Which of the following is used to create a tuple in Python?
[]
{}
()
<>
What will the following code output? print('Hello, ' + input('Enter your name: '))
Hello, [user input]
Hello, Universe!
Hello, World!
Hello, name
Which of the following is a characteristic of Python?
None of the above
Compiled language
Interpreted language
Static typing
What is the purpose of the 'print()' function in Python?
To define a variable
To take user input
To create a loop
To display output
Which of the following is a valid way to create a dictionary in Python?
dict = {key: value}
dict = [key: value]
dict = (key: value)
dict =
What will the following code return? type([1, 2, 3])
<class 'tuple'>
<class 'set'>
<class 'list'>
<class 'int'>
Which of the following is NOT a numeric type in Python?
string
complex
int
float
What is the output of the expression 'Hello' * 3?
3 Hello
Hello + Hello + Hello
Hello 3
HelloHelloHello
Which of the following statements is true about Python lists?
Lists are immutable
Lists can contain mixed data types
Lists are defined using {}
Lists cannot be nested
What will the following code output? print(5 == 5)
True
False
None
Error
Which of the following is a correct way to assign strings with multiple lines in a variable?
" " " lines " " "
' lines '
" lines "
" " lines " "
What is the output of the following code? print(10 / 2)
Error
10
2
5
Which of the following is a valid variable name in Python?
first variable
first-variable
1st_variable
first_variable
What will the following code output? print('Hello' + str(5))
Hello5
Hello 5
5Hello
Error
