CSC 311
ADVANCED PROGRAMMING
TECHNIQUES USING PYTHON
Complete Exam Preparation Guide
Chapters 1 – 4 | All Topics Covered
Simple Definitions · Code Examples · Exam Tips
TABLE OF CONTENTS
<b>Chapter</b> <b>Title</b> <b>Topics</b>
Chapter 1 Introduction to Python Origins, Features, Installation, Data Types, Variables, Functions, Paramet
Chapter 2 Python Control Flows Conditionals, Loops (while/for/nested), break, continue, Recursion
Chapter 3 CSV, JSON & OOP Reading/Writing CSV & JSON Files, Object-Oriented Programming (9 Fea
Chapter 4 Python Libraries NumPy, Pandas, Matplotlib, Concurrency, Parallelism, Async IO
Exam Summary Quick Reference Key Definitions Table + Most Likely Exam Questions & Answers
CHAPTER ONE: INTRODUCTION TO PYTHON
1.1 What is Python?
Definition: Python is a high-level, general-purpose, interpreted programming language known for its
simplicity, readability, and large community.
Key words:
• High-level = easy for humans to read and write
• General-purpose = can be used for many different things
• Interpreted = runs code line by line
• Uses indentation (spaces/tabs) to organise code blocks
• Supports structured, object-oriented, and functional programming
1.1.1 Origins of Python (Late 1980s – Early 1990s)
<b>Fact</b> <b>Detail</b>
Creator Guido van Rossum (Dutch programmer)
Where Centrum Wiskunde & Informatica (CWI), Netherlands
Started 1989
Inspired by ABC programming language
Named after Monty Python (British comedy group)
First release Python 0.9.1 in 1991
Version Timeline:
<b>Year</b> <b>Version</b>
1991 Python 0.9.1
1994 Python 1.2
1995 Python 1.5
2000 Python 2.0
2008 Python 3.0 (major)
2015 Python 3.5
2018 Python 3.7
2020 Python 3.9
1.1.3 Key Features of Python
<b>#</b> <b>Feature</b>
1 High-level, interpreted language
2 Simple and readable syntax
3 Object-Oriented Programming (OOP)
4 Dynamic typing
5 Large standard library and frameworks
6 Cross-platform
7 Extensive use of indentation for code blocking
1.1.4 Applications of Python
<b>#</b>
<b>Application</b> <b>Tools/Frameworks</b>
1 Web development Django, Flask
2 Data science & analytics NumPy, Pandas, scikit-learn
3 AI and machine learning TensorFlow, Keras
4 Automation and scripting —
5 Scientific computing —
6 Education & beginner programming —
7 Games and game development —
1.1.5 Benefits of Using Python
<b>Benefit</b> <b>Explanation</b>
Easy to learn No intermediate compiler; auto-compiles to byte code
Free (open source) Downloading and installing Python is completely free
Powerful Dynamic typing, built-in tools, third-party libraries
Automatic memory Python handles memory for you
Portable Runs the same on any platform (Windows, Mac, Linux)
Interpreted Processed at runtime by Python interpreter
Interactive Interact directly with the interpreter
Straightforward Simple and clean syntax
1.2 Installation — 6 Steps
<b>Step</b>
<b>Action</b>
1 Select the version of Python to install
2 Download Python Executable Installer
3 Run the Executable Installer
4 Verify Python was installed on Windows
5 Verify Pip was installed
6 Add Python Path to Environment Variables (Optional)
★ EXAM TIP: IDLE = Integrated Development Environment — installed automatically with Python.
1.3 Python Code Execution
Definition: Source code (.py) is automatically compiled to byte code (.pyc), which is then run by the
Python Virtual Machine (PVM).
Source code (.py) ■■■ Byte code (.pyc) ■■■ PVM (runs the code)
1.4 Modes of Python Interpreter
<b>Mode</b> <b>Description</b> <b>Best For</b>
Interactive (REPL) Type one command at a time; runs immediately. Prompt:
Quick testing,
>>> debugging, learning
Script Mode Write code in .py file, run the whole file at once Long/complex programs, reusable code
Interactive Mode Example:
>>> print('Hello, World!')
Hello, World!
>>> d = 10
>>> b = 10
>>> print(d + b)
20
Script Mode Example:
# Save as [Link]
d = 10
b = 10
print('Sum:', d + b)
# Run from terminal:
$ python [Link]
Sum: 20
1.5 Basic Syntax and Data Types
1.5.1 The 8 Main Data Types
<b>Type</b> <b>Description</b> <b>Example</b>
Integer (int) Whole numbers, positive or negative, no decimals 5, -10, 100
Float Numbers with decimal points 3.14, -2.5
Complex Has real and imaginary parts 35e3, 12E4
String Sequence of characters in quotes (immutable) 'hello', "world"
Boolean True or False only True, False
List Ordered, MUTABLE collection — uses [ ] [1,'a',True]
Tuple Ordered, IMMUTABLE collection — uses ( ) (1, 2, 3)
Dictionary Unordered key-value pairs — uses { } {"key": "value"}
Set Unordered, UNIQUE elements only {1, 2, 3}
List — Code Example:
list1 = [1, 2, 3, 'A', 'B', 7, 8, [10, 11]]
print(list1)
# Output: [1, 2, 3, 'A', 'B', 7, 8, [10, 11]]
★ EXAM TIP: Exam Q: Can Python List hold elements of different types? YES — but in practice keep
lists consistent to avoid problems.
Set Operations:
A = {0, 2, 4, 6, 8}
B = {1, 2, 3, 4, 5}
# Union — all elements, no duplicates
print(A | B) # {0,1,2,3,4,5,6,8}
print([Link](B))
# Intersection — elements in BOTH sets
print(A & B) # {2, 4}
print([Link](B))
# Difference — in A but NOT in B
print(A - B) # {0, 8, 6}
print([Link](B))
Variables
Definition: Variables are reserved memory locations to store values. When you create a variable, you
reserve space in memory.
Rules for Python variables:
• Must start with a letter or underscore _
• Cannot start with a number
• Can only contain alpha-numeric characters and underscores (A-z, 0-9, _)
• Variable names are case-sensitive (age, Age, AGE are THREE different variables)
<b>Scope Type</b> <b>Description</b>
Local Scope Variable defined INSIDE a function; only accessible within that function
Global Scope Variable defined in the main body; accessible everywhere in the file
Operators Table
<b>Operator</b> <b>Token</b>
add +
subtract -
multiply *
Integer Division /
remainder (modulo) %
Binary left shift <<
Binary right shift >>
and &
or |
Less than <
Greater than >
Less than or equal to <=
Greater than or equal to >=
Check equality ==
Check not equal !=
★ EXAM TIP: Operator Precedence: * runs before +. Parentheses () always have the HIGHEST
precedence and override everything!
>>> 3 + 4*2
11 # Multiply first: 4*2=8, then 3+8=11
>>> (10+10)*2
40 # Parentheses override: 20*2=40
Comments
# Single-line comment (use # symbol)
x = 5 # Inline comment
"""
Multi-line comment
using triple quotes
"""
1.5.8 Functions
Definition: A function is a group of related statements that perform a specific task. Functions avoid
repetition and make code reusable.
<b>Type</b> <b>Description</b> <b>Example</b>
Built-in Already built into Python abs(), len(), print(), bool()
User-defined Created by the programmer using def keyword
def my_func(): ...
# User-defined function
def add_numbers(x, y):
sum = x + y
return sum
print('The sum is', add_numbers(5, 20))
# Output: The sum is 25
1.6 Parameters and Arguments
<b>Term</b> <b>Definition</b> <b>Example</b>
Parameter Variable in function DEFINITION (placeholder) def sum(a, b): ← a and b are parameters
Argument Actual VALUE passed when calling the function sum(1, 2) ← 1 and 2 are arguments
4 Types of Arguments — MEMORIZE THESE!
<b>Type</b> <b>Description</b> <b>Example</b>
1. Positional add(3, 5) → a=3, b=5
Passed based on position/order. Order MUST match.
2. Keyword Passed using name=value. Order doesn't matter. describe(age=30, name='Alice')
3. Default Has a default value if none is provided. def greet(name, greeting='Hello')
4. Variable-length *args (tuple) or **kwargs (dictionary) def func(*args, **kwargs)
# *args example
def sum_numbers(*args):
total = 0
for num in args:
total += num
return total
print(sum_numbers(1, 2, 3, 4)) # Output: 10
# **kwargs example
def print_info(**kwargs):
for key, value in [Link]():
print(f'{key}: {value}')
print_info(name='David', age=25, city='New York')
CHAPTER TWO: PYTHON CONTROL FLOWS
Definition: Control flow refers to the ORDER in which individual statements, instructions, or function
calls are executed in a program. By default Python executes code sequentially (top to bottom).
2.1 Conditional Statements
Definition: A conditional statement is a syntax construct that lets you execute certain code blocks
ONLY when a specific condition is true, while skipping them when false.
2.1.1 The if Statement
if condition:
# Example
a = 3
if a > 2:
print(a, 'is greater')
print('done')
# Output: 3 is greater
# done
2.1.2 Boolean Operators
<b>Operator</b><b>Syntax</b> <b>Result</b>
and condition_0 and condition_1 True only if BOTH conditions are True
or condition_0 or condition_1 True if AT LEAST ONE condition is True
not not condition_0 True if the condition is False (reverses it)
number = 7
if number > 0 and number < 10:
print('The number is between 0 and 10!')
# Output: The number is between 0 and 10!
2.1.3 elif — Chaining Multiple Conditions
day = 'Wednesday'
if day == 'Monday':
print('Work on Python content!')
elif day == 'Tuesday':
print('Team meeting at 9 AM.')
elif day == 'Wednesday':
print('Hang out with the community.')
# Output: Hang out with the community.
2.1.4 else — Default Block
number = 7
if number % 2 == 0:
print('The number is even.')
else:
print('The number is odd.')
# Output: The number is odd
★ EXAM TIP: else MUST always be LAST. Placing it before elif causes a syntax error!
2.1.5 if-elif-else (Complete Form)
a = int(input('enter the number'))
b = int(input('enter the number'))
c = int(input('enter the number'))
if a > b:
print('a is greater')
elif b > c:
print('b is greater')
else:
print('c is greater')
2.1.6 Iteration (Loops)
Definition: Iteration = repeated execution of a set of statements with the help of loops. A loop runs as
long as the condition is true.
<b>Loop Type</b> <b>Description</b> <b>Best For</b>
While Loop Runs while condition is True Unknown number of iterations
For Loop Iterates over items in an iterable Known number of iterations
Nested For Loop A loop inside another loop Patterns, 2D data
While Loop
# Syntax
while(expression):
Statement(s)
# Example — count 1 to 9
i = 1
while (i < 10):
print(i)
i = i + 1
# Output: 1, 2, 3, 4, 5, 6, 7, 8, 9
For Loop
# Syntax
for item in iterable:
# Example 1 — iterate over colours
colors = ['red', 'green', 'blue', 'yellow']
for color in colors:
print(color)
# Output: red, green, blue, yellow
# Example 2 — compute squares
numbers = [2, 3, 4, 5, 6]
for number in numbers:
print(number**2)
# Output: 4, 9, 16, 25, 36
Nested For Loop
for i in range(1, 6):
for j in range(0, i):
print(i, end=' ')
print()
# Output:
# 1
# 2 2
# 3 3 3
# 4 4 4 4
# 5 5 5 5 5
2.3 Break and Continue Statements
<b>Statement</b> <b>What it does</b> <b>Analogy</b>
break STOPS the entire loop Emergency exit — leave the building
continue SKIPS current iteration only, loop continues Skip one floor — keep going
break — Example:
for num in [11, 9, 88, 10, 90, 3, 19]:
print(num)
if(num == 88):
print('The number 88 is found')
print('Terminating the loop')
break
# Output: 11, 9, 88, The number 88 is found, Terminating the loop
continue — Example (skip even, print odd):
for num in [20, 11, 9, 66, 4, 89, 44]:
if num % 2 == 0: # skip even numbers
continue
print(num)
# Output: 11, 9, 89
2.4 Recursion
Definition: Recursion is a programming technique where a function calls itself to solve smaller
instances of the same problem.
<b>Part</b> <b>Description</b>
Base case Condition that STOPS the recursion — prevents infinite loop
Recursive case The function calls ITSELF with a smaller problem
# Example 1 — Countdown
def countdown(n):
print(n)
if n == 0:
return # Base case
else:
countdown(n-1) # Recursive case
countdown(5) # Output: 5, 4, 3, 2, 1, 0
# Example 2 — Factorial
def fact(x):
if x == 0:
result = 1 # Base case
else:
result = x * fact(x-1) # Recursive case
return result
print('five factorial', fact(5)) # Output: 120
★ EXAM TIP: Python has a default recursion limit of 1000 recursive calls. Exceeding this causes a
RecursionError!
CHAPTER THREE: CSV, JSON & OOP
3.1 Python CSV
Definition: CSV = Comma Separated Value. A simple way to save tabular data in spreadsheets and
databases. Each line represents a data record, fields separated by commas.
IMPORTANT: Must import csv before use: import csv
3.1.1 Reading CSV Files — [Link]()
import csv
with open('[Link]', 'r') as file:
csv_reader = [Link](file)
for row in csv_reader:
print(row)
# Output:
# ['Name', ' Age', ' Country']
# ['Maria', ' 21', ' Italy']
# For custom delimiter (e.g. dash):
csv_reader = [Link](file, delimiter='-')
3.1.2 Writing CSV Files — [Link]()
import csv
with open('[Link]', 'w', newline='') as file:
csv_writer = [Link](file)
csv_writer.writerow(['Name', 'Age', 'Country'])
csv_writer.writerow(['Steve', 32, 'Australis'])
csv_writer.writerow(['Messi', 34, 'Argentina'])
csv_writer.writerow(['Ronaldo', 37, 'Portugal'])
★ EXAM TIP: When writing to a CSV file, the INITIAL content is REPLACED by the new content.
3.2 Python JSON
Definition: JSON = JavaScript Object Notation. A text-based data format used to store and transfer
data. Text is represented as a quoted string in key-value mapping.
IMPORTANT: Must import json before use: import json
<b>Function</b> <b>Direction</b> <b>Description</b>
[Link]() JSON string → Python dict Parse a JSON string into a Python dictionary
[Link]() Python dict → JSON string Convert a Python dictionary to a JSON string
[Link]() JSON file → Python dict Read and parse a JSON file
[Link]() Python dict → JSON file Write Python dict to a JSON file
JSON Examples:
import json
# JSON string to Python dict ([Link])
employee = '{"name": "Johnny", "hobbies": ["Chess", "Piano"]}'
employee_dict = [Link](employee)
print(employee_dict['hobbies']) # ['Chess', 'Piano']
# Python dict to JSON string ([Link])
employee_dict = {'name': 'Johnny', 'hobbies': ['Chess', 'Piano']}
employee_json = [Link](employee_dict)
print(employee_json) # {"name": "Johnny", "hobbies": ["Chess", "Piano"]}
# Read JSON file ([Link])
with open('[Link]', 'r') as json_file:
result = [Link](json_file)
# Write JSON to file ([Link])
with open('[Link]', 'w') as json_file:
[Link](employee_dict, json_file)
3.3 Object-Oriented Programming (OOP)
Definition: OOP is a programming paradigm that organises software design around real-world entities
and their interactions. Its major components are Objects and Classes.
<b>Term</b> <b>Definition</b> <b>Analogy</b>
Class Blueprint/template for creating objects Like an architectural plan for a house
Object An instance of a class with specific attributes and behaviours
An actual built house
Properties/State The data/attributes an object has Student: name, RNO, DOB
Methods/Behaviour The actions an object can perform Student: attend class, write exam
3.1.8 The 9 Features of OOP — MEMORIZE ALL!
<b>#</b>
<b>Feature</b> <b>Definition</b>
1 Classes Fundamental building blocks; blueprints for creating Objects. Defines structure and behaviour.
2 Objects Instances of classes representing real-world entities with specific attributes and behaviours.
3 Inheritance New class (subclass) inherits properties from existing class (superclass). Promotes code reusa
4 Abstraction Simplifying complex systems by showing only essential features and hiding unnecessary details
5 Encapsulation Bundling data (attributes) and methods into a single unit (Object). Promotes data integrity and s
6 Polymorphism Objects of different classes treated as objects of a standard base class. Two types: overloading
7 Method Overriding Subclass provides its own implementation for a method already defined in its superclass.
8 Method Overloading Class has multiple methods with the same name but different parameters.
9 Constructors & Destructors Constructors initialise Objects when created. Destructors clean up resources when Object is no
CHAPTER FOUR: PYTHON LIBRARIES AND
MODULES
Key libraries: NumPy, Pandas, and Matplotlib — fundamental Python libraries for data analysis and
visualization.
4.1 NumPy (Numerical Python)
Definition: NumPy provides support for efficient operations on large, multi-dimensional arrays and
matrices, essential for numerical computations.
<b>Fact</b> <b>Detail</b>
Full name Numerical Python
Purpose Scientific computing, arrays and matrices
Written in C (makes it very fast)
Use cases Machine learning, deep learning, scientific applications
Import syntax import numpy as np
NumPy Arrays:
import numpy as np
# Create array
x = [Link]([1, 2, 3])
print(x) # Output: array([1, 2, 3])
# Temperature conversion (Celsius to Fahrenheit)
C = [Link]([20.1, 20.8, 21.9, 22.5])
print(C * 9/5 + 32) # [68.18 69.44 71.42 72.5]
Why NumPy arrays are faster than lists:
• Stored efficiently in memory
• Support vectorized operations (optimized in C)
• NumPy takes advantage of CPU caching and optimized algorithms
4.1.2 NumPy Types:
<b>Type</b> <b>Description</b>
int32, int64 Integer types
float32, float64 Float types (default is float64)
bool Boolean type
object Object type
4.2 PANDAS — Python Data Analysis Library
Definition: PANDAS is an open-source Python library for high-performance data structures and
analysis tools. Known as the 'SQL of Python'. Built on top of NumPy.
<b>Fact</b> <b>Detail</b>
Full name Python Data Analysis Library
Main data structure DataFrame (2D table-like structure)
Built on top of NumPy
Import syntax import pandas as pd
Called The SQL of Python
4.2.1 Features of Pandas (Know at least 5):
<b>#</b> <b>Feature</b>
1 Efficient DataFrame object for data manipulation
2 Easy reshaping and pivoting of data sets
3 Merging and joining of data sets
4 Label-based data slicing, indexing, and subsetting
5 Working with time-series data
6 Freedom to deal with missing data
7 Create custom functions and run across data series
8 High-level abstraction and data structures
9 Support for Re-indexing, Sorting, Aggregations, Concatenations, Visualizations
4.2.2 Applications of Pandas:
<b>#</b> <b>Application</b>
1 Best data analysis tool for real-world problems
2 General data wrangling and cleaning
3 ETL (extract, transform, load) jobs for data transformation
4 Excellent support for loading CSV files into data frames
5 Used in statistics, finance, and neuroscience
6 Time-series functionality (date range generation, moving window, linear regression)
import pandas as pd
# Create a DataFrame
df = [Link]({'a': [1, 2, 3], 'b': [4, 5, 6]})
# Load from CSV
df = pd.read_csv('[Link]')
# Load from Excel
df = pd.read_excel('[Link]')
# Convert to NumPy array
df.to_numpy()
4.3 Matplotlib
Definition: Matplotlib is one of the most popular Python packages for data visualization. It is a
cross-platform library for making 2D plots from data in arrays.
<b>Feature</b> <b>Detail</b>
Purpose Data visualization (line plots, bar charts, histograms, pie charts, scatter plots)
Type Cross-platform 2D plotting library
Import import [Link] as plt
MATLAB alternative Free and open source replacement
4.3.2 Applications of Matplotlib:
• Correlation analysis of variables
• Visualize 95% confidence intervals of models
• Outlier detection using scatter plots
• Visualize the distribution of data for instant insights
import [Link] as plt
import numpy as np
# Line plot
x = [Link]([0, 6])
y = [Link]([0, 250])
[Link](x, y)
[Link]()
4.4 The Python Library Ecosystem
Think of the libraries as layers built on top of each other:
<b>Level</b> <b>Library & Role</b>
Layer (top) Pandas — data manipulation and analysis
Matplotlib — 2D plotting library
SciPy — minimization, regression, Fourier-transformation
NumPy — multi-dimensional arrays and matrices
Layer (bottom) Python — general-purpose language
★ EXAM TIP: Python + NumPy + SciPy + Matplotlib + Pandas = as efficient as MATLAB or R for
numerical computing — and it's FREE!
4.6 Core Python vs NumPy Comparison
<b>Core Python Advantages</b> <b>NumPy Advantages</b>
High-level number objects: integers, floating point Array-oriented computing
Lists with cheap insertion and append methods Efficiently implemented multi-dimensional arrays
Dictionaries with fast lookup Designed for scientific computation
4.10 – 4.19 Concurrency and Parallelism
<b>Term</b> <b>Definition</b> <b>Key Detail</b>
Parallelism Performing multiple operations AT THE SAMERequires
TIME multiple cores
Concurrency Multiple tasks run in OVERLAPPING manner Does NOT imply parallelism
Multiprocessing Spreading tasks over CPUs/cores Well-suited for CPU-bound tasks
Multithreading Multiple threads take turns on a SINGLE processor
Better for I/O-bound tasks
Async IO Single-threaded concurrency paradigm NOT multithreading/multiprocessing
GIL Global Interpreter Lock — only ONE thread runs
Python-specific
at a time mechanism
Why Multiprocessing is needed:
• CPUs with multiple cores have become standard
• Programs should take advantage of multiple cores
• Default Python interpreter has GIL (Global Interpreter Lock) — allows only one statement at a time
(serial processing)
Processes vs Threads:
<b>Threads</b> <b>Multiple Processes</b>
Can lead to conflicts if improperly synchronised Run in completely separate memory locations
Share memory space Independent of each other
More synchronisation issues Fewer synchronisation issues, but more overhead
EXAM QUICK-REFERENCE SUMMARY
Complete Definitions Table
<b>Term</b> <b>Definition</b>
Python High-level, general-purpose, interpreted programming language
Variable Reserved memory location to store a value
List Ordered, MUTABLE collection using [ ]
Tuple Ordered, IMMUTABLE collection using ( )
Dictionary Unordered key-value pairs using { }
Set Unordered collection of UNIQUE elements
Function Group of related statements that perform a specific task
Parameter Variable in function definition (placeholder)
Argument Actual value passed when calling a function
Loop Repeated execution of statements while condition is true
Recursion A function that calls itself to solve a smaller problem
break Terminates the entire loop
continue Skips current iteration only; loop continues
Class Blueprint for creating objects in OOP
Object An instance of a class
Inheritance Child class inherits properties/methods from parent class
Encapsulation Bundling data and methods into one unit (Object)
Abstraction Hiding complex details, showing only essentials
Polymorphism Different objects treated as objects of the same base class
NumPy Numerical Python — fast library for arrays and matrices
Pandas Python Data Analysis Library — built on NumPy
Matplotlib Python 2D plotting and visualization library
CSV Comma Separated Value — plain text tabular data format
JSON JavaScript Object Notation — text-based data transfer format
Concurrency Multiple tasks run in overlapping manner
Parallelism Multiple operations run simultaneously using multiple cores
GIL Global Interpreter Lock — only one thread runs at a time in Python
REPL Read-Evaluate-Print Loop — Python Interactive Mode
PVM Python Virtual Machine — runs byte code
Multiprocessing Spreading tasks over multiple CPUs/cores for parallelism
Most Likely Exam Questions and Answers
Q: What is Python?
A: Python is a high-level, general-purpose, interpreted programming language known for its simplicity,
readability, and large community. It supports structured, object-oriented, and functional programming.
Q: Who created Python and when?
A: Guido van Rossum in 1989 at the Centrum Wiskunde & Informatica (CWI) in the Netherlands.
Q: What is the difference between a list and a tuple?
A: A list is MUTABLE (can be changed) and uses [ ]. A tuple is IMMUTABLE (cannot be changed) and
uses ( ).
Q: What is the difference between break and continue?
A: break TERMINATES the entire loop. continue SKIPS only the current iteration and the loop
continues.
Q: What are the 4 types of arguments in Python?
A: 1. Positional — passed by order. 2. Keyword — passed by name=value. 3. Default — has preset
value. 4. Variable-length — *args (tuple) or **kwargs (dictionary).
Q: What are the 9 features of OOP?
A: Classes, Objects, Inheritance, Abstraction, Encapsulation, Polymorphism, Method Overriding,
Method Overloading, Constructors and Destructors.
Q: What is recursion?
A: A technique where a function calls itself. Requires a base case (stops recursion) and a recursive
case (calls itself). Python has a default recursion limit of 1000.
Q: What is the difference between NumPy and Pandas?
A: NumPy provides multi-dimensional arrays for numerical computation. Pandas is built on top of
NumPy and provides DataFrames for data analysis, cleaning, and manipulation.
Q: What is JSON?
A: JavaScript Object Notation — a text-based data format used to store and transfer data between a
server and web applications using key-value pairs.
Q: What is the difference between concurrency and parallelism?
A: Parallelism means performing multiple operations SIMULTANEOUSLY using multiple cores.
Concurrency means multiple tasks run in an OVERLAPPING manner but not necessarily at the same
time.
Q: What is GIL?
A: Global Interpreter Lock — a lock in Python that allows only ONE thread to hold control of the Python
interpreter at a time. Only one thread can execute at any point in time.
Q: What is CSV?
A: Comma Separated Value — a plain text file format for storing tabular data where each line is a
record and fields are separated by commas.
Q: What are the two modes of Python interpreter?
A: 1. Interactive Mode (REPL) — runs one command at a time. 2. Script Mode — writes and runs an
entire .py file.
Q: What is the difference between parameters and arguments?
A: Parameters are variables in the function DEFINITION (placeholders). Arguments are the actual
VALUES passed when CALLING the function.
Q: Name 5 benefits of using Python.
A: 1. Easy to learn and use. 2. Free and open source. 3. Portable (runs on any platform). 4. Has
automatic memory management. 5. Has a large standard library and community.
GOOD LUCK ON YOUR EXAM TOMORROW! YOU'VE GOT THIS! ■
CSC 311 — Advanced Programming Techniques Using Python