Thanks to Dr. Alan McLeod for the content of this page.

Exam Practice Problems

  1. Provide the output of each of the following print statements:
    
        print(5 // 7 * 13)
    
        print(5 + 7 * 2)
    
        print((5 + 7) * 2)
    
        print(4 + 6 - 2 * 4 - 5)
    
        print(10.0 / 20)
    
        print(17 % 5)
    
        print(5 ** 2)
    
        print(5 > 7 and 3 != 1)
    
        print(5 < 7 or 7 > 15)
    
        print(3 >= -2 and 6 != 7 and -2 > -10)
    
    
  2. Given the list defined below, give the output of each of the following print statements:
    
        aList = [3, 4, 5, 6, 7, 8]
    
        print(aList[4])
    
        print(aList[1 : 5])
    
        print(aList + [10, 20])
    
        print(len(aList))
    
        print(aList[-1])
    
        print(aList[-3 : -1])
    
        print(aList * 2)
    
        print(9 in aList)
    
        print(10 not in aList)
    
    
  3. Write a function that accepts two lists as parameters. If the lists are either empty or do not have the same size the function should return an empty list. Otherwise the function should return a list that is the element by element product of the numbers from both lists.
  4. Write a function that accepts two lists as parameters. If the lists are either empty or do not have the same size the function should return an empty list. Otherwise the function should return a list that consists of the larger number in each position in the two lists.
  5. Here is a list:
    
    numsList = [3, 7, 13, 4, 11, 5, 6, 2]
    
    
    It is supplied to the following function:
    
    def sort(numsList) :
    
    
    
        size = len(numsList)
    
    
    
        for i in range(0, size) :
    
            j = size - 1
    
            while j > i :
    
            if numsList[j] < numsList[j - 1] :
    
    	    swap(numsList, j, j - 1)
    
    	    j = j - 1
    
    	print(numsList)
    
    
    What is the screen output of this function?
  6. (From the 2007 CISC 101 final exam) Write a function called "splitter" that has three lists as parameters. The first list should be split into the two other lists by putting alternating numbers into both lists until they are full. Assume that each list has at least one member and that the sizes of the 2nd and 3rd lists sum to the size of the first list.

Previous Exams

Here is an updated version of the Fall 2008 exam and its solution. The Fall 2009 exam and its solution are also available. Please note that these exams may have questions on topics that were not covered in CISC 101 this term. The questions are also not guaranteed to be indicative of what will appear on the final exam for this course.

Topics Covered

The following lists do not contain every single topic addressed in CISC 101 this term, but they do serve as a reasonable overview. Questions on these topics and any others from the lecture slides may appear on the final exam unless otherwise stated in the exam review.

Fundamental Python Topics Other Topics
Numeric types and variable creation Computer architecture and components
Numeric and string literals Booting, processes and process switching
Precedence rules Different numeric representations
Operators Boolean values and logical operators
Integer or floor division ENIAC and after ENIAC
Expressions von Neumann Architecture and Cycle
Console I/O Transistors, vacuum tubes and Moore's Law
Escape characters Commanding the processor
Creating and using functions Machine language and assembly language
Boolean operators and expressions Computer languages (e.g., compiled and interpreted)
Comparing strings with boolean operators History and features of Python
The chr(...) and ord(...) BIFs Unicode and ASCII
Conditionals (e.g., if, if/else, chained if) Style and documentation
Loops (while and for) Locating minimum and maximum values
Nested loops and nested conditionals Searching with the Sequential and Binary Search algorithms
Looping "accessories" (e.g., break and continue) Sorting with the Insertion, Selection and Bubble Sort algorithms
String methods Guest lecture by Scott Grant
Returning one or multiple values (a tuple) from a function  
Default and keyword arguments for functions
Passing parameters by reference
Variable scope and global variables
Lists, dictionaries and tuples
Keywords, BIFs and methods used with lists, dictionaries and tuples
Lists of lists and lists of dictionaries (lists of anything!)
The slice operator
Keywords (e.g., del, in, not in)
Using + and * with lists
Looping through lists
Text file input and output
Raising and catching exceptions
The None constant
The isinstance(...) BIF
Simple GUI construction using the Tkinter module
Some modules (e.g., random, os, sys, time)