About the CS 1210 placement exam
About the placement exam
The Department of Computer Science offers a placement exam giving students the option of testing out of CS 1210 Introduction to Programming. Students who place out will not receive credit for CS 1210, but will be able to register for courses that have CS 1210 as a prerequisite (e.g., CS 2100 Intermediate Programming).
Topics
The placement exam covers fundamentals of programming, in the context of the Python programming language. You should be able to:
- answer true/false or multiple choice questions about programming in general, simple data structures (e.g., lists, stacks, queues, key/value), and the Python programming language,
- demonstrate fluency in use of basic features of Python,
- trace the execution of small portions of code (e.g., containing loops, conditionals, etc.), and
- write small snippets of code or functions to perform specified tasks with given constraints.
Checklist
Fundamentals
- Common Python types:
int
,float
,bool
,str
,range
,enumerate
,list
,tuple
,dict
, andNoneType
- Variables, identifiers, and assignment
- Understanding dynamic typing
- Difference between expressions and statements
- Mutability and immutability
- Arithmetic operators:
+
,-
,/
,//
,//
,**
, and%
- Comparison operators:
==
,<
,<=
,>
,>=
,!=
- Lexicographic order
- Boolean operations with comparison
- Connectives:
and
,or
andnot
- Truthiness and falsiness
- Comparability
- Keyword
is
- Connectives:
- Use of constructors for common Python types
- Specifying the entry point with
if __name__ == '__main__':
- Correct program structure
- Matters of style and PEP 8
- Syntax vs semantics
Functions
- Defining functions with
def
- Specifying function parameters and passing arguments to a function
- Returning values from a function with
return
- Writing pure and impure functions and understanding side-effects
- Calling a function and using the return value(s)
- Matters of scope
Sequences and iterables
- Basics of sequences and iterables
- Common sequence operations:
in
,not in
,+
and*
(where permitted) - Indexed reads from any sequence, and indexed writes to lists, and slices of any sequence
- Built-ins that work with sequences
len()
,min()
,max()
,sum()
- List methods:
.append()
,.pop()
,.sort()
,.extend()
,.reverse()
- String methods:
.upper()
,.lower()
,.capitalize()
,.split()
,.join()
,.count()
,.replace()
,.title()
,.strip()
- Sequence method
.index()
- Sequence unpacking
- Nested sequences
- Copying lists (shallow) with
.copy()
, the list constructor, or slice - Using slicing with lists, e.g., extracting some portion of a list using a slice
- Use of
next()
Branching
- Branching with
if
,elif
, andelse
- Using conditionals in branch statements
- Nested conditionals
Loops
- Loops with
for
andwhile
, and understanding use cases for each - Using an accumulator (or accumulators) in a loop
- Proper use of
break
- Nested loops
Dictionaries
- Dictionary fundamentals: keys and values
- Dictionary views with
.keys()
,.values()
,.items()
- Use of dictionary method
.pop()
and keyworddel
- Hashability
Console I/O
- Python built-ins:
input()
andprint()
- Use of f-strings and format specifiers
File I/O
- Basic file I/O using a context manager (
with
) open()
and file handles- File mode flags
- File handle methods:
.read()
,.write()
- Use of
next()
Python modules and imports
- Importing with
import
,from
,as
- Understanding the dunder
__name__
in the context of imports - Math module:
.pi
,.e
,.sqrt()
,.sin()
,.cos()
,.log()
,.log2()
- Random module:
.random()
,.randint()
,.choice()
,.seed()
,.gauss()
,.shuffle()
,.sample()
Exceptions and exception handling
- Common exceptions:
SyntaxError
,IndentationError
,NameError
,ValueError
,TypeError
,IndexError
,FileNotFoundError
,ZeroDivisionError
,AttributeError
,KeyError
,ModuleNotFoundError
, etc. - Exception handling with
try
,except
Miscellaneous
- Built-in functions
abs()
,dir()
,sorted()
- Method chaining
Intermediate questions
In addition to questions drawn from introductory level topics (above), there will be some intermediate questions on the exam as well. Your placement will not be based on intermediate questions, but your responses will help us gauge the overall preparedness of students taking the placement exam.