Python Beginners Test
Time Elapsed: 0 seconds
1. What is the output of the following code?
print
(
2
*
3
+
4
)
a) 10
b) 14
c) 12
d) 8
2. Which of the following data types is immutable in Python?
a) List
b) Dictionary
c) Set
d) Tuple
3. What is the correct syntax to create a function in Python?
a) def myFunction:
function myFunction():
def myFunction():
function myFunction:
4. What will be the output of the following code?
x
=
5
y
=
10
print
(
x
==
y
)
a) True
b) False
c) x
d) y
5. How do you create a list in Python with the elements 1, 2, and 3?
6. Explain the difference between
append()
and
extend()
methods in a list.
7. Write a Python expression to check if the string "hello" contains the substring "ell".
8. What is the purpose of the
self
keyword in a class definition?
Trending Tags
business
jobs
C or C++
C#
javascript
problems
python
rust
startups
writing