Python Programming - Data Types
Exercise : Data Types - General Questions
- Data Types - General Questions
26.
Which of the following data types is used to represent a sequence of Unicode characters that cannot be modified?
Answer: Option
Explanation:
The
str
data type is used to represent a sequence of Unicode characters that cannot be modified. It is immutable.
27.
What is the correct way to declare a variable?
Answer: Option
Explanation:
In Python, variables can be declared simply by assigning a value to them. No explicit type declaration is needed.
28.
What is the correct way to comment a single-line?
Answer: Option
Explanation:
In Python, single-line comments are made using the '#' symbol.
29.
Which of the following is a valid Python string?
Answer: Option
Explanation:
Both single and double quotes are valid for creating strings, but they must be matched properly.
30.
What is the purpose of the
len()
function?
Answer: Option
Explanation:
The
len()
function is used to determine the number of elements in a string, list, or any other iterable object.
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers