python Unit 1
45 flashcards · Programming Languages · by Sikkandharbatcha J
Which Python mode allows you to execute code line by line immediately? A) Interactive mode B) Script mode C) Batch mode D) Compile mode
Interactive mode
Which Python mode is used to execute an entire file of code? A) Script mode B) Interactive mode C) Debug mode D) Live mode
Script mode
What is the main feature of Python's interactive mode? A) Immediate execution of commands B) It compiles programs C) It runs only .py files D) It is faster than script mode
Immediate execution of commands
In script mode, code is generally written and saved in which type of file? A) Saved in .py file B) .txt C) .docx D) .exe
Saved in .py file
What prompt symbol is shown in Python interactive mode? A) >>> prompt B) $$ C) ?? D) ::
>>> prompt
Which of the following is a popular Python IDE? A) PyCharm B) MS Word C) Photoshop D) Notepad
PyCharm
Which IDE comes bundled with Python? A) IDLE B) Eclipse C) NetBeans D) Jupyter
IDLE
Which Python IDE is most used for data science and visualization? A) Jupyter Notebook B) Turbo C C) NetBeans D) Atom
Jupyter Notebook
Which code editor is widely used for Python and supports extensions? A) Visual Studio Code B) MS Excel C) Google Docs D) Outlook
Visual Studio Code
What does IDE stand for? A) Integrated Development Environment B) Internal Data Editor C) Integrated Data Executor D) Internet Development Engine
Integrated Development Environment
Which data type is used to represent whole numbers in Python? A) int B) float C) str D) list
int
Which data type is used to represent decimal numbers? A) float B) int C) bool D) tuple
float
Which data type is used to represent text in Python? A) str B) list C) dict D) tuple
str
Which data type is ordered, mutable, and allows duplicates? A) list B) tuple C) set D) dict
list
Which data type is ordered, immutable, and allows duplicates? A) tuple B) list C) set D) dict
tuple
Which data type is unordered, mutable, and does not allow duplicates? A) set B) list C) tuple D) str
set
Which data type stores key-value pairs? A) dict B) list C) tuple D) set
dict
What is the output of bool(5)? A) True B) False C) 0 D) Error
True
Which data type is used to represent numbers with real and imaginary parts? A) complex B) float C) set D) dict
complex
Lists in Python are? A) mutable B) immutable C) constant D) static
mutable
Which operator is used for assignment in Python? A) = B) == C) === D) <-
=
Which operator is used for addition in Python? A) + B) & C) % D) //
+
Which operator checks equality between two values? A) == B) = C) != D) is
Which logical operator returns True if both conditions are True? A) and B) or C) not D) xor
and
Which logical operator returns True if at least one condition is True? A) or B) and C) not D) is
or
Which logical operator negates a condition? A) not B) and C) or D) xor
not
Which bitwise operator performs AND operation? A) & B) | C) ^ D) ~
&
Which bitwise operator performs OR operation? A) | B) & C) not D) xor
|
Which operator is used to check membership in lists, tuples, or sets? A) in B) is C) == D) ===
in
Which operator checks object identity? A) is B) in C) == D) !=
is
Which function is used to read input from the user? A) input() B) print() C) read() D) scan()
input()
Which function is used to display output to the console? A) print() B) input() C) echo() D) display()
print()
Which parameter in print() is used to specify separator between values? A) sep B) end C) split D) join
sep
Which parameter in print() is used to specify what is printed at the end? A) end B) sep C) close D) finish
end
Which format specifier is used for integers? A) %d B) %f C) %s D) %c
%d
Which format specifier is used for floating-point numbers? A) %f B) %d C) %s D) %x
%f
Which format specifier is used for strings? A) %s B) %d C) %f D) %c
%s
Which function converts a string to an integer? A) int B) str C) float D) eval
int
Which function converts a string to a floating-point number? A) float B) int C) str D) ord
float
Which function converts a number to a string? A) str B) int C) float D) chr
str
What is the output type of split() method in Python? A) list B) tuple C) set D) dict
list
Which data type is created using curly braces with key-value pairs? A) dictionary B) set C) list D) tuple
dictionary
What is the index of the first element in a Python list? A) 0 B) 1 C) -1 D) None
Which function is used to find the number of items in a list? A) len() B) count() C) size() D) length()
len()
Which function generates a sequence of numbers? A) range() B) list() C) tuple() D) map()
range()