Site icon i2tutorials

Python – Quiz

This Quiz contains totally 25 Questions each carry 1 point for you.


  1. Which command is used to install Python on a Windows machine?

sudo apt-get install python
python install
choco install python
pip install python

Correct!

Wrong!

2. What does REPL stand for in the context of Python?
Read-Eval-Print Loop
Realtime Environment for Programming Languages
Repeatable Editor for Python Language
Run-Eval-Process Loop

Correct!

Wrong!

3. How do you run a Python script named "script.py" in the terminal?
python script.py
python run script.py
run python script.py
execute script.py

Correct!

Wrong!

4. Which of the following is NOT an Integrated Development Environment (IDE) for Python?
PyCharm
Visual Studio Code
Notepad++
Jupyter Notebook

Correct!

Wrong!

5. What is the correct syntax to declare a variable named 'x' with a value of 10 in Python?
var x = 10
let x = 10
int x = 10
x = 10

Correct!

Wrong!

6. Which data type represents a floating-point number in Python?
int
float
double
decimal

Correct!

Wrong!

7.How do you represent the string "Hello, World!" in Python?
"Hello, World!"
'Hello, World!'
Both a) and b)
None of the above

Correct!

Wrong!

8. What is the result of the following expression: 5 == 5 and 3 < 4?
True
False
Syntax error
None of the above

Correct!

Wrong!

9. What is the output of the following code snippet: print(10 % 3)?
1
2
3
4

Correct!

Wrong!

10. What does the 'not' keyword do in Python?
Inverts the value of a Boolean expression
Checks if an element is not a member of a sequence
Excludes a specific value from a range
Negates a numeric value

Correct!

Wrong!

11.Which of the following operators is used for exponentiation in Python?
^
**
*
%

Correct!

Wrong!

12. What is the result of the following expression: 5 > 3 or 2 < 1?
True
False
Syntax error
None of the above

Correct!

Wrong!

13. What is the correct syntax to increment the value of a variable 'x' by 2 in Python?
x = x + 2
x += 2
Both a) and b)
None of the above

Correct!

Wrong!

14.Which operator is used to check if a value is a member of a sequence (e.g., a list) in Python?
in
not in
is
==

Correct!

Wrong!

15. What is the output of the following code snippet: print(5 // 2)?
2
2.5
3
None

Correct!

Wrong!

16. Which of the following is NOT a valid variable name in Python?
_my_var
2 _my_var
my_var_2
myvar

Correct!

Wrong!

17.  Which of the following operators is used for integer division in Python?
/
//
*
%

Correct!

Wrong!

18. What is the output of the following code snippet: print(not False)?
True
False
Syntax error
None of the above

Correct!

Wrong!

19. Which of the following is a valid way to create a list in Python?
myList = list()
myList = []
Both a and b
None of the above

Correct!

Wrong!

20. What is the output of the following code snippet: print(10 / 2)?
5
5.0
4.0
None

Correct!

Wrong!

21. Which of the following operators is used for string concatenation in Python?
+
&
%
*

Correct!

Wrong!

22. What is the output of the following code snippet: print(True and not False)?
True
False
Syntax error
None of the above

Correct!

Wrong!

23. Which of the following is a valid way to create a dictionary in Python?
myDict = dict()
myDict = {}
Both a) and b)
None of the above

Correct!

Wrong!

24. Which of the following is NOT a valid method to create a tuple in Python?
myTuple = (1, 2, 3)
myTuple = 1, 2, 3
myTuple = tuple([1, 2, 3])
myTuple = {1, 2, 3}

Correct!

Wrong!

25. Which of the following is NOT a control structure in Python?
if-else
for
while
switch

Correct!

Wrong!

Share the quiz to show your results !

Subscribe to see your results

Ignore & go to results

Where to go ?

Quizzes
Python – Quiz

You got %%score%% of %%total%% right

%%description%%

%%description%%

Loading...

Exit mobile version