1/106
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced | Call with Kai |
|---|
No analytics yet
Send a link to your students to track their progress
An interactive platform where you can write code, add text, and create visualizations.
Jupyter Notebook
The name "Jupyter" is a loose acronym originally referring to these three programming languages.
Julia, Python, R
True or False:
In addition to Julia, Python, and R, Jupyter now supports languages such as Ruby, Haskell, Scala, and Go.
True
Jupyter Notebook can be accessed through this tool or directly by launching the Jupyter application.
Anaconda Navigator
The first page that appears when Jupyter Notebook opens in a browser is called the…
Landing page
By default, the type of a Jupyter Notebook cell used for typing code is called…
Code cell
In Jupyter Notebook, pressing Shift+Enter on a code cell will…
Execute the code and create a new code cell
In Jupyter Notebook, pressing Ctrl+Enter (Windows) or Cmd+Enter (Mac) will…
Execute the code without creating a new cell
In a code cell, you can write explanations about your code using…
Comments (preceded by #)
If you want to write headings, subheadings, or long text in a notebook, you should use…
Markdown cell
In Jupyter Notebook, you can change a cell type from the dropdown menu located under…
Widgets tab
To give a notebook a custom name, you should click on…
The text that says ‘Untitled’
The default file extension for a Jupyter Notebook is…
.ipynb
In Python, everything such as numbers, strings, functions, classes, and modules exists as…
Objects
A value associated with an object and defined within its class is called…
Attribute
A function associated with an object, which can access the object's attributes, is called…
Method
For a variable var = 2, which of the following are its attributes in Python?
real and imag
In Python, to see all attributes and methods associated with an object obj, you can…
Type obj. and press Tab
In Python, a class defines…
The blueprint for objects
In Python OOP, the relationship between attributes, methods, and objects is defined in the…
Class
In Python, when a variable is assigned an object, the variable acts as a…
Reference to the object
The Python system that handles variable assignments and object references is called…
Call by Object Reference
After executing y.append(4) when y = x and x = [5,3], the value of x is…
[5,3,4]
The behavior where multiple variable names point to the same object and changes via one variable affect the others is called…
Call by reference
In Python, lists and most mutable objects demonstrate this assignment behavior.
Call by Object Reference
When a new variable is assigned an existing object, the object is…
Not copied, just referenced
To create a completely independent copy of a list instead of referencing the same object, you would use…
list.copy() or slicing
In Python, multiple variables can be assigned values in a single statement by separating variable names and values with…
Commas
Example of assigning multiple values to multiple variables in one line:
color1, color2, color3 = "red", "green", "blue"
The same value can be assigned to multiple variables in a single statement using…
Chained assignment
Example of assigning the same value to multiple variables at once:
x = y = z = 10
Multiple assignment in Python helps to…
Reduce code lines and initialize several variables at once
A valid Python variable name must start with…
A letter or underscore (_)
Which of the following characters are allowed in Python variable names?
Letters, digits, and underscores
Python variable names are…
Case-sensitive
Which of the following is a valid variable name in Python?
my_favorite_car
Assigning a value to a variable = 23 in Python will produce…
Syntax error
The term that refers to the rules governing the structure of valid statements in a programming language is called…
Syntax
Which of the following variable names is invalid in Python?
3_musketeers
In Python, a variable is created when a value is assigned to it, without explicitly defining its type. This behavior is called…
Dynamically typed
To find the data type of a Python variable, which built-in function is used?
type()
The type of the variable a_variable = 23 is…
int
The type of the variable is_today_Saturday = False is…
bool
The type of the variable my_favorite_car = 'Delorean'
str
The type of the variable the_3_musketeers = ['Athos', 'Porthos', 'Aramis'] is…
list
Primitive data types in Python represent a single value. Which of the following are primitive data types?
Integer, float, boolean, None, string
Data types that can hold multiple pieces of data together, like list, tuple, and dictionary, are called…
Containers
The type of 4.4 in Python is…
float
The type of '4' in Python is…
str
Functions in Python that are available without importing any library or module are called…
Built-in functions
The extensive collection of standard modules and scripts available in Python is called…
Python Standard Library
The Python function range() is commonly used to…
Generate a sequence of evenly spaced integers
Example of using range() to create numbers from 1 to 9:
list(range(1,10))
The Python module used for handling date and time objects is…
datetime
To create a datetime object representing September 20, 2022, at 11:30:00, you can use…
dt.datetime(2022, 9, 20, 11, 30, 0)
The day of a datetime object dt_object can be accessed using…
dt_object.day
The year of a datetime object dt_object can be accessed using…
dt_object.year
The strftime method in Python’s datetime module is used to…
Format a datetime object as a string
Example of formatting a datetime object as '09/20/2022' is…
dt_object.strftime('%m/%d/%Y')
Example of formatting a datetime object as '09/20/22 11:30' is…
dt_object.strftime('%m/%d/%y %H:%M')
Functions like print(), abs(), max(), and sum() are available in Python…
Without importing any library
The Python library primarily used for numerical computing with arrays and matrices is…
NumPy
Which library provides DataFrame and Series data structures for data manipulation?
Pandas
Python libraries commonly used for data visualization include…
Matplotlib and Seaborn
The Python library used for scientific computing such as solving differential equations and optimization is…
SciPy
The Python library primarily used for machine learning tasks like classification, regression, and clustering is…
Scikit-learn
Statsmodels in Python is mainly used for…
Statistical modeling and inference
To import an entire library and give it a shorter alias, you can use…
import numpy as np
To import only specific functions or classes from a library, you can use…
from random import randint
After importing a library with an alias (e.g., import numpy as np), functions from that library are accessed using…
np. prefix
A reusable set of instructions in Python that takes inputs, performs operations, and often returns an output is called…
Function
Functions provided by Python’s standard library or external libraries are called…
Pre-defined functions
Functions that are created by the programmer to perform specific tasks are called…
User-defined functions
The keyword used to define a function in Python is…
def
Pre-defined functions are not sufficient when…
You need to perform a specific task not covered by existing functions
In Python function syntax, which of the following are essential after the function name?
Parentheses () and colon :
The statements inside a Python function are executed when…
The function is called
A function that takes an input parameter and uses it in the body is defined as:
def say_hello_to(name):
Trying to access a local variable outside its function will result in…
NameError
Global variables in Python are…
Declared outside a function and accessible inside and outside functions
Invoking a function with specific parameter names to improve clarity is called…
Using named arguments
In Python, a function argument that can be omitted in a function call and uses a default value if not provided is called…
Optional argument
In Python, *args is used to pass…
A variable number of non-keyword arguments
In Python, **kwargs is used to pass…
A variable number of keyword arguments
The special symbols used for passing an unknown number of arguments to a function are…
*args and **kwargs
In Python, the statement used to execute a block of code only if a condition is True is…
if
The else statement in Python is executed when…
The if condition evaluates to False
The elif statement in Python is used to…
Check multiple conditions in sequence
In an if-elif-else chain, how many blocks are executed?
At most one
Indentation in Python is used to…
Define the scope of code blocks
Which of the following values is considered “falsy” in Python?
0
Which of the following values is considered “truthy” in Python?
[1, 2, 3]
Python allows conditions that are not strictly boolean. Such conditions are automatically converted using…
bool()
The pass statement in Python is used to…
Do nothing in a block when a statement is syntactically required
A Python loop that executes a block of code repeatedly as long as a condition is True is called…
while loop
Which statement is not required in a while loop but commonly used to avoid infinite loops?
Updating a loop variable
A loop in Python that never ends because its condition always evaluates to True is called…
Infinite loop
How can you stop an infinite loop in Jupyter Notebook?
Press the Stop button or select Kernel > Interrupt
The break statement in Python is used to…
Immediately exit the loop
The continue statement in Python is used to…
Skip the current iteration and move to the next