1/145
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
Data types
Categories of data that determine the type of value a variable can hold, including int, float, string, and bool.
Basic math operations
Fundamental arithmetic operations including addition (+), subtraction (-), multiplication (*), division (/), floor division (//), and modulus (%) in programming.
User input
Data that is provided by the user to the program during execution.
Conditional statements
Statements that execute different actions based on whether a specified condition evaluates to true or false, including if, elif, and else.
Try-Except
A block of code used to handle exceptions or errors that may occur during the execution of a program.
F-string
A string formatting method in Python that allows embedding expressions inside string literals, prefixed with 'f'.
List
A collection data type in Python that is ordered and mutable.
List methods
Functions that can be applied to lists, such as append(), remove(), and sort().
While / For loop
Control flow statements that allow code to be executed repeatedly based on a condition (while) or iterating over a sequence (for).
Break/ continue/ pass
Control statements used within loops; break exits the loop, continue skips to the next iteration, and pass does nothing.
Nested loop
A loop inside another loop, allowing for more complex iterations.
Functions
Reusable blocks of code that perform a specific task, can be built-in or user-defined.
Parameters & argument
Parameters are variables in a function definition, while arguments are the actual values passed to the function.
Scope (LEGB rule)
The rule that defines the order of variable scope resolution: Local, Enclosing, Global, Built-in.
Dictionary
A mutable, unordered collection of key-value pairs in Python.
Tuples
An immutable sequence type in Python.
Sets
An unordered collection of unique elements in Python.
Frozensets
An immutable version of a set in Python.
Class & Object
Class is a blueprint for creating objects, which are instances of classes.
Attributes & Methods
Attributes are variables that belong to a class, while methods are functions defined within a class.
Constructors (Initialization Methods)
Special methods in a class that are called when an object is instantiated.
Getters and Setters
Methods used to access and modify the attributes of a class.
Inheritance
A mechanism in object-oriented programming where a new class can inherit attributes and methods from an existing class.
Garbage collector
A system that automatically manages memory by reclaiming memory occupied by objects that are no longer in use.
Syntax error
An error that occurs when the code does not conform to the rules of the programming language.
Logical error
An error that produces incorrect results but does not crash the program.
Data type
A classification that specifies which type of value a variable can hold.
Identifier
A name used to identify a variable, function, class, or other object.
String
A data type that can contain a combination of numbers, letters, and symbols.
Variable
A location in memory used to store data that can later be altered.
Assignment operator
The symbol used in Python to assign values to a variable, which is '='.
String concatenation
A method that combines two or more string values.
input() function
A built-in function that processes and stores user input data as a string.
Conversion of float to integer
When converting a float to an integer, fractional values are truncated, not rounded.
Try Except Block
A block of code used for handling exceptions in Python.
if statements
Statements used to evaluate single or multiple-alternative decisions.
What operator for conditional statements
Comparison (>,<, =), Membership (in, not in), Logical (and), and Boolean (True/False) are used in conditional statements.
Logical operator
Operators used to evaluate conditions, such as AND, OR, and NOT.
Membership Operators
Used for checking if a given object does or does not contain a specific value.
elif Statements
Useful for checking multiple condition statements, one after the other, as part of the same decision structure.
Data Collection
Useful for storing multiple elements within a single container.
Nested List
A list embedded in a list.
While Loops
Indefinite loop structures.
For Loops
Definite loop structures.
Continue Statement
Jumps to the 'top' of the loop and starts the next iteration.
Break Statement
Exits the currently executing loop.
Pass Statement
Useful for testing and working through the logic of code, without having written code statements in the loop.
List Loop
A loop that is used to iterate over the items contained within a list.
Function Call Statement
A statement that calls a function without a syntax error.
Intermediate Variable
A variable used to store temporary values during calculations.
Python Variable Name
An identifier used to name a variable in Python.
Boolean Operators
Operators used to evaluate conditional statements.
Logical Operators
Operators that determine the logic of expressions.
Immutable List
A list that cannot be modified after it is created.
Garbage Collection
The process of automatically freeing memory by removing objects that are no longer in use.
Data Type Checking
The process of verifying the type of data stored in a variable.
User Input Handling
The process of managing data entered by users.
number
e.g., 1
quotes
e.g., " "
Which of the following is the most appropriate data type to store a circle's radius?
Which of the following is the most appropriate data type to store a zipcode?
What will be the output of the code below, assuming the user enters 10 and 8?
10, 8, 18, 80, 108, None of the above
Question 45
What will be the output of the code below? 0, 1, 2, 3, None of the above
Question 46
What will be the output of the code below? hun, m hu, h, hun, hu, None of the above
Question 47
Which of the following expressions evaluates to True? 10 < 5 * 2, 3 = 3, 7!=7, 5>=2, None of the above
Question 48
What will the following code print? Success, Error, None of the above
Question 49
What will the following code print in the LAST line of the output? Valid, Invalid, None of the above
Question 50
What will the following code print? Condition Met, Condition Not Met, Error, Nothing will be printed
Question 51
What will the following code print? High Ration, Medium, Low, Error (zero division), Nothing will be printed
Question 52
What will the following code print? Checking... Cannot divide by zero, Cannot divide by zero, Checking... Division successful, Cannot divide by zero, None of the above
Question 53
What will the following code print? numbers = [0, 5, 10, 0, 15] index = 0 total = 0 count = 0 while index < len(numbers): if numbers[index] != 0: total += numbers[index] count += 1 index += 1 mean = total / count while index < len(numbers): if numbers[index] == 0: numbers[index] = mean index += 1 print("Updated list:", numbers) Updated list: [0, 5, 10, 0, 15], Updated list: [10.0, 5, 10, 10.0, 15], Updated list: [10.0, 5, 10.0, 10.0, 15], None of the above
Question 54
What will the following code print? Suppose the user enters "N" and then "Y" response1 = input("Are you off campus? (y/n): ") if response1 == "y": print("Go to Putter's") else: response2 = input("Are you near the Biz School Building? (y/n)") if response2 == "y": print("Go to Einstein!") else: print("Go to Reynolda!") Go to Putter's, Go to Einstein!, Go to Reynolda!, None of the above
Question 55
What will the following code print? Suppose the user enters "N" and then "Y" messy_text = "_ Welcome to python programming! _" clean_text = messy_text.strip() print(clean_text) _ Welcome to python programming! _, _Welcome to python programming!_, Welcome to python programming! , None of the above
Question 56
What method type provides a secure way for code outside a class to retrieve the values of attributes, without exposing the attributes in a way that could allow them to be changed by code outside the method? accessor, mutator, setter, class
Question 57
A value-returning function is described as: a single statement that performs a specific task, called when you want the function to stop, a function that will return a value back to the part of the program that called it, a function that receives a value when called
Question 58
Methods written to change attribute values are known as: getter, setter, instances, constructors
Question 59
What will be the value of the variable list2 after the following code executes? [1, 2, 3], [4, 5, 6], [1, 2, 3, 4, 5, 6], Nothing; this code is invalid
Question 60
When there are several classes that have many common data attributes, it is better to write a(n) __________ to hold all the general data. superclass, subclass, object, method, class attributes
Question 61
Data and code combined into a single object is known as: modularity, instantiation, encapsulation, objectification
Question 62
What does a subclass inherit from a superclass? instances and attributes, objects and methods, methods and instances, attributes and methods
Question 63
Which of the following is the correct syntax for defining a class, dog, which inherits from the animal class?
Worker class object creation
To create an object, worker_joey, of the Worker class, use: worker_joey = Worker()
Dictionary display order
The order of the display of entries in a dictionary are not in a specific order.
Function call values
Arguments are the values that are sent to a function when it is called.
Tuple vs List
Once a tuple is created, it cannot be changed.
Dictionary key
In a dictionary, you use a key to locate a specific value.
Python function return
You can return data collections.
Sets characteristics
The elements are in pairs does not apply to sets.
Tuple advantage
Tuples can be used for storing static unchanging values.
Range function output
The output of range(0, 20, 5) is 0, 5, 10, 15.
Code block average calculation
It accepts 3 test scores for each of 3 students and outputs the average for each student.
Avoiding global variables
By convention programmers should avoid using global variables in programs if possible.
Code execution output
The resulting output after the code execution is 81.
Code execution output with syntax error
The statement contains a syntax error.
Code execution output with names
The resulting output after the code execution is Julian, Smith.
Concept of abstraction
Hiding unnecessary details and complexity from the user best describes the concept of abstraction.
Self in Python methods
Self is typically used to refer to the instance in which the method is being called.
Class extension access
In order to extend a class, a new class should have access to all the data and inner workings of the parent class.
User-defined functions
A variable created within a function can only be accessed inside that function.
Code output question
What will be the output of the following code?