0% found this document useful (0 votes)
604 views22 pages

Exams 2024 Python For Beginners

a simple exam for python beginners

Uploaded by

yuhitsabby10
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
604 views22 pages

Exams 2024 Python For Beginners

a simple exam for python beginners

Uploaded by

yuhitsabby10
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 22

EXAMS 2024 PYTHON FOR BEGINNERS.

PASS MARK
IS 80%.

ATTEMPT ALL QUESTIONS


Here are 100 multiple-choice questions (MCQs) for beginners in Python, suitable for kids around
14 years old:

1. What is Python?
a) A snake
b) A programming language
c) A type of food
d) An operating system

2. Which symbol is used for comments in Python?


a) //
b) #
c) --
d) /**/

3. What is the output of `print(3 + 7 * 2)`?


a) 20
b) 17
c) 24
d) 27

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


a) my_variable
b) _variable
c) 1variable
d) Variable1

5. What does the `len()` function do?


a) Returns the length of a string
b) Converts a string to lowercase
c) Returns the ASCII value of a character
d) Prints the string in reverse

6. How do you declare a list in Python?


a) {1, 2, 3}
b) [1, 2, 3]
c) (1, 2, 3)
d) "1, 2, 3"

7. What does the `append()` method do for lists?


a) Removes the last element
b) Adds an element to the end
c) Sorts the list
d) Reverses the list

8. What is the result of `2 ** 3`?


a) 5
b) 6
c) 8
d) 10

9. What is the correct way to write an if statement in Python?


a) if condition { }
b) if condition:
c) if condition then:
d) if condition endif

10. How do you start a loop that runs 5 times in Python?


a) for i in range(5):
b) loop 5 times:
c) while i < 5:
d) repeat 5 times:

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


a) Hello World
b) HelloWorld
c) Hello+World
d) Error

12. Which of the following is a valid way to define a function in Python?


a) function add(a, b):
b) def add(a, b):
c) define add(a, b):
d) func add(a, b):

13. How do you check if a value is in a list in Python?


a) check(value, list)
b) value in list
c) list.contains(value)
d) list[value]
14. What is the result of `10 % 3`?
a) 0
b) 1
c) 2
d) 3

15. How do you access the last element of a list in Python?


a) list[-1]
b) list.last()
c) list[length(list) - 1]
d) list.end()

16. What does the `input()` function do?


a) Prints output to the console
b) Reads input from the user
c) Converts a string to uppercase
d) Returns the square root of a number

17. What is the result of `type(5)`?


a) int
b) float
c) str
d) list

18. Which data type is used to store a sequence of characters in Python?


a) int
b) float
c) str
d) bool

19. What is the correct way to write a comment that spans multiple lines in Python?
a) /* This is a comment */
b) // This is a comment
c) # This is a comment
d) ''' This is a comment '''

20. How do you remove an element from a list in Python?


a) list.remove(element)
b) list.pop()
c) list.delete(element)
d) list.clear()

21. What does the `range()` function do?


a) Generates a list of numbers
b) Reverses a list
c) Sorts a list
d) Finds the maximum value in a list

22. What is the output of `print("Python"[2:4])`?


a) Py
b) th
c) thon
d) thon[2:4]

23. How do you check if two variables refer to the same object in memory in Python?
a) variable1 == variable2
b) variable1 is variable2
c) variable1.equals(variable2)
d) variable1.equals?(variable2)

24. What is the result of `True and False`?


a) True
b) False
c) Error
d) None

25. How do you convert a string to lowercase in Python?


a) str.lower()
b) str.upper()
c) str.toLower()
d) str.casefold()

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


a) Python
b) P
c) nohtyP
d) Error

27. How do you check if a key exists in a dictionary in Python?


a) key in dictionary
b) dictionary.hasKey(key)
c) dictionary.contains(key)
d) checkKey(dictionary, key)
28. What is the correct way to write a tuple with one element in Python?
a) (1)
b) (1,)
c) 1,
d) tuple(1)

29. What does the `clear()` method do for dictionaries in Python?


a) Deletes all items in the dictionary
b) Removes a specific item from the dictionary
c) Returns a copy of the dictionary
d) Sorts the dictionary

30. What is the output of `print(10 // 3)`?


a) 3
b) 3.33
c) 3.0
d) 3.33

31. How do you access the value of a key in a dictionary in Python?


a) dictionary.key
b) dictionary.getValue(key)
c) dictionary[key]
d) dictionary.value(key)

32. What is the result of `not True`?


a) True
b) False
c) Error
d) None

33. How do you create a set in Python?


a) {1, 2, 3}
b) [1, 2, 3]
c) (1, 2, 3)
d) "1, 2, 3"

34. What is the output of `print(2 == 2)`?


a) True
b) False
c) Error
d) None

35. How do you remove an item from a set in Python?


a) set.remove(item)
b)

set.pop()
c) set.discard(item)
d) set.clear()

36. What is the result of `bool(0)`?


a) True
b) False
c) Error
d) None
37. How do you check if a string contains a substring in Python?
a) string.hasSubstring(substring)
b) substring in string
c) string.contains(substring)
d) string.substring()

38. What is the output of `print("Hello" * 3)`?


a) HelloHelloHello
b) Hello 3 times
c) Error
d) None

39. How do you join two lists in Python?


a) list1.join(list2)
b) list1 + list2
c) list1.join(list2, delimiter)
d) list1.merge(list2)

40. What is the result of `round(3.567, 2)`?


a) 3.57
b) 3.56
c) 3.5
d) 4

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


a) str.toInt()
b) int(str)
c) str.toInteger()
d) integer(str)

42. What is the output of `print("Python"[1:4])`?


a) Pyt
b) yth
c) ytho
d) Error

43. How do you check if a number is even in Python?


a) number.even()
b) number % 2 == 0
c) isEven(number)
d) number.isEven()

44. What is the correct way to write a list comprehension in Python?


a) [x for x in range(10)]
b) (x for x in range(10))
c) {x for x in range(10)}
d) <x for x in range(10)>

45. What is the result of `abs(-5)`?


a) -5
b) 5
c) 0
d) Error

46. How do you get the current date and time in Python?
a) datetime.now()
b) currentDateTime()
c) now()
d) getDateAndTime()

47. What is the output of `print(10 != 5)`?


a) True
b) False
c) Error
d) None

48. How do you create a shallow copy of a list in Python?


a) list.copy()
b) list.clone()
c) list.shallowCopy()
d) copyList(list)

49. What is the result of `min([3, 5, 1, 7])`?


a) 1
b) 7
c) 5
d) [1, 3, 5, 7]

50. How do you convert a list to a tuple in Python?


a) list.toTuple()
b) tuple(list)
c) list.tuple()
d) convertToTuple(list)
51. What is the output of `print(type("Hello"))`?
a) int
b) str
c) float
d) list

52. How do you check if a string is empty in Python?


a) string.isEmpty()
b) len(string) == 0
c) string.length() == 0
d) isEmpty(string)

53. What is the result of `ord('A')`?


a) 65
b) 97
c) A
d) Error

54. How do you convert a list of strings to a single string in Python?


a) " ".join(list)
b) list.toString()
c) join(list)
d) list.join(" ")

55. What is the output of `print("Hello"[-1])`?


a) H
b) o
c) l
d) Error

56. How do you check if a value is not in a list in Python?


a) value in list
b) value not in list
c) list.contains(value)
d) list[value]

57. What is the result of `round(3.14159)`?


a) 3
b) 3.1
c) 3.14
d) 3.142

58. How do you concatenate two dictionaries in Python?


a) dict1.add(dict2)
b) dict1 + dict2
c) dict1.update(dict2)
d) merge(dict1, dict2)

59. What is the output of `print(3 < 5)`?


a) True
b) False
c) Error
d) None

60. How do you check if a value is a float in Python?


a) value.isFloat()
b) isinstance(value, float)
c) value.type() == float
d) isFloat(value)

61. What is the result of `list(range(5))`?


a) [0, 1, 2, 3, 4]
b) [1, 2, 3, 4, 5]
c) [0, 1, 2, 3]
d) [1, 3, 5, 7, 9]

62. How do you convert a number to a string in Python?


a) str(number)
b) number.toString()
c) number.toStr()
d) convertToString(number)

63. What is the output of `print("Hello" + 3)`?


a) Hello3
b) Error
c) HelloHelloHello
d) None

64. How do you check if a number is positive in Python?


a) number > 0
b) number.isPositive()
c) isPositive(number)
d) number.positive()
65. What is the result of `max([3, 5, 1, 7])`?
a) 1
b) 7
c) 5
d) [1, 3, 5, 7]

66. How do you convert a string to a list in Python?


a) str.toList()
b) list(str)
c) str.split()
d) convertToList(str)

67. What is the output of `print("Hello" * 0)`?


a) Hello
b) Error
c) Nothing
d) None

68. How do you check if a value is a string in Python?


a) value.isString()
b) isinstance(value, str)
c) value.type() == string
d) isString(value)

69. What is the result of `type(True)`?


a) int
b) bool
c) str
d) float

70. How do you check if a number is negative in Python?


a) number < 0
b)

number.isNegative()
c) isNegative(number)
d) number.negative()

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


a) Pytho
b) ytho
c) Pyth
d) Error

72. How do you convert a tuple to a list in Python?


a) list(tuple)
b) tuple.toList()
c) tuple.convertToList()
d) convertToList(tuple)

73. What is the result of `round(3.5)`?


a) 3
b) 4
c) 3.5
d) 4.0
74. How do you check if a number is odd in Python?
a) number % 2 == 0
b) number.odd()
c) isOdd(number)
d) number.isOdd()

75. What is the output of `print(len([1, [2, 3], 4]))`?


a) 2
b) 3
c) 4
d) Error

76. How do you check if a number is equal to another number in Python?


a) number.equals(otherNumber)
b) number == otherNumber
c) isEqual(number, otherNumber)
d) number.equal(otherNumber)

77. What is the result of `abs(-5.5)`?


a) -5.5
b) 5.5
c) 5
d) Error

78. How do you convert a list of numbers to a single string in Python?


a) " ".join(list)
b) list.toString()
c) join(list)
d) list.join(" ")

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


a) Python
b) P
c) nohtyP
d) Error

80. How do you check if a value is a boolean in Python?


a) value.isBoolean()
b) isinstance(value, bool)
c) value.type() == bool
d) isBoolean(value)

81. What is the result of `type(None)`?


a) int
b) float
c) NoneType
d) bool

82. How do you check if a number is greater than or equal to another number in Python?
a) number >= otherNumber
b) number.greaterEqual(otherNumber)
c) isGreaterOrEqual(number, otherNumber)
d) number.greaterOrEqual(otherNumber)

83. What is the output of `print("Hello".lower())`?


a) Hello
b) hello
c) HELLO
d) None

84. How do you check if a number is less than or equal to another number in Python?
a) number <= otherNumber
b) number.lessEqual(otherNumber)
c) isLessOrEqual(number, otherNumber)
d) number.lessOrEqual(otherNumber)

85. What is the result of `type("Hello")`?


a) str
b) int
c) float
d) list

86. How do you convert a number to a float in Python?


a) number.toFloat()
b) float(number)
c) number.toFloat()
d) convertToFloat(number)

87. What is the output of `print(len({1, 2, 3, 4}))`?


a) 2
b) 3
c) 4
d) Error
88. How do you check if a number is less than another number in Python?
a) number < otherNumber
b) number.lessThan(otherNumber)
c) isLessThan(number, otherNumber)
d) number.lessThan(otherNumber)

89. What is the result of `int(3.9)`?


a) 3
b) 4
c) 3.9
d) Error

90. How do you check if a value is a list in Python?


a) value.isList()
b) isinstance(value, list)
c) value.type() == list
d) isList(value)

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


a) python
b) Python
c) PYTHON
d) None

92. How do you check if a number is greater than another number in Python?
a) number > otherNumber
b) number.greaterThan(otherNumber)
c) isGreaterThan(number, otherNumber)
d) number.greaterThan(otherNumber)

93. What is the result of `bool("False")`?


a) True
b) False
c) Error
d) None

94. How do you convert a number to a boolean in Python?


a) number.toBoolean()
b) bool(number)
c) number.toBool()
d) convertToBool(number)

95. What is the output of `print("Hello"[-2])`?


a) H
b) e
c) l
d) Error

96. How do you check if a value is a dictionary in Python?


a) value.isDict()
b) isinstance(value, dict)
c) value.type() == dict
d) isDict(value)

97. What is the result of `type(3.14)`?


a) int
b) float
c) str
d) list

98. How do you convert a string to uppercase in Python?


a) str.upper()
b) str.lower()
c) str.toUpper()
d) str.casefold()

99. What is the output of `print("Hello" + str(5))`?


a) Hello5
b) Error
c) HelloHelloHelloHelloHello
d) None

100. How do you check if a value is not a boolean in Python?


a) not value.isBoolean()
b) value.isNotBoolean()
c) not isinstance(value, bool)
d) isNotBoolean(value)

You might also like