Master Deck Flashcards
How are if statements structured in Python?
if (statement):
(ONE TAB INDENT)action
In JavaScript, maps are similar to objects but allow for __________.
Any data type as the key in the key-value pairs.
In JavaScript maps, the three main functions are _____.
.set(), .has(), .delete()
What is the inequality operator in Python?
!=
How do you copy a JavaScript object without simply referencing the original object?
const person2 = {…person1};
In JavaScript, you should use a map instead of an object when you need to maintain _________.
the order of your items
In JavaScript, how do you convert an object into a JSON?
JSON.stringify(object)
Given a JSON, how do you convert it into an object in JavaScript?
JSON.parse(‘json’)
What is the ‘and’ operator in Python?
and
The _______ JavaScript library has a bevy of tools for working with objects and arrays.
Lodash
What is the ‘or’ operator in Python?
or
Given two JavaScript objects, meatInventory and veggieInventory, how would you merge them into one object called ‘inventory’?
const inventory = {…meatInventory, …veggieInventory};
How can you test whether a variable called ‘names’ is an array in JavaScript?
Array.isArray(names)
this will return either a true or a false
What is the ‘not’ operator in Python?
‘not’
The ‘…’ operator in JavaScript is called the _____ operator.
spread
Given the list:
seq = [1, 2, 3, 4, 5]
create a ‘for’ statement in Python that prints each element in the list.
for x in seq:
indent)print(x
If a pandas DataFrame named df has a column named W, how do you retrive W from df?
df[‘W’]
Given a pandas DataFrame named df that contains two columns X and Y, how do you create a third column named Z where Z = X + Y?
df[‘Z’] = df[‘X’] + df[‘Y’]
Given a DataFrame named df, how do you retrieve the value at row X, column Y?
df[‘Y’][‘X’]
What are the two methods available for collecting rows or columns from pandas DataFrames?
.loc
.iloc
In the pandas programming library, what are the two main methods for dealing with missing data?
.dropna()
.fillna()
How can DataFrames be concatenated using pandas?
pd.concat()
What method is used to return all unique values from a pandas Series?
pd.Series().unique()
On the command line, what command returns your current working directory?
pwd
In Python, what command is used to import the matplotlib charting library?
import matplotlib.pyplot as plt
What command allows you to actually see your plots within the Jupyter Notebook?
%matplotlib inline
The ______ command must be used to show a plot outside the Jupyter Notebook.
plt.show()
What command imports the pandas datareader?
import pandas_datareader.data as web
What command serves to import the Quandl library into Python?
import quandl
The _____ command fixes most matplotlib formatting errors.
plt.tight_layout()
In Python, what is a set?
An unordered collection of unique items.
Create a basic set in Python.
set = {1,2,3}
What Python command imports the math library?
import math
Given an array of integers in NumPy, how would you return an array that excludes all values below 4?
array[ array > 3]
What is the quickest way to create an array of 10 zeros in NumPy?
np.zeros(10)
What command is used to create an array of linearly spaced points in NumPy?
np.linspace()
What is the exponent library in Python?
**
In JavaScript, what is the main difference between a node list and an array?
A node list lacks many of the methods that an array has.
What text allows you to define a function in Python?
def myFunction():
What character defines the ternary operator in JavaScript?
?
When creating a function in Python, how do you set up a docstring?
Three sets of double quotations (“””)
What does D3.js stand for?
Data Drive Documents
What is a lambda expression in Python?
A function to use one time that has no name
What are the CRUD operations?
create, read, update, delete
What is an important component of a custom Python function if you plan to use it for future calculations or other functions?
the return statement
What is a React component?
a reusable piece of code for the user interface of a website
What keyword can be used to apply a function to every element of a list in JavaScript?
map
Firebase is a service provided by ________.
How do you view a function’s documentation in the Jupyter Notebook?
Shift+Tab
How do you kill an environment in Terminal?
CTRL+C
How could you transform a string to all lowercase or uppercase letters in Python?
By appending .upper() or .lower() to the string’s variable name.
In a React application, information is communicated to a component through _________.
props
How can you split a string into a list of strings? Works in both Python and JavaScript.
.split()
In a React application, JSX does not have any ______ built into it.
logic
How do you remove an item from a list in Python?
by appending .pop() and passing in the item’s index
How do you import React into a JavaScript application?
import React from ‘react’;
What is an alternative (weird) way to concatenate variable values in a string in Python?
By adding { } into the string and appending .format
In layman’s terms, what is a React component?
A reusable piece of code for your website
In Python, how can you return the length of a list named my_list?
len(my_list)
Every React component must have a _____ method.
render
What command imports the NumPy library into a Python application?
import numpy as np
In JSX, the “class” attribute is replaced by ________.
className
Given a list my_list = [1,2,3], how can you turn it into a NumPy array?
np.array(my_list)
In React, a render method can only return _____ element(s), so ______ is important.
one, nesting.
Using NumPy, how could we easily generate a 4x4 identity matrix?
np.eye(4)
To return multiple sister elements in a React render method, you should wrap them in a ___________ method.
Hoe can you access NumPy’s group of random number generators?
type ‘np.random’ then hit Tab
How do you comment in JSX?
{/* comment */}
Given a 1x25 matrix called “array” in NumPy, how could you reshape it to a 5x5 matrix?
array.reshape(5,5)
How can you include JavaScript in JSX?
By wrapping it in curly brackets
What does JSX stand for?
JavaScript XML
Given an array called ‘matrix’ in NumPy, how can you return the highest value in the array?
matrix.max()
In React props, anything other than a string requires ______________.
curly brackets
What happens when you add two arrays in NumPy?
The arrays are summed on an element-by-element basis.
In React, props are equivalent to HTML _______.
attributes
Given two arrays in NumPy named array1 and array2, what would the command array1*array2 output?
it would multiply the arrays on an element-by-element basis
How do you take the square root of every element in an array using NumPy?
np.sqrt(array)
What is a stateless functional component?
A component that receives props as input and outputs JSX.
One of the main features of jQuery is the use of _____.
The dollar sign
In JavaScript, what does IIFE stand for?
immediately invoked function expression
Tabs in Excel are equivalent to _____ in a database.
tables
One of the core principles of functional programming is ______.
To not change things
What does SQL stand for?
Structured Query Language
In functional programming, changing or altering things is called ______.
mutation
Where do we spend most of our time in pgAdmin4?
the Query Tool
Who owns Heroku?
Salesforce
What symbol runs code in pgAdmin4?
the lightning bolt
What is the JavaScript method for concatenation?
.concat()
The ____ language is case-insensitive
SQL
The _____ of a function is the number of arguments it requires.
arity
In SQL, the COUNT function does not consider _____.
NULL values
To _______ a function means to convert a function of N arity into N functions of arity 1.
curry
Given a table called “payment”, write a SQL query to count the number of rows it contains.
SELECT COUNT(*) FROM payment;
How do you make an image’s width equal to the viewport width using Bootstrap?
add the class “img-responsive” to the <img></img> tag
Every SQL query must end in _______.
A semicolon
How do you center text using Bootstrap?
class=”text-center”
Given a DataFrame named ‘banks’, how do you retrieve a list of the DataFrame’s columns?
banks.columns
____ is the most powerful and customizable visualization library for Python.
matplotlib
Given a Python list called my_list, how do you transform it into a pandas Series?
pd.Series(my_list)
What command allows you to start a Jupyter Notebook from the terminal?
jupyter notebook
In HTML, radio buttons are a type of _____
input
In a CSS stylesheet, how do you change the appearance of a link when it is hovered over?
a: hover { }
In HTML, what is the purpose of a div element?
A div element is a general purpose container for other elements
In CSS, what do the letters of hsl() stand for?
hue, saturation, lightness
The ____ element is probably the most commonly used HTML element of all.
div
How to you create an in-line comment in JavaScript?
//This is an inline comment
What HTML tag is used to communicate to a browser that you are using HTML5?
What does NaN stand for?
Not a Number
CSS class declarations start with ___
a period
Given a string in JavaScript named myString, how do you calculate its length?
myString.length
What are the three default fonts that are available in all browsers?
monospace
serif
sans-serif
What function allows you to append data to the end of a JavaScript array?
.push()
In CSS, ____ attributes should be unique.
id
In JavaScript, what is the different between .shift() and .pop()?
shift works on the first element of an array while pop works on the last element of an array
How do you return the first letter of a string in Python?
string[0]
If you want to run a function after 5 seconds in JavaScript, you would use a ____
timeout function
In JavaScript, what are object methods?
functions contained inside an object
When creating id attributes in a CSS stylesheet, they always start with ____.
#
In JavaScript, the ____ function adds an element to the beginning of an array.
unshift
In JavaScript, objects that are globally available can be called from the ____ object.
window
What is hoisting in JavaScript?
hoising allows you to access functions and variables before they have been created
In JavaScript, what are closures?
closures are the ability for a child function to access variables from a higher-level scope even after the functions have been closed
What does DOM stand for?
document object model
The DOM can be seen in the ____ tab of a browser inspector.
Elements
The characteristics of a browser window are stored in the ____ object.
window
In SQL, what do temporal data types store?
date and time related data
What does .svg stand for?
Scalable Vector Graphics
In SQL, what is the difference between the LIKE and ILIKE statements?
ILIKE is not case sensitive
What is Font Awesome?
A convenient library of icons
In SQL, what are the four aggregate functions?
MIN
MAX
AVG
SUM
In Bootstrap, the number of columns always adds to ____.
12
What is the purpose of the AS statement in SQL?
to rename a column
Given two tables A and B, what does the INNER JOIN clause do?
The INNER JOIN clause returns rows in table A that have the corresponding rows in Table Y
What does Sass stand for?
Syntactically Awesome StyleSheets
React is a open source project originally created by ____.
What is the purpose of a subquery in SQL?
A subquery allows us to use multiple SELECT statements, where we basically have a query within a query
React is an open-source JavaScript library used for ____/
building user interfaces
What is a primary key in SQL?
A primary key is a column or a group of columns that is used to identify a row uniquely in a table
React uses a syntax extension of JavaScript called ____.
JSX
How are primary keys defined?
Through primary key constraints
The transpiler ____ is a popular tool for compiling JSX code into JavaScript
Babel
How many primary keys can a SQL table have?
one and only one
How many foreign keys can a SQL table have?
multiple
What is a foreign key in SQL?
A column that references the primary key of a different table.
In Sass, a mixin is called with the ____ directive.
@include
How do you change the name of a view in SQL?
ALTER VIEW old_name RENAME TO new_name;
In JSX, every element must be ____.
closed
How do you delete a view in SQL?
DROP VIEW name_of_view;
Everything in React is a ____.
component
In React, what is state?
An object that holds data that a component and its children need.
In NumPy, what is the general layout for how to index a two-dimensional array?
array[row,col] or array[row][col]
In JavaScript functions, the return statement causes the function to ____.
stop running
When you are testing equality in JavaScrip, you should almost always use ____.
the triple equal sign
In JavaScript, the only number that is falsy is ____.
zero
After an UPDATE command is performed in SQL, what other commands can be used to return the values of specified columns?
RETURNING
One of React’s key principles is separating ____ from ____.
state logic
UI logic
What is the general syntax of the DELETE command in SQL?
DELETE FROM table_name
WHERE condition;
When using event listeners in JavaScript, what event measures the depression of a key on a physical keyboard?
keydown
JavaScript objects are similar to ____ in other languages.
dictionaries
What happens if the WHERE clauses is omitted from a DELETE statement in SQL?
The entire table is deleted! Don’t do this!
In AWS S3, files are called ____ and folders are called ____.
objects, buckets
Write a basic dictionary in Python.
dictionary = {‘key’:’value’}
How do you go up one level in the command line?
cd ..
What does the ‘ETS’ in ETS Model stand for?
Error, Trend, Seasonality
What does EWMA stand for?
Exponentially Weighted Moving Average
What is the unique characteristic of an EWMA?
It places more weight on data points that occurred more recently.
What method in pandas allows us to calculate moving averages?
.rolling()
What method in pandas allows us to perform operations on all historical values of a time series?
.expanding()
What pandas method can be used to create exponentially weighted moving averages?
.ewm()
Given a JavaScript object carInfo with a key “year”, what command assigns the value 2007 to the “year” key?
carInfo.year = 2007;
How do you comment in HTML?
start:
What three possible commands start every variable initialization command in JavaScript?
var, let, const
In HTML, the img tag’s ____ attribute points to the image’s URL.
src
JavaScript objects are ____ pairs.
key-value
How do you create a dead link in HTML?
<a></a>
JavaScript objects are not ____.
ordered
How can you create a text input in HTML?
If you leave it blank, the ORDER BY statement will use ____ by default.
ASC
Most of Bootstrap’s classes can be applied to ____ elements.
div
In SQL, where is the LIMIT statement typically placed in a query?
at the end of the query
How do you make a button fill the width of a screen using Bootstrap?
class=”btn-block”
For if statements in JavaScript, ____ are not required if the entire statement is on one line.
curly brackets
How do you import the seaborn library into Python?
import seaborn as sns
How do you import the Datetime library into Python?
from datetime import datetime
For an object in Python, what is an important difference between calling attributes versus calling methods?
methods have parentheses while attributes do not
What pandas function converts a string to a datetime object?
pd.to_datetime()
Given a DataFrame in pandas named df, how would you calculate 7-day moving averages of the data in the DataFrame?
df.rolling(7).mean()
What lines get added to a chart to create Bollinger bands?
20 day moving average
20 day MA + 2std
20 day MA - 2std
What does a kde plot stand for?
kernel density estimation
What is the poor naming convention associated with the datetime library?
Since the datetime library has a datetime method, you must sometimes call datetime.datetime()
Dictionaries do not retain ____.
order
In the command line, the ____ command causes a permanent delete and cannot be undone.
rm
In matplotlib, what does the alpha argument control?
the transparency of a line in a graph
How do you import the pandas library into Python?
import pandas as pd
How do you model exponential growth using linear regression?
use a log transformation
Write a JavaScript object using the ‘var’ declaration that describes the characteristics of a car.
var carInfo = { make: "Toyota", year: 1990 };
What is the syntax for a DROP TABLE command in SQL?
DROP TABLE IF EXISTS table_name;
note the IF EXISTS clause is not required, but very useful
What command clears the JavaScript console?
clear()
What is the general syntax of the ALTER TABLE command in SQL?
ALTER TABLE table_name ACTION;
Given the JavaScript object
myObject = {key:3};
how do you return 3?
myObject.key
What are the 5 main commands that can be used with the ALTER TABLE command in SQL?
ADD COLUMN DROP COLUMN RENAME COLUMN ADD CONSTRAINT RENAME TO
In Python, what is the easiest way to return the last item of a list called ‘names’?
names[-1]
What shortcut clears the terminal?
CMD + K
Using aq colon, how could you return the first two elements of a list in Python?
List[0:2]
This syntax returns UP TO BUT NOT INCLUDING the second element
What command creates a new folder in the terminal?
mkdir
What command would be used to create an index.html file using the command line?
touch index.html
Given a database connection called “conn” in psycopg2, how do you close the database connection?
conn.close()
In React, what is a stateless functional component?
Any function you write which accepts props and returns JSX.
When creating a table in SQL, what are the two main types of column constraints?
NOT NULL
UNIQUE
In the terminal, typing ____ allows you to open the vim editor.
vim
Typing ____ allows you to quit the vim editor.
:q
On the command line, the ____ function moves files from one directory into another. It can also be used to rename a file within the same directory.
mv
What is the general syntax for the UPDATE command in SQL?
UPDATE table_name
SET column = value1
WhERE other_column = value2
____ is a JavaScript method used to prevent default behavior.
event.preventDefault()
Given an array named xyz in Python, how can we calculate the sum and standard deviation of its elements?
xyz. sum()
xyz. std()
The pandas library is named after ____.
panel-data
What is the name of the main Python library that works with SQL?
psycopg2
In JavaScript, what does npm stand for?
node package manager
In JavaScript, the only strings that are falsy are ____.
empty
The ____ shortcut allows you to access the currently-selected element in dev tools.
$0
Using anonymous functions with event listeners can be troublesome because ____
they cannot be unbound
In JavaScript, what is coercion?
when you use the bang operator to convert a non-boolean data type into a boolean
Error management in Python is usually implemented using three keywords: ____, ____, and ____
try
except
finally
____ allow us to search for specific patterns within code.
regular expressions
In Python, the ____ library allows for working with regular expressions.
re
What command prints a list of virtual environments in Anaconda?
conda info –envs
Given a venv named MyDjangoEnv, how do I activate the venv on MacOS? Assume using anaconda
source activate MyDjangoEnv
What command installs Django on an anaconda venv?
conda install django
Using the django-admin command line tool, how would you start a new Django project called firsr_project
django-admin startproject first_project
What character is used for concatenation in JavaScript?
+
In HTML, do id or class attributes have higher specificity?
id
When functions are defined in JavaScript, they always start with ____.
function
Three important properties control the space that surrounds each HTML element: ____
padding, margin, and border
What is the purpose of the DOM?
The DOM allows us to interface our JavaScript code to interact with HTML and CSS
In what order do browsers read CSS?
top to bottom
What does JSON stand for?
JavaScript Object Notation
In the console of a web browser, how can you use the DOM to return the URL of a website?
document.URL
How can you make sure that a style declaration is never overridden?
by adding ‘!important’ to its declaration
In JavaScript, what is the difference between var and let?
var is function scoped and let is block scoped
How do you create a CSS variable?
give it a name with two dashes in front of it
–var
Regular expressions are also known as ____ or ____
regex
regexp
List three possible events in JavaScript
Clicks
Hovers
Double Clicks
To make font bold in HTML, we can use the ____ tag
strong
What is the purpose of regular expressions?
to match parts of strings
In JavaScript, what event listener measures when you stop mousing over an element?
mouseout
In HTML, you can add a horizontal line across the page using the ____ tag.
<hr></hr>
(self-closing)
What is the comment character in Python?
#
What is the remainder (or mod) operator in Python?
%
How would you create a list called “letters” in Python that contains x, y, and z
letters = [x,y,z]
In Python, how would you add 4 to the end of a list called ‘numbers’?
numbers.append(4)
Where should the tag be placed in an HTML document?
Just before the closing tag
What is the purpose of node.js?
Running JavaScript outside of the browser
What acronym can be used to memorize the different data types in JavaScript?
SNOB N US
How do you enable strict mode in JavaScript?
add
‘use strict’;
to the top of you tag
In JavaScript, var variables are ____ scoped
function