Python Exam Review Flashcards
If an object’s reference count is 0, memory for that object is deallocated and marked for garbage collection. True of False
True
All of the are true of variable in python, except
Constructed of a name and value
Considered a data container
Declare their variable type before assigning a value or object
Used for easy reference in computations
Declare the variable type before assigning a value or object
The input function returns an object of what data type?
string
What is the preferred method for string formatting in python 3.6+?
f string
Converting a variable to a different type is NOT called type casting. True or False
False
What is the comparison operator to see if two objects are explicitly equal?
==
In python, (2**3) evaluates to?
6
8
6.0
8.0
8
In python, (18 % 7) evaluates to?
2.57
4.0
2
4
4
In python, (18//7) evaluates to?
4
4.0
2
2.0
2
If we give XOR True and True, it will return?
False
Taking a subsection of a string or list is called “slicing” True of False
True
Which is not the conditions in python?
-Usually use boolean values to evaluate conditions
- The final else is typed with explicit condition
- You can use as many conditions as you want
- Start with an if, end with an else, and elif every condition in between
The final else is typed with explicit condition
What is the only mathematical operator we can use on two strings?
+ plus sign
What is the only mathematical operator we can do on a string and an int?
+
-
*
/
- multipication
Which advance data structures have we not discussed?
Dictionary
Tuple
List
Queue
Queue
The inputs to a string or list slice are start, stop, step respectively True or False
True
What data type do we index on an int?
Dictionary
tuple
list
queue
List
What type of data do we index on a string?
dictionary
tuple
list
queue
dictionary
With list, we use del to delete an item based on value, and we use the.remove method to remove an item based on index
True or False
False
What variable type is var, if we assign var = “Hello World”
string
dictionary
list
tuple
Tuple
What is regarded as the lowest level source code?
Python
C#
Java
Machine Code
Machine Code
What is the default implementation type of python that we get from python.org
Cypthon
Jython
IronPyton
Phyton2
Cypthon
Python is best at low level programming?
True or False
False
In Pycharm, what do you usually configure for every new project?
Theme
Font
Interpreter
Enable zoom with mouse wheel
Interpreter
What is not a primitive data type in python?
string
integer
boolean
character
character
Complied languages are faster as first, but get slower with each thereafter
True or False
False
When comparing python3 with python2, which is not true of python3?
Formally replaced python2 in early 2020
Strings are stored as ASCII characters by default
Uses print(“hello”) instead of print “hello”
int / int = float, not rounded to a whole number (int)
Strings are stored as ASCII characters by default
Which of these is not and IDE we mentioned?
PyCharm
IntelliJ IDEA
Visual Studio Code
C#