Exam block #1: Control and Evaluations (25%)
Objectives covered by the block (10 exam items)
- basic concepts: interpreting and the interpreter, compilation and the compiler, language elements, lexis, syntax and semantics, Python keywords, instructions, indenting
- literals: Boolean, integer, floating-point numbers, scientific notation, strings
- operators: unary and binary, priorities and binding
- numeric operators: ** * / % // + –
- bitwise operators: ~ & ^ | << >>
- string operators: * +
- Boolean operators: not and or
- relational operators ( == != > >= < <= ), building complex Boolean expressions
- assignments and shortcut operators
- accuracy of floating-point numbers
- basic input and output: input(), print(), int(), float(), str() functions
- formatting print() output with end= and sep= arguments
- conditional statements: if, if-else, if-elif, if-elif-else
- the pass instruction
- simple lists: constructing vectors, indexing and slicing, the len() function
- simple strings: constructing, assigning, indexing, slicing comparing, immutability
- building loops: while, for, range(), in, iterating through sequences
- expanding loops: while-else, for-else, nesting loops and conditional statements
- controlling loop execution: break, continue
Exam Block #2: Data Aggregates (25%)
Objectives covered by the block (10 exam items)
- strings in detail: ASCII, UNICODE, UTF-8, immutability, escaping using the \ character, quotes and apostrophes inside strings, multiline strings, copying vs. cloning, advanced slicing, string vs. string, string vs. non-string, basic string methods (upper(), lower(), isxxx(), capitalize(), split(), join(), etc.) and functions (len(), chr(), ord()), escape characters
- lists in detail: indexing, slicing, basic methods (append(), insert(), index()) and functions (len(), sorted(), etc.), del instruction, iterating lists with the for loop, initializing, in and not in operators, list comprehension, copying and cloning
- lists in lists: matrices and cubes
- tuples: indexing, slicing, building, immutability
- tuples vs. lists: similarities and differences, lists inside tuples and tuples inside lists
- dictionaries: building, indexing, adding and removing keys, iterating through dictionaries as well as their keys and values, checking key existence, keys(), items() and values() methods
Exam block #3: Functions and Modules (25%)
Objectives covered by the block (10 exam items)
- defining and invoking your own functions and generators
- return and yield keywords, returning results, the None keyword, recursion
- parameters vs. arguments, positional keyword and mixed argument passing, default parameter values
- converting generator objects into lists using the list() function
- name scopes, name hiding (shadowing), the global keyword
- lambda functions, defining and using
- map(), filter(), reduce(), reversed(), sorted() functions and the sort() method
- the if operator
- import directives, qualifying entities with module names, initializing modules
- writing and using modules, the __name__ variable
- pyc file creation and usage
- constructing and distributing packages, packages vs. directories, the role of the __init__.py file
- hiding module entities
- Python hashbangs, using multiline strings as module documentation
Exam block #4: Classes, Objects, and Exceptions (25%)
Objectives covered by the block (10 exam items)
- defining your own classes, superclasses, subclasses, inheritance, searching for missing class components, creating objects
- class attributes: class variables and instance variables, defining, adding and removing attributes, explicit constructor invocation
- class methods: defining and using, the self parameter meaning and usage
- inheritance and overriding, finding class/object components
- single inheritance vs. multiple inheritance
- name mangling
- invoking methods, passing and using the self argument/parameter
- the __init__ method
- the role of the __str__ method
- introspection: __dict__, __name__, __module__, __bases__ properties, examining class/object structure
- writing and using constructors
- hasattr(), type(), issubclass(), isinstance(), super() functions
- using predefined exceptions and defining your own ones
- the try-except-else-finally block, the raise statement, the except-as variant
- exceptions hierarchy, assigning more than one exception to one except branch
- adding your own exceptions to an existing hierarchy
- assertions
- the anatomy of an exception object
- input/output basics: opening files with the open() function, stream objects, binary vs. text files, newline character translation, reading and writing files, bytearray objects
- read(), readinto(), readline(), write(), close() methods
Last updated: June 21, 2018
Aligned with PCAP-31-01, PCAP-31-02