0%
0 votes, 0 avg
10

All The Best


python

Python Quiz

1 / 50

Which built-in function is used to get input from the user?

2 / 50

What is the name of the built-in function that returns the absolute value of a number?

3 / 50

How do you find the maximum value in a list named numbers?

4 / 50

What is the output of print(3 // 2)?

5 / 50

Which of the following is a valid way to create an empty set in Python?

6 / 50

What is the purpose of pip in Python?

7 / 50

What is the output of print("Hello" + " " + "World")?

8 / 50

What is the output of 2 + 3 * 4?

9 / 50

What is the output of print(type(10.5))?

10 / 50

How do you check if an item exists in a list?

11 / 50

Which of the following is used for multiline comments in Python?

12 / 50

Which of the following is an immutable data type?

13 / 50

Which operator is used for exponentiation in Python?

14 / 50

What is the output of print(bool(0))?

15 / 50

How do you open a file in Python for writing?

16 / 50

What is the scope of a variable defined inside a function?

17 / 50

Which method is used to remove an item from a dictionary by its key?

18 / 50

What is the purpose of the break statement in loops?

19 / 50

What is the correct way to create a list in Python?

20 / 50

What is the output of print(10 % 3)?

21 / 50

Which of the following is NOT a valid variable name in Python?

22 / 50

What is the output of print("Python"[2])?

23 / 50

Which of the following is used to define a block of code in Python?

24 / 50

How do you remove duplicate elements from a list while preserving order?

25 / 50

What does __init__ method do in a Python class?

26 / 50

Which of the following is used to iterate over a sequence (e.g., a list)?

27 / 50

What is the output of print(len("Hello"))?

28 / 50

What is the purpose of the elif keyword in Python?

29 / 50

What is the purpose of the else block with a for loop?

30 / 50

What is the purpose of the if statement in Python?

31 / 50

Which module in Python is commonly used for working with regular expressions?

32 / 50

What is the output of print("Python".upper())?

33 / 50

Which statement is used to handle exceptions in Python?

34 / 50

What does the pass statement do in Python?

35 / 50

How do you comment out a single line in Python?

36 / 50

Which of the following is a mutable data type in Python?

37 / 50

How do you get the length of a list named my_list?

38 / 50

What is the output of print("Python"[::-1])?

39 / 50

How do you add an element to the end of a list in Python?

40 / 50

Which keyword is used to define a function in Python?

41 / 50

How do you create a dictionary in Python?

42 / 50

What is the output of print(type(lambda: None))?

43 / 50

Which of the following is not a valid Python data type?

44 / 50

Which of the following is the correct way to import a module named math?

45 / 50

What is the default value of arguments in a Python function if not specified?

46 / 50

How do you concatenate two strings s1 and s2?

47 / 50

How do you convert an integer to a string in Python?

48 / 50

What is the output of [1, 2, 3] * 2?

49 / 50

How do you remove an element from a list by its index?

50 / 50

What does the dir() function do without arguments?

Your score is

The average score is 25%

0%

Scroll to Top