1.
A set of valid characters recognized by a language is called a:
(a) Character Set
(b) Identifier
(c) Token
(d) Data Type
Answer: (a) Character Set
2. Python follows which character standard for its characters?
(a) ASCII only
(b) Unicode
(c) UTF-5
(d) Binary Code
Answer: (b) Unicode
3. Which of the following is NOT a valid category in Python’s character set?
(a) Alphabet
(b) Digits
(c) Punctuators
(d) Binary Pairs
Answer: (d) Binary Pairs
4. The smallest individual unit of a Python program is called a:
(a) Keyword
(b) Token
(c) Identifier
(d) Operator
Answer: (b) Token
5. Which one of the following is a valid identifier?
(a) 1value
(b) value_1
(c) value^1
(d) value 1
Answer: (b) value_1
6. Which of the following cannot be used as an identifier?
(a) my_var
(b) _name
(c) False
(d) count2
Answer: (c) False
7. What must an identifier start with?
(a) A digit
(b) A letter or underscore
(c) A keyword
(d) A number or symbol
Answer: (b) A letter or underscore
8. Python keywords are:
(a) User-defined words
(b) Reserved words
(c) Used only in comments
(d) Only written in uppercase
Answer: (b) Reserved words
9. Which character among the following is allowed in identifiers?
(a) @
(b) ^
(c) _ (underscore)
(d) %
Answer: (c) _ (underscore)
10. Python is case-sensitive, which means:
(a) Uppercase and lowercase are treated the same
(b) Uppercase and lowercase are different
(c) Only lowercase is allowed
(d) Only uppercase is allowed
Answer: (b) Uppercase and lowercase are different
11. Which of the following is a Python keyword?
(a) hello
(b) class
(c) number
(d) add
Answer: (b) class
12. Keywords in Python are:
(a) Predefined and reserved words
(b) User-created variable names
(c) Only used for arithmetic operations
(d) Case-insensitive terms
Answer: (a) Predefined and reserved words
13. Which of the following is not a Python keyword?
(a) continue
(b) return
(c) lambda
(d) integer
Answer: (d) integer
14. Constants in Python are values that:
(a) Always change during program execution
(b) Never change during program execution
(c) Store only text data
(d) Store only numbers
Answer: (b) Never change during program execution
15. Which one is a string literal?
(a) 19
(b) True
(c) None
(d) "hello"
Answer: (d) "hello"
16. The literal 3.14 belongs to which type?
(a) Boolean literal
(b) Integer literal
(c) Floating-point literal
(d) Complex literal
Answer: (c) Floating-point literal
17. Which of the following is a complex literal?
(a) 10j
(b) 10.0
(c) "10"
(d) -10
Answer: (a) 10j
18. Which special literal is used in Python to represent the absence of a value?
(a) False
(b) Null
(c) None
(d) Zero
Answer: (c) None
19. Operators in Python are used to:
(a) Store data permanently
(b) Perform operations on operands
(c) Define functions only
(d) Create memory locations
Answer: (b) Perform operations on operands
20. In Python, operands are:
(a) Special keywords
(b) Variables or values used with operators
(c) Only mathematical symbols
(d) Programming errors
Answer: (b) Variables or values used with operators
21. A combination of variables, constants, and operators is called a:
(a) Statement
(b) Expression
(c) Keyword
(d) Identifier
Answer: (b) Expression
22. In the expression: a + 5 = 20
What is a in the expression?
(a) Operator
(b) Variable
(c) Constant
(d) None of these
Answer: (b) Variable
23. In the expression: a + 5 = 20
What is + in the expression?
(a) Constant
(b) Operator
(c) Keyword
(d) Literal
Answer: (b) Operator
24. Which arithmetic operator performs multiplication in Python?
(a) ^
(b) ×
(c) *
(d) X
Answer: (c) *
25. Which operator gives the remainder in a division?
(a) /
(b) %
(c) //
(d) **
Answer: (b) %
26. What will be the result of: 7 // 3
(a) 2.3333
(b) 2
(c) 2.0
(d) 3
Answer: (b) 2
27. What does the operator ** do in Python?
(a) Division
(b) Exponentiation (power)
(c) Remainder
(d) Floor Division
Answer: (b) Exponentiation (power)
28. Which operator performs floor division?
(a) /
(b) %
(c) //
(d) **
Answer: (c) //
29. If x = 7 and y = 3, what is the output of: x * y
(a) 10
(b) 4
(c) 21
(d) 343
Answer: (c) 21
30. If x = 7 and y = 3, what is the output of: x % y
(a) 0
(b) 1
(c) 2
(d) 4
Answer: (b) 1
31. Relational operators are used to:
(a) Perform arithmetic on numbers
(b) Compare two values
(c) Store data in memory
(d) Print output on screen
Answer: (b) Compare two values
32. Which operator checks if two values are equal?
(a) =
(b) ==
(c) !=
(d) =>
Answer: (b) ==
33. Which operator represents “not equal to”?
(a) =/=
(b) !=
(c) <>
(d) =!
Answer: (b) !=
34. If x = 8 and y = 6, what is the result of: x > y?
(a) FALSE
(b) TRUE
(c) ERROR
(d) NONE
Answer: (b) TRUE
35. Which of the following is the operator for “less than or equal to”?
(a) <=
(b) =>
(c) =<
(d) ><
Answer: (a) <=
36. If x = 8 and y = 6, what will be the result of: x == y?
(a) TRUE
(b) FALSE
(c) 8
(d) 6
Answer: (b) FALSE
37. Logical operators are used to:
(a) Compare memory size
(b) Combine two or more conditions
(c) Perform string operations
(d) Display output
Answer: (b) Combine two or more conditions
38. Which logical operator returns TRUE only if all conditions are true?
(a) or
(b) and
(c) not
(d) nor
Answer: (b) and
39. Which logical operator returns TRUE if at least one condition is true?
(a) and
(b) or
(c) not
(d) xor
Answer: (b) or
40. Which logical operator reverses the result of a condition?
(a) and
(b) or
(c) not
(d) !=
Answer: (c) not
41. If a = True and b = False, what is the result of:
a and b ?
(a) True
(b) False
(c) Error
(d) None
Answer: (b) False
42. If a = True and b = False, what is the result of:
a or b ?
(a) True
(b) False
(c) Error
(d) None
Answer: (a) True
43. If x = 2, what is the result of:
(x < 5) and (x < 10)
(a) FALSE
(b) TRUE
(c) Syntax Error
(d) 2
Answer: (b) TRUE
44. If x = 2, what is the result of:
(x < 5) or (x < 2)
(a) TRUE
(b) FALSE
(c) None
(d) 0
Answer: (a) TRUE
45. What will this expression return?
not [(x < 5) and (x < 10)] (x = 2)
(a) TRUE
(b) FALSE
(c) 2
(d) ERROR
Answer: (b) FALSE
46. Which operator is used for simple assignment?
(a) ==
(b) =
(c) :=
(d) ===
Answer: (b) =
47. Which operator will add a value and then assign it to the same variable?
(a) =+
(b) +=
(c) ==+
(d) <>
Answer: (b) +=
48. If x = 5, what will be the result after: x *= 2
(a) 10
(b) 7
(c) 5
(d) 2
Answer: (a) 10
49. Which operator is used for floor division assignment?
(a) //
(b) //=
(c) /=
(d) %=
Answer: (b) //=
50. If x = 3, what will be the output of: x **= 3
(a) 3
(b) 6
(c) 9
(d) 27
Answer: (d) 27
51. Which operator assigns the remainder back to the variable?
(a) %=
(b) /=
(c) *=
(d) -=
Answer: (a) %=
52. In x -= 4, what happens?
(a) 4 is added to x
(b) 4 is subtracted from x and stored back in x
(c) x becomes 4
(d) x is multiplied by 4
Answer: (b) 4 is subtracted from x and stored back in x
53. Which logical operator returns TRUE only if both conditions are TRUE?
(a) or
(b) not
(c) and
(d) xor
Answer: (c) and
54. Which operator is used to reverse the result of a condition?
(a) or
(b) and
(c) not
(d) ==
Answer: (c) not
55. Which operator has lower precedence than multiplication (*)?
(a) %
(b) +
(c) //
(d) **
Answer: (b) +
56. Assignment operators like =, +=, -= have precedence:
(a) Highest
(b) Medium
(c) Lower
(d) Same as logical operators
Answer: (c) Lower
57. Punctuators in Python are also called:
(a) Operators
(b) Separators
(c) Keywords
(d) Constants
Answer: (b) Separators
58. Which punctuator is used to mark the beginning of a block or condition?
(a) ;
(b) :
(c) @
(d) #
Answer: (b) :
59. Parentheses ( ) are used for:
(a) Lists
(b) Grouping expressions & function calls
(c) Dictionaries
(d) Removing comments
Answer: (b) Grouping expressions & function calls
60. Which punctuator is used to indicate a list?
(a) ( )
(b) { }
(c) [ ]
(d) :
Answer: (c) [ ]
61. The equal sign = is used to:
(a) Compare values
(b) Assign value to a variable
(c) End a statement
(d) Call a function
Answer: (b) Assign value to a variable
62. Which character is used to separate variable arguments in a function?
(a) .
(b) ,
(c) @
(d) "
Answer: (b) ,
63. Operator precedence decides:
(a) How comments are written
(b) The order in which operators are evaluated
(c) How variables are declared
(d) How keywords are used
Answer: (b) The order in which operators are evaluated
64. Which operator has the highest precedence?
(a) +
(b) *
(c) ()
(d) and
Answer: (c) ()
65. Which group of operators is evaluated first after parentheses?
(a) + and -
(b) *, /, %, //
(c) and, or
(d) ==, !=
Answer: (b) *, /, %, //
66. Which operators are evaluated last according to precedence?
(a) Relational operators
(b) Arithmetic operators
(c) Logical operators (and, or, not)
(d) Assignment operators
Answer: (c) Logical operators (and, or, not)
67. Numbers that can be written using “e” or “E” in Python represent:
(a) Scientific notation
(b) Boolean values
(c) String format
(d) ASCII code
Answer: (a) Scientific notation
68. A complex number in Python is written as:
(a) 3 + j2
(b) 3 + 2j
(c) j(3+2)
(d) 3j+2
Answer: (b) 3 + 2j
69. Which one is a Boolean data value?
(a) True
(b) 10
(c) "True"
(d) j9
Answer: (a) True
70. Which group belongs to Sequence Data Types?
(a) String, Tuple, List
(b) Float, Integer, Complex
(c) True, False
(d) Set, Dictionary
Answer: (a) String, Tuple, List
71. What type of data is stored inside a Set?
(a) Ordered and indexed elements
(b) Unordered and unique elements
(c) Duplicate elements only
(d) Characters only
Answer: (b) Unordered and unique elements
72. Which of the following is not a category of Python data types?
(a) Numbers
(b) Sequence
(c) Boolean
(d) Compiler
Answer: (d) Compiler
73. Integers in Python are:
(a) Decimal values
(b) Whole numbers without decimal points
(c) Only positive values
(d) Used only for math functions
Answer: (b) Whole numbers without decimal points
74. The range of an integer in Python is:
(a) 0 to 100
(b) -255 to 255
(c) -2147483648 to 2147483647
(d) No range limit
Answer: (c) -2147483648 to 2147483647
75. Which data type represents decimal values in Python?
(a) Integer
(b) Float
(c) Boolean
(d) Set
Answer: (b) Float
76. Which of the following is a valid floating-point literal?
(a) 12
(b) 3.14
(c) 2E3
(d) Both (b) and (c)
Answer: (d) Both (b) and (c)
77. Data types in Python are used to:
(a) Change variable names
(b) Define the type of value a variable can store
(c) Run the program faster
(d) Remove errors from code
Answer: (b) Define the type of value a variable can store
78. A complex number in Python is written in the form:
(a) a bj +
(b) a + bj
(c) abj
(d) j + ab
Answer: (b) a + bj
79. In a complex number a + bj, "a" and "b" represent:
(a) a = imaginary, b = real
(b) Both are imaginary
(c) a = real, b = imaginary
(d) None of the above
Answer: (c) a = real, b = imaginary
80. A set in Python is:
(a) Ordered collection with duplicates
(b) Unordered collection with unique elements
(c) Indexed and ordered
(d) A type of Boolean value
Answer: (b) Unordered collection with unique elements
81. Which of the following is mutable in Python?
(a) Tuple
(b) String
(c) Set
(d) Boolean
Answer: (c) Set
82. A sequence in Python represents:
(a) Random data items
(b) Ordered collection of items
(c) Single numeric value
(d) None of these
Answer: (b) Ordered collection of items
83. Which of the following is a sequence data type?
(a) Integer
(b) String
(c) Boolean
(d) Set
Answer: (b) String
84. Which of the following is a valid string?
(a) "Hello"
(b) 'Python'
(c) '''Welcome'''
(d) All of these
Answer: (d) All of these
85. Lists in Python are enclosed within:
(a) { }
(b) [ ]
(c) ( )
(d) " "
Answer: (b) [ ]
86. Tuples in Python are enclosed using:
(a) [ ]
(b) ( )
(c) { }
(d) " "
Answer: (b) ( )
87. Which data type is immutable (cannot be changed)?
(a) List
(b) Tuple
(c) Set
(d) Dictionary
Answer: (b) Tuple
88. Which statement correctly describes a difference between List and Tuple?
(a) Lists are immutable, tuples are mutable
(b) Lists are mutable, tuples are immutable
(c) Both are immutable
(d) Both are mutable
Answer: (b) Lists are mutable, tuples are immutable
89. Boolean data type in Python stores:
(a) Numbers only
(b) "Yes" and "No"
(c) True or False values
(d) Decimal numbers
Answer: (c) True or False values
90. A True statement in Python returns:
(a) 0
(b) 1
(c) -1
(d) None
Answer: (b) 1
91. Which function is used to check the data type of a variable?
(a) datatype()
(b) typeof()
(c) type()
(d) dtype()
Answer: (c) type()
92. What will be the output of type("Hello")?
(a) <class 'string'>
(b) <class 'str'>
(c) string
(d) "Hello"
Answer: (b) <class 'str'>