str literals in Python can be surrounded in either single-quote characters ('like this')
n n n n n n n n n n n n
or double-quote characters ("like this"), though in COMP110 we prefer the double-
n n n n n n n n n n n n
quotes. (T/F) - correct answer- True
n n nn n n
TRUE and FALSE are valid bool values in Python. (T/F) - correct answer- False
n n n n n n n n n n nn n n
An int literal can begin with a zero, but cannot end with a zero. (T/F) - correct
n n n n n n n n n n n n n n n nn
answer- False
n n
What function can we use to identify the type classification of any object in Python? -
n n n n n n n n n n n n n n n
correct answer- type( )
nn n n n
Every if statement must be followed by a paired else branch. (T/F) - correct answer-
n n n n n n n n n n n n nn n
False
n
Lines contained in an else branch in Python do not have to be indented. (T/F) -
n n n n n n n n n n n n n n n n
correct answer- False
n n n
You can name a variable else in your program without Python confusing your
n n n n n n n n n n n n
variable's name and the else keyword. (T/F) - correct answer- False
n n n n n n n n nn n n
What is the resulting value and data type of the following expression? int("20") -
n n n n n n n n n n n n n n
correct answer- 20, int
n n n n
What is the resulting value and data type of the following expression? str(2023) +
n n n n n n n n n n n n n
str(2023) - correct answer- "20232023", str
n n nn n n n
What is the resulting value of the following expression? type(9 / len( str(110)) -
n n n n n n n n n n n n n n
correct answer- <class 'float'> (Or just float is sufficient on a quiz.)
n n n n n n n n n n n n
,What is the resulting value of the following expression? "440" + "20" - correct
n n n n n n n n n n n n nn
answer- "44020"
n n
What value of x would cause the following expression to evaluate to True? (3 + x) ==
n n n n n n n n n n n n n n n n
(55 % 2 ** 4) - correct answer- 4
n n n n n n nn n n
What value does the following expression result in, and what is its type? 2 + **
n n n n n n n n n n n n n n n n n n
(2 * 0) - correct answer- 4.0
n n n n nn n n
Using subscription syntax and concatenation, write an expression that evaluates to
n n n n n n n n n n
"tar" using the following string: "Saturday". - correct answer- Option 1: "Saturday"[2]
n n n n n n n nn n n n n
+ "Saturday"[1] + "Saturday"[4] / Option 2: "Saturday"[2] + "Saturday"[6] +
n n n n n n n n n n n
"Saturday"[4]
n
What data type do expressions with relational operators typically evaluate to? -
n n n n n n n n n n n n
correct answer- bool
n n n
What does the following expression evaluate to? int("10" + "40") > 100 * 2 - correct
n n n n n n n n n n n n n n nn
answer- True
n n
Global variables are limited to the scope of the function they are declared in. (T/F) -
n n n n n n n n n n n n n n n n
correct answer- False
n n n
Variables can have the same name but store different values if they are defined in a
n n n n n n n n n n n n n n n
different scope. (T/F) - correct answer- True
n n n n nn n n
Named constants should be used to store values that may change throughout the
n n n n n n n n n n n n
program. (T/F) - correct answer- False
n n n nn n n
When using a for...in loop, on the first line of the loop you must specify the type of
n n n n n n n n n n n n n n n n n
the variable (variable refers to i in for i in nums). (T/F) - correct answer- False
n n n n n n n n n n n n n nn n n
In Python dictionaries, each dictionary's value type must match its key type. (T/F) -
n n n n n n n n n n n n n n
ncorrect answer- False n n
Writing a for...in loop on a dict loops through the keys of a dictionary. (T/F) - correct
n n n n n n n n n n n n n n n nn
answer- True
n n
The values in a dictionary cannot be changed once they are assigned. (T/F) -
n n n n n n n n n n n n n n
correct answer- False
n n n
Explain the similarities and differences between Python's list and dict. - correct
n n n n n n n n n n nn
answer- Similarities:
n n n
Both are collections that can be looped through using a for...in loop, reference types
n n n n n n n n n n n n n
that live on the heap, mutable, can duplicate values, subscription notation to access
n n n n n n n n n n n n n
values, .pop()to remove items
n n n n
Differences: n
, - list - Index by increasing integers, add items with .append(), ordered, for...in loop
n n n n n n n n n n n n n
ngives items n
- dict - Matched Key-Value pairs, pair with assignment operator = (dict_name[key] =
n n n n n n n n n n n n
nvalue), control over key type (not limited to int), for...in gives keys
n n n n n n n n n n n
A class definition provides a pattern for creating objects, but doesn't make any
n n n n n n n n n n n n
objects itself. (T/F) - correct answer- True
n n n n nn n n
By convention, Python class names start with a lowercase letter. (T/F) - correct
n n n n n n n n n n n nn
answer- False
n n
When you define a method in a class, all objects of that class have that method
n n n n n n n n n n n n n n n
associated with it. (T/F) - correct answer- True
n n n n n nn n n
The first parameter of a method is a copy of the object the method is called on. (T/F)
n n n n n n n n n n n n n n n n n
- correct answer- False
n nn n n
A class definition must come before an object of that class is instantiated. (T/F) -
n n n n n n n n n n n n n n n
correct answer- True
n n n
You must have an instance of a class (an object) to call the class's constructor. (T/F)
n n n n n n n n n n n n n n n
- correct answer- False
n nn n n
Constructors must have the self parameter in their signature. (T/F) - correct answer-
n n n n n n n n n n nn n
True
n
Constructors must take at least one parameter other than the self parameter. (T/F) -
n n n n n n n n n n n n n n
correct answer- False
n n n
Objects are passed into functions by reference. (T/F) - correct answer- True
n n n n n n n n nn n n
The type of an object is the same as the name of the class it is an instance of. (T/F) -
n n n n n n n n n n n n n n n n n n n n
correct answer- True
nn n n
What is computational thinking? - correct answer- Strategic thought and problem-
n n n n nn n n n n n
solving; Can help perform a task better, faster, cheaper, etc.
n n n n n n n n n
What is an algorithm? - correct answer- A set of steps to solve a general problem.
n n n n nn n n n n n n n n n n
What is pseudocode? - correct answer- Simple and readable version of algorithm
n n n nn n n n n n n n
that resembles code.
n n n
What is a conditional statement? - correct answer- A statement that only performs
n n n n n nn n n n n n n
an action under certain conditions.
n n n n n
What is an assignment operator? - correct answer- Assigns a variable some value.
n n n n n nn n n n n n n
What is an "Iteration"? - correct answer- One pass through a while loop; often "i" or
n n n n nn n n n n n n n n n n
"idx"
n
The benefits of buying summaries with Stuvia:
Guaranteed quality through customer reviews
Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.
Quick and easy check-out
You can quickly pay through credit card or Stuvia-credit for the summaries. There is no membership needed.
Focus on what matters
Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!
Frequently asked questions
What do I get when I buy this document?
You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.
Satisfaction guarantee: how does it work?
Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.
Who am I buying these notes from?
Stuvia is a marketplace, so you are not buying this document from us, but from seller HIGRADES. Stuvia facilitates payment to the seller.
Will I be stuck with a subscription?
No, you only buy these notes for $12.99. You're not tied to anything after your purchase.