INTRODUCTION TO COMPUTER
PROGRAMMING (EXAM 1)
Algorithms - Correct Answers -A series of well-defined, logical steps that must be taken
in order to perform a task. They serve as a necessary intermediate step between
understanding the task at hand and translating it into computer code.
Sources of input - Correct Answers -User (keyboard, mouse, etc.), hardware (scanner,
camera, etc.), data (file, the Internet, etc.)
Output - Correct Answers -Some kind of tangible/visible/readable product is constructed
(screen display, printout, 3D fabrication)
IDLE - Correct Answers -Integrated DeveLopment Environment; has two modes
IDLE: Interactive mode - Correct Answers -commands are immediately processed as
they are received
Pocessing - Correct Answers -A series of mathematical or logical processes that are
applied to the input
IDLE: Script mode - Correct Answers -allows programmer to write a program (saved as
a "Text file" on your computer) and then your commands can be processed whenever
you like
Function - Correct Answers -1. a pre-written piece of computer code that will perform a
specific action or set of actions.
2. Python comes with many built-in functions and you can also write your own.
3. Functions always begin with a keyword followed by a series of PARENTHESIS
4. You can pass one or more arguments into a function by placing data inside the
parenthesis. Different functions expect different numbers of arguments and different
argument types
5. "Calling" a function means that you ask Python to run a function
, Strings - Correct Answers -1. Data that is textual in nature
2. Can contain 0 or more printed characters
String literals - Correct Answers -1. strings that you define inside of your program
2. hard-coded values
3. must be delimited using a special character (" or ' or """ or ''') so that Python knows
the characters you typed should be treated as text/string and not a function call
Line endings - Correct Answers -1. Python automatically places a newline character at
the end of each line
2. to override this use the 'end' argument at the end of the line, MUST be at the end
e.g.
print("one",end="")
print("two",end="")
# output: onetwo
Separating print() function arguments - Correct Answers -1. By default Python places a
space in between arguments that you use in print() function calls
2. to override this use the 'sep' argument at the end of the line, MUST be at the end
e.g.
print("one","two",sep="*")
# output: one*two
Escape characters - Correct Answers -1. allows you to perform special actions inside of
the confines of a delimiter
2. In Python the escape character is "\"
3. it causes Python to treat the next character as "special", which in most cases means
you ignore the next character to prevent it from taking on its regular meaning which in
some cases will mess up your program/delimiter
e.g.
print('Hi, it\'s Ellie')
# output: Hi, it's Ellie
Escape characters: conjunctions - Correct Answers -1. \n forces a line break
2. \t forces a tab
PROGRAMMING (EXAM 1)
Algorithms - Correct Answers -A series of well-defined, logical steps that must be taken
in order to perform a task. They serve as a necessary intermediate step between
understanding the task at hand and translating it into computer code.
Sources of input - Correct Answers -User (keyboard, mouse, etc.), hardware (scanner,
camera, etc.), data (file, the Internet, etc.)
Output - Correct Answers -Some kind of tangible/visible/readable product is constructed
(screen display, printout, 3D fabrication)
IDLE - Correct Answers -Integrated DeveLopment Environment; has two modes
IDLE: Interactive mode - Correct Answers -commands are immediately processed as
they are received
Pocessing - Correct Answers -A series of mathematical or logical processes that are
applied to the input
IDLE: Script mode - Correct Answers -allows programmer to write a program (saved as
a "Text file" on your computer) and then your commands can be processed whenever
you like
Function - Correct Answers -1. a pre-written piece of computer code that will perform a
specific action or set of actions.
2. Python comes with many built-in functions and you can also write your own.
3. Functions always begin with a keyword followed by a series of PARENTHESIS
4. You can pass one or more arguments into a function by placing data inside the
parenthesis. Different functions expect different numbers of arguments and different
argument types
5. "Calling" a function means that you ask Python to run a function
, Strings - Correct Answers -1. Data that is textual in nature
2. Can contain 0 or more printed characters
String literals - Correct Answers -1. strings that you define inside of your program
2. hard-coded values
3. must be delimited using a special character (" or ' or """ or ''') so that Python knows
the characters you typed should be treated as text/string and not a function call
Line endings - Correct Answers -1. Python automatically places a newline character at
the end of each line
2. to override this use the 'end' argument at the end of the line, MUST be at the end
e.g.
print("one",end="")
print("two",end="")
# output: onetwo
Separating print() function arguments - Correct Answers -1. By default Python places a
space in between arguments that you use in print() function calls
2. to override this use the 'sep' argument at the end of the line, MUST be at the end
e.g.
print("one","two",sep="*")
# output: one*two
Escape characters - Correct Answers -1. allows you to perform special actions inside of
the confines of a delimiter
2. In Python the escape character is "\"
3. it causes Python to treat the next character as "special", which in most cases means
you ignore the next character to prevent it from taking on its regular meaning which in
some cases will mess up your program/delimiter
e.g.
print('Hi, it\'s Ellie')
# output: Hi, it's Ellie
Escape characters: conjunctions - Correct Answers -1. \n forces a line break
2. \t forces a tab