QMB3302 EXAM
True or False: all operators produce an INT output - answer False
When nesting IF statements, how many spaces do you need to ensure proper
indentation? - answer4
What is the purpose of an else statement - answer it serves as a catchall function if IF
statement conditions are not met
Suppose you wanted to escape an otherwise infinitely repeating loop or function. How
would you do it? - answerStop the Kernel
A WHILE loop is most closely related to which other type of function or statement -
answerFOR loop
Within a FOR loop which line of code would you use to increase the number within a
variable? - answercount = count + 1
imagine we have a dataframe, DF. What would be the purpose for running code like the
below? df.loc[1] - answerto look for, retrieve a value from a df
Imagine we have a dataframe that consists of 2 columns.
col1 is 30 values long, and is a random mix of the letters 'a',''b','c'
num1 is also 30 values long, and is a random set of numerical data( all integers)
Which of the following would give you the mean of the numerical (num1) column,
grouped by the values from column 'col1'? - answerdf.groupby('col1').mean()
True or false: numPy allows us to do more complicated math on lists and other data
structures, and is used in most of the more advanced modules we will use (such as
pandas) - answerTrue
Pandas can be imported as - answerimport pandas as pd
True or False: Usually a programmer will use conventional names when importing
packages. But it is not strictly necessary. ex: import numpy as humpty_dumpty -
answerTrue
True or false: pandas allows us to use multiple different data types(like objects and
numbers) in a single table - answerTrue
True or false: For pandas to work, data must be formatted as lists before it is imported -
answerFalse
True or False: all operators produce an INT output - answer False
When nesting IF statements, how many spaces do you need to ensure proper
indentation? - answer4
What is the purpose of an else statement - answer it serves as a catchall function if IF
statement conditions are not met
Suppose you wanted to escape an otherwise infinitely repeating loop or function. How
would you do it? - answerStop the Kernel
A WHILE loop is most closely related to which other type of function or statement -
answerFOR loop
Within a FOR loop which line of code would you use to increase the number within a
variable? - answercount = count + 1
imagine we have a dataframe, DF. What would be the purpose for running code like the
below? df.loc[1] - answerto look for, retrieve a value from a df
Imagine we have a dataframe that consists of 2 columns.
col1 is 30 values long, and is a random mix of the letters 'a',''b','c'
num1 is also 30 values long, and is a random set of numerical data( all integers)
Which of the following would give you the mean of the numerical (num1) column,
grouped by the values from column 'col1'? - answerdf.groupby('col1').mean()
True or false: numPy allows us to do more complicated math on lists and other data
structures, and is used in most of the more advanced modules we will use (such as
pandas) - answerTrue
Pandas can be imported as - answerimport pandas as pd
True or False: Usually a programmer will use conventional names when importing
packages. But it is not strictly necessary. ex: import numpy as humpty_dumpty -
answerTrue
True or false: pandas allows us to use multiple different data types(like objects and
numbers) in a single table - answerTrue
True or false: For pandas to work, data must be formatted as lists before it is imported -
answerFalse