WorksheetsPython U II_AIDS
Total questions: 20
Worksheet time: 10mins
Python provides two basic modes of operation for executing programs. What are they?
Interpreter mode and Interactive mode
Script mode and Command mode
Interactive mode and Command mode
Interpreter mode and Command mode
What is the file extension used for Python scripts in Interpreter mode?
.txt
.py
.exe
.script
Which mode allows the user to work directly with the Python interpreter from the command line and is used to test small pieces of code quickly?
Interpreter mode
Interactive mode
Script mode
Command mode
In Interactive mode, what prompt does Python display for the user to type a command or expression?
>>>
$$
--
::
Which mode is suitable for short code testing or debugging?
Interpreter Mode
Interactive Mode
Both
None
Which type of error occurs before execution and is caused by violation of Python syntax rules?
Syntax Error
Logical Error
Runtime Error
Which type of error in Python gives wrong output due to faulty logic?
Syntax Error
Logical Error
Runtime Error
Which type of error occurs during execution and is caused by division by zero?
Syntax Error
Logical Error
Runtime Error
Which of the following is NOT a built-in data type in Python?
Numbers
String
Array
Tuple
Fill in the blank: Floating point numbers are written with a ________ or in scientific notation.
decimal point
comma
hyphen
colon
Which of the following is a valid string in Python?
0x77
'HELLO'
3.17
5 + 14j
Fill in the blank: Lists in Python are enclosed in ________ brackets.
square
curly
round
angle
Which of the following is an example of a list in Python?
[1, 2, 3]
'HELLO'
3.0
0b101
The elements in a Python list can be changed.
True
False
Which of the following statements about tuples in Python is correct?
Tuples are mutable and can be changed after creation.
Tuples are similar to lists but are immutable.
Tuples are enclosed in square brackets [].
Tuples can only contain numbers.
Fill in the blank: Tuples in Python are enclosed in ___________.
parentheses ( )
curly braces { }
square brackets [ ]
angle brackets < >
Fill in the blank: Sets in Python are defined using ___________.
curly braces {}
square brackets []
parentheses ()
angle brackets <>
What will be the output of the following code? 2 < 3
True
False
None
Error
Comments in a Python program are executable statements and are included using which of the following methods?
No, comments are not executable and are included using the # symbol.
Yes, comments are executable and are included using the // symbol.
No, comments are not executable and are included using the /* */ symbols.
Yes, comments are executable and are included using the symbols.
The type() function in Python is used to determine the type of an object. For example, type(5) returns
It determines the type of an object.
It converts a string to an integer.
It prints the value of a variable.
It creates a new variable.
