EXAM 01 STUDY GUIDE

This study guide will help give you an idea of what to expect for the exam. It is still a work in progress, and may have some changes (you will be notified via email as those changes occur). All book, quiz, notes, slides, assignments, lecture, and code example content can be inspiration for exam questions.

FORMAT:

Moodle based Exam:

Total: 22 points

TOPICS:

SAMPLE CODING QUESTIONS

Sample questions are for practice. The exam question will be different, but may borrow concepts from one or more samples.

Question 1:

Create a function that takes a number as a paramter and determines if the value is even or odd. The function should return True for even and False for odd.

Question 2:

Write a function that takes a string as a parameter. The function should return a new string that has all of the vowels removed.

Question 3:

Create a function that takes a list of strings as a paramter. The function should return a dictionary that contains each string and the number of times the string occurs in the list as key value pairs.

Sample input: ["hello", "world", "good", "hello"]
Sample output: { "hello":2, "world":1, "good":1}

Question 4:

Create a function that takes two parameters. The first parameter should be a number, the second a list of numbers. The function should modify the original list parameter such that it only contains numbers that are greater than or equal to the first parameter number.

Question 5:

Create a function that prints a rectangle to the screen using the * character. The function will take two parameters. The first parameter is the height of the rectange, and the second parameter is the width.

Example output for a 4, 5 rectangle.

*****
*   *
*   *
*****

Question 6:

Createa function that take a single string as a parameter. The function should return the string in reversed order. Try doing this with a loop. Try doing this again using only slicing.