ATSC 270 PYTHON TEST EXAM | QUESTIONS & ANSWERS (VERIFIED) | LATEST UPDATE | GRADED A+
1 ATSC 270 PYTHON TEST EXAM | QUESTIONS & ANSWERS (VERIFIED) | LATEST UPDATE | GRADED A+ What are the Python origins? Correct Answer: It was developed in the late 1980s. Named after Monty Python. First used in 1991. What are the pros of Python? Correct Answer: Emphasizes code readability, free, easy to read, easy to write, cross platform (windows, Mac, Linux), simplifies declaration & manipulation of arrays and matrices, can be used to generate plots and visualize data. What are the cons of Python? Correct Answer: Slow (python is interpreted instead of compiler), less memory efficient, oldest version is the most popular (new one is quicker but it is harder to read, ex. Print statements) Interpreter vs Compiler Correct Answer: Interpreter makes python slower. You have to type in python into the shell/terminal first before you run the script. Python is not compiled. When you compile 2 something in C, it already knows what to do when you run it after compiling it first. Interpreting does both read and interpret in 1 step, making it slower. What is a module? Correct Answer: It is the equivalent of a library in C that holds all the functions. Examples: numpy, matplotlib, math, sys. Not one: plotter Know the numpy module Correct Answer: A fundamental package for scientific computing. Used for array creation and manipulation tools. Contains random number generators. Useful for linear for linear algebra, fourier transformations, etc. Very similar to math module which provides logarithmic and trig functions, and defines pi and e constants Know the Scipy module Correct Answer: Provides routines for numerical integration and optimization Know the matplotlib Correct Answer: 2D plotting library for python, and tools for creating a wide variety of plots. What are the differences from C for Variables and arrays? Correct Answer: Variables can be assigned immediately (don't need to declare variable types), need the numpy package to work with manipulating or doing math with arrays 3 (import numpy as np # link to numpy library, Array0=((5,4)) # creates 5x4 array of zeros), and array slicing selects all elements of an array dimension, pressure = sounding[;,2]/10, alternate: pressure = sounding [:][2]/10 . Non-numpy lists need to loop through operations. And standard operations (+,-,*,/,**,%) operate on element-byelement basis for numpy. Lists: have to do element by element math operations. Numpy: you can do math operations on the entire array at once. When do you use contour vs scatter vs histogram and other types of plots? Correct Answer: Line plot: generic plot type, used to show continuous data and functions and time series (example: p1 = (u,z), u = wind speed, z = height). Contour: line is a curve along which function (or data set) has constant value. Useful for crosssections (c1 = ur(x,z,u,ulevels). Scatter: shows relationship between two variables, most useful when you have large # of data points, & determine correlation between variables by fitting line to distribution (s1 = er (x, y, color=z). Histogram/bar graph: good summary plot, often used to show values of given variables for different data classes (bins) (b1 = (x,y). Map plot: good for showing where things occur by locations in relation to other locations You could use lat and Lon, but it is easier to have a map. How do you plot using pyplot? Correct Answer: Import t as plt, (r 'label of axis') Be able to write declared variables in python 4 Correct Answer: Examples: u = wind speed, z = height. Just give it a name and a value Be able to write out the import and used modules in python Correct Answer: Import numpy as np, import t as plt, Be able to write out a print output for Python Correct Answer: Print hello world. You don't need parenthesis but they are needed in python 3. Not needed in python 2. Be able to write out basic plotting lines in python Correct Answer: P1 = (u,z, or any variables) Be able to read programs and explain the output Correct Answer: Look over your programs. :) Review quizzes. :D. Know the sys module in python Correct Answer: OS/Computer system module; allows for arguments to be incorporated into python scripts (eg., run C code from within python) Know the math module Correct Answer: Just like numpy, it adds in math functions plus trigonometric, e and pi.
Geschreven voor
- Instelling
- ATSC
- Vak
- ATSC
Documentinformatie
- Geüpload op
- 4 maart 2024
- Aantal pagina's
- 4
- Geschreven in
- 2023/2024
- Type
- Tentamen (uitwerkingen)
- Bevat
- Vragen en antwoorden
Onderwerpen
-
atsc 270 python test exam questions answers