Which of the following data types is used to represent a sequence of elements that can be modified?
A:
List
B:
Tuple
C:
Set
D:
String
Answer:A
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.
Discuss About this Question.
Which of the following data types is used to represent a sequence of elements in no particular order?
A:
List
B:
Tuple
C:
Set
D:
None of the above
Answer:C
Sets are used to represent a sequence of elements in no particular order, with no duplicates allowed.
Discuss About this Question.
Which of the following data types is used to represent a boolean value?
A:
int
B:
float
C:
bool
D:
complex
Answer:C
The bool data type in Python is used to represent boolean values, which can be either True or False.
Discuss About this Question.
Which of the following data types is used to represent a single character?
A:
int
B:
bytes
C:
complex
D:
str
Answer:D
In Python, a single character is represented as a string of length 1. For example, the string "a" represents the character 'a'.
Discuss About this Question.
Which of the following is not a valid string method?
A:
split()
B:
join()
C:
append()
D:
upper()
Answer:C
While lists have an append() method, strings do not. The split(), join(), and upper() methods are all valid string methods in Python.
Discuss About this Question.
Ad Slot (Above Pagination)
Install ExamAdept
Fast access — add this app to your device.
To install on iPhone/iPad: tap Share → Add to Home Screen.
Discuss About this Question.