Python Programming - Data Types

Exercise : Data Types - General Questions
  • Data Types - General Questions
11.
Which of the following is not a valid string method?
split()
join()
append()
upper()
Answer: Option
Explanation:
While lists have an append() method, strings do not. The split(), join(), and upper() methods are all valid string methods in Python.

12.
Which of the following data types is used to represent a single character?
int
bytes
complex
str
Answer: Option
Explanation:
In Python, a single character is represented as a string of length 1. For example, the string "a" represents the character 'a'.

13.
Which of the following data types is used to represent a boolean value?
int
float
bool
complex
Answer: Option
Explanation:
The bool data type in Python is used to represent boolean values, which can be either True or False.

14.
Which of the following data types is used to represent a sequence of elements in no particular order?
List
Tuple
Set
None of the above
Answer: Option
Explanation:
Sets are used to represent a sequence of elements in no particular order, with no duplicates allowed.

15.
Which of the following data types is used to represent a sequence of elements that can be modified?
List
Tuple
Set
String
Answer: Option
Explanation:
Lists are used to represent a sequence of elements that can be modified, such as adding or removing elements. Tuples and strings are immutable, while sets do not maintain the order of their elements.