Docsity

CS 1301 Final Exam Review: Vocabulary, Stack Diagram, Binary Sort, Lists and Functions, Assignments of Computer Science

Toggle sidebar
bg1
Your Name:
________________________________________________________________ 1 / 9
CS 1301 Final Exam Review
1. Vocabulary Matching:
Write the number from the correct definition in the blank next to each term
on the left:
_3_ semantics
_7_concatenate:
10_parameter
_8_import
14_modulus operator
_6_dead code
_1_algorithm
15_iteration
_2_index
_4_slice
13_mutable
_5_index
11_tuple
_9_pickle
12_object
1. A general process for solving a category of problems
2. A variable or value used to select a member of an ordered set, such as a character
from a string
3. The meaning of a program
4. The process of calling the function that is currently
executing.
5. An integer variable or value that indicates an element of a list
6. Part of a program that can never be executed, often because it appears after a return
statement
7. To join two operands end-to-end.
8. A statement which permits functions and variables defined in a Python script to be
brought into the environment of another script or a running Python shell.
9. To write a data value in a file along with its type information so that it can be
reconstituted later
10. A name used inside a function to refer to the value passed as an argument.
11. A sequence type that is similar to a list except that it is immutable
12. A compound data type that is often used to model a thing or concept in the real
world
13. A compound data types whose elements can be assigned new values
14. An operator, denoted with a percent sign (%), that works on integers and yields the
remainder when one number is divided by another
15. Repeated execution of a set of statements using either a recursive function call or a
loop
pf3
pf4

Partial preview of the text

Download CS 1301 Final Exam Review: Vocabulary, Stack Diagram, Binary Sort, Lists and Functions and more Assignments Computer Science in PDF only on Docsity!

Your Name:

________________________________________________________________ 1 / 9

CS 1301 Final Exam Review

  1. Vocabulary Matching: Write the number from the correct definition in the blank next to each term on the left:

3 semantics

_7_concatenate:

10_parameter

_8_import

14_modulus operator

_6_dead code

_1_algorithm

15_iteration

_2_index

_4_slice

13_mutable

_5_index

11_tuple

_9_pickle

12_object

1. A general process for solving a category of problems

2. A variable or value used to select a member of an ordered set, such as a character

from a string

3. The meaning of a program

4. The process of calling the function that is currently

executing.

5. An integer variable or value that indicates an element of a list

6. Part of a program that can never be executed, often because it appears after a return

statement

7. To join two operands end-to-end.

8. A statement which permits functions and variables defined in a Python script to be

brought into the environment of another script or a running Python shell.

9. To write a data value in a file along with its type information so that it can be

reconstituted later

10. A name used inside a function to refer to the value passed as an argument.

11. A sequence type that is similar to a list except that it is immutable

12. A compound data type that is often used to model a thing or concept in the real

world

13. A compound data types whose elements can be assigned new values

14. An operator, denoted with a percent sign (%), that works on integers and yields the

remainder when one number is divided by another

15. Repeated execution of a set of statements using either a recursive function call or a

loop

  1. Stack Diagram def printStringN(in_string, numToPrint): print in_string * numToPrint if (numToPrint > 0): printStringN( in_string, numToPrint-1) return( 7 )

def countdown(number): for index in range(number): result = printStringN("Hi", index) tempNum = result + 1 print(tempNum) Draw a stack diagram for the following function call: countdown( 1 )

main

countdown number = 1 index = 0 result = 7 tempNum = 8

printStringN in_string = "Hi!" numToPrint = 0

  1. Is the sun setting already? Define fade(picture) that will make the picture darker.

def fade(picture): for px in getPixels(picture): color = getColor(px) makeDarker(color) setColor(px, color)

repaint(picture)

EC. What do these 3 lines of code do and how would it negatively affect

your computer? import os os.startfile(”startfiles.py”) os.startfile(”startfiles.py”)

It would open up an endless amount of windows and ultimately crash your computer.