Python Intermediate

1. Which value represents the Boolean false value in Python?

 
 
 

2. Which keyword begins a conditional statement in Python?

 
 
 

3. Which keyword provides an alternative branch when an if condition is false?

 
 
 

4. Which operator checks whether two values are equal?

 
 
 

5. Which keyword checks another condition after an if condition?

 
 
 

6. Which data structure stores unique elements?

 
 
 

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

 
 
 

8. Which brackets are used to create a list in Python?

 
 
 

9. Which statement is used to display output in Python?

 
 
 

10. Which operator is used for exponentiation in Python?

 
 
 

11. Which list method removes and returns the last item by default?

 
 
 

12. Which keyword is used to define a class in Python?

 
 
 

13. What values are produced by range(3)?

 
 
 

14. Which keyword sends a value back from a function?

 
 
 

15. Which block is used to handle an exception in Python?

 
 
 

16. Which symbol is used to write a single-line comment in Python?

 
 
 

17. What is printed by: if 4 > 2: print(‘Yes’)?

 
 
 

18. Which symbol creates an empty set in Python?

 
 
 

19. What is the result of ‘Py’ + ‘thon’?

 
 
 

20. Which list method adds one item to the end of a list?

 
 
 

21. What is the result of 10 // 3 in Python?

 
 
 

22. Which keyword immediately exits the nearest loop?

 
 
 

23. What is the result of calling len([4, 5, 6])?

 
 
 

24. Which dictionary method returns a value for a key without raising KeyError when the key is missing (unless configured otherwise)?

 
 
 

25. What is the result of 7 % 2?

 
 
 

26. Which operator checks whether a value belongs to a sequence or collection?

 
 
 

27. Which keyword is used to start code that may raise an exception?

 
 
 

28. What is the result of type(3.14) in Python?

 
 
 

29. Which keyword starts a for loop in Python?

 
 
 

30. What is the usual name of the first instance parameter in an instance method?

 
 
 

31. Which built-in function returns the data type of an object?

 
 
 

32. Which of these is a valid way to start the Python interactive interpreter command on many systems?

 
 
 

33. Which file extension is commonly used for Python source files?

 
 
 

34. Which keyword skips the rest of the current loop iteration and moves to the next one?

 
 
 

35. Who created the Python programming language?

 
 
 

36. In Python, what is the index of the first character in a string?

 
 
 

37. What is a parameter in a function definition?

 
 
 

38. What is the output of len(‘Python’)?

 
 
 

39. What is the result of [10, 20, 30][1]?

 
 
 

40. Which loop continues while its condition remains true?

 
 
 

41. What is the data type of the value 25 in Python?

 
 
 

42. What is the result of not (5 > 2) ?

 
 
 

43. Which method converts a string to uppercase?

 
 
 

44. Which brackets are commonly used to create a dictionary literal?

 
 
 

45. Which keyword is used to create an anonymous function in Python?

 
 
 

46. Which statement about tuples is correct?

 
 
 

47. Which keyword is used to define a function in Python?

 
 
 

48. How do you access the value associated with key ‘name’ in dictionary d?

 
 
 

49. Which string method removes whitespace from both ends of a string?

 
 
 

50. Which keyword is used to run cleanup code whether an exception occurs or not?

 
 
 

Question 1 of 50

Leave a Reply

Your email address will not be published. Required fields are marked *