Font size
WorksheetsFinal Exam - Comp Sci
Total questions: 135
Worksheet time: 1hrs 9mins
Provide a short definition or description of the terms or topics below:
Program
An application that combines multiple tools needed to code; Integrated Development Environment
A set of steps that defines how a task is performed
A program that transforms the entire source code into machine language before executing
A set of rules that must be strictly followed when writing code ---> language specific
A representation of an algorithm that a computer can execute
Provide a short definition or description of the terms or topics below:
data types
An application that combines multiple tools needed to code; Integrated Development Environment
A set of steps that defines how a task is performed
A program that transforms the entire source code into machine language before executing
Categories for values in memory (Ex: int, float, str, etc.)
A representation of an algorithm that a computer can execute
Provide a short definition or description of the terms or topics below:
Algorithm
An application that combines multiple tools needed to code; Integrated Development Environment
A set of steps that defines how a task is performed
A program that transforms the entire source code into machine language before executing
A set of rules that must be strictly followed when writing code ---> language specific
A representation of an algorithm that a computer can execute
Provide a short definition or description of the terms or topics below:
Control Structures
An application that combines multiple tools needed to code; Integrated Development Environment
A set of steps that defines how a task is performed
A program that transforms the entire source code into machine language before executing
A set of rules that must be strictly followed when writing code ---> language specific
A logical design that controls the order in which a set of code executes
3 ---> sequence, decision or selection or loops.
Provide a short definition or description of the terms or topics below:
Reference Variables
An application that combines multiple tools needed to code; Integrated Development Environment
A variable that points to a specific location in memory instead of holding a value. Holds and memory address.
A program that transforms the entire source code into machine language before executing
A set of rules that must be strictly followed when writing code ---> language specific
A logical design that controls the order in which a set of code executes
3 ---> sequence, decision or selection or loops.
Provide a short definition or description of the terms or topics below:
Hardware
An application that combines multiple tools needed to code; Integrated Development Environment
Programs
A program that transforms the entire source code into machine language before executing
Equipment; Physical components of a computer
A representation of an algorithm that a computer can execute
Provide a short definition or description of the terms or topics below:
Variable
An application that combines multiple tools needed to code; Integrated Development Environment
A named place in memory where data can be stored and retrieved
A program that transforms the entire source code into machine language before executing
Equipment; Physical components of a computer
A representation of an algorithm that a computer can execute
Provide a short definition or description of the terms or topics below:
Software
An application that combines multiple tools needed to code; Integrated Development Environment
Programs
A program that transforms the entire source code into machine language before executing
Equipment; Physical components of a computer
A representation of an algorithm that a computer can execute
Provide a short definition or description of the terms or topics below:
Compiler
An application that combines multiple tools needed to code; Integrated Development Environment
Programs
A program that transforms the entire source code into machine language before executing
Equipment; Physical components of a computer
A representation of an algorithm that a computer can execute
Provide a short definition or description of the terms or topics below:
Interpreter
An application that combines multiple tools needed to code; Integrated Development Environment
A program that transforms one line of code into machine language and executes, repeating the process until no more code
A program that transforms the entire source code into machine language before executing
A set of rules that must be strictly followed when writing code ---> language specific
A representation of an algorithm that a computer can execute
Provide a short definition or description of the terms or topics below:
IDE
An application that combines multiple tools needed to code; Integrated Development Environment
A program that transforms one line of code into machine language and executes, repeating the process until no more code
A program that transforms the entire source code into machine language before executing
A set of rules that must be strictly followed when writing code ---> language specific
A representation of an algorithm that a computer can execute
Provide a short definition or description of the terms or topics below:
Syntax
An application that combines multiple tools needed to code; Integrated Development Environment
A program that transforms one line of code into machine language and executes, repeating the process until no more code
A program that transforms the entire source code into machine language before executing
A set of rules that must be strictly followed when writing code ---> language specific
A representation of an algorithm that a computer can execute
What is the difference between a high-level and low-level programming language?
High Level (Python) - Select 3
Involves memory management
Feature abstraction
Does not involve memory management
Machine dependent (processor)
Machine independent
What is the difference between a high-level and low-level programming language?
Low Level (Machine Code) - Select 3
Involves memory management
Does not feature abstraction
Does not involve memory management
Machine dependent (processor)
Machine independent
List the major hardware components of a computer:
CPU
Central Processing Unit
Random Access Memory
Secondary Memory
Input Devices
Output Devices
List the major hardware components of a computer:
Main Memory
Central Processing Unit
Random Access Memory
Secondary Memory
Input Devices
Output Devices
List the major hardware components of a computer:
Secondary Memory - Select 2
Hard Drives
Keyboard
USBs
Monitor
Mouse
List the major hardware components of a computer:
Input Devices - Select 3
Headphones
Keyboard
Speaker
Microphone
Mouse
List the major hardware components of a computer:
Output Devices - Select 3
Headphones
Speaker
Monitor
Microphone
Touchscreen
What are the two types of software?
Provide one example for System Software
Microsoft Office
Provide one example for Application Software
Microsoft Word
Provide information for the following Python topics/commands.
Allows users to enter a string
Named place in memory
A sequence of characters; text
Function that displays information to the screen
Function that formats a value when displaying
Provide information for the following Python topics/commands.
format
Allows users to enter a string
Named place in memory
A sequence of characters; text
Function that displays information to the screen
Function that formats a value when displaying
Provide information for the following Python topics/commands.
input
Allows users to enter a string
Named place in memory
A sequence of characters; text
Function that displays information to the screen
Function that formats a value when displaying
Provide information for the following Python topics/commands.
variables
Allows users to enter a string
Named place in memory
A sequence of characters; text
Function that displays information to the screen
Function that formats a value when displaying
Provide information for the following Python topics/commands.
int
Integers, whole numbers
Named place in memory
Real numbers; numbers with a decimal value
Function that displays information to the screen
Function that formats a value when displaying
Provide information for the following Python topics/commands.
float
Integers, whole numbers
Named place in memory
Real numbers; numbers with a decimal value
Function that displays information to the screen
Function that formats a value when displaying
Provide information for the following Python topics/commands.
string
Allows users to enter a string
Named place in memory
A sequence of characters; text
Function that displays information to the screen
Function that formats a value when displaying
Arithmetic Operators: Exponent
**
*
.pow()
.power(x,2)
Arithmetic Operators: Multiplication, Division, Integer
**, //, %
*, /, %
*, %, floor
*, /, floor
Arithmetic Operators: Floor Division, Remainder
floor, %
//, floor
//, %
%, //
Provide information for the following Python topics/commands.
Logical Operators
Check for a given relationship between two values
Execute code if a condition is true
Execute one code block if a condition is true or another block of code if it is false
Connect two Boolean expressions (condition)
Provide information for the following Python topics/commands.
Relational Operators
Check for a given relationship between two values
Execute code if a condition is true
Execute one code block if a condition is true or another block of code if it is false
Connect two Boolean expressions (condition)
Provide information for the following Python topics/commands.
if Statement
Check for a given relationship between two values
Execute code if a condition is true
Execute one code block if a condition is true or another block of code if it is false
Connect two Boolean expressions (condition)
Provide information for the following Python topics/commands.
if-else Statement
Check for a given relationship between two values
Execute code if a condition is true
Execute one code block if a condition is true or another block of code if it is false
Connect two Boolean expressions (condition)
Provide information for the following Python topics/commands.
if-elif Statement
A conditional statement inside another conditional statement
Execute code if a condition is true
Execute one code block if a condition is true or another block of code if it is false
Executes a block of code if a condition is true or checks a second condition if the first was false. If the second condition is true, it executes a second block of code
Provide information for the following Python topics/commands.
Nested Conditional Statements
A conditional statement inside another conditional statement
Execute code if a condition is true
Execute one code block if a condition is true or another block of code if it is false
Executes a block of code if a condition is true or checks a second condition if the first was false. If the second condition is true, it executes a second block of code
Provide information for the following Python topics/commands
while Loop
Repeatedly execute a block of code if a condition is true
Executes a block of code over a sequence of data
Creates a sequence of numbers
One loop inside another loop
Check if input given by user is valid
Provide information for the following Python topics/commands
for Loop
Repeatedly execute a block of code if a condition is true
Executes a block of code over a sequence of data
Creates a sequence of numbers
One loop inside another loop
Check if input given by user is valid
Provide information for the following Python topics/commands
range
Repeatedly execute a block of code if a condition is true
Executes a block of code over a sequence of data
Creates a sequence of numbers
One loop inside another loop
Check if input given by user is valid
Provide information for the following Python topics/commands
Nested Loops
When a loop goes on forever
Executes a block of code over a sequence of data
Creates a sequence of numbers
One loop inside another loop
Check if input given by user is valid
Provide information for the following Python topics/commands
Input Validation
When a loop goes on forever
Executes a block of code over a sequence of data
Creates a sequence of numbers
One loop inside another loop
Check if input given by user is valid
Provide information for the following Python topics/commands
Infinite Loops
When a loop goes on forever
Executes a block of code over a sequence of data
Creates a sequence of numbers
One loop inside another loop
Check if input given by user is valid
Provide information for the following Python topics/commands.
clearscreen()
Clears the drawings, sends the turtle to home, sets the pen color to black, and sets the background color to white
Clears the drawings, sets the turtle to home, sets the pen color to black
Clears the drawings
Provide information for the following Python topics/commands.
reset()
Clears the drawings, sends the turtle to home, sets the pen color to black, and sets the background color to white
Clears the drawings, sets the turtle to home, sets the pen color to black
Clears the drawings
Provide information for the following Python topics/commands.
clear()
Clears the drawings, sends the turtle to home, sets the pen color to black, and sets the background color to white
Clears the drawings, sets the turtle to home, sets the pen color to black
Clears the drawings
Provide information for the following Python topics/commands.
forward(int)
Moves the turtle in the direction it's facing; number of steps is given as a parameter
Rotates the turtle counterclockwise; degrees given as a parameter
Rotates the turtle clockwise; degrees given as a parameter
Provide information for the following Python topics/commands.
left(int)
Moves the turtle in the direction it's facing; number of steps is given as a parameter
Rotates the turtle counterclockwise; degrees given as a parameter
Rotates the turtle clockwise; degrees given as a parameter
Provide information for the following Python topics/commands.
right(int)
Moves the turtle in the direction it's facing; number of steps is given as a parameter
Rotates the turtle counterclockwise; degrees given as a parameter
Rotates the turtle clockwise; degrees given as a parameter
Provide information for the following Python topics/commands.
fillcolor(str)
Changes the fill color of the turtle to c
Changes the pen color to c and outline of turtle
Change or set the screen color to c
Tells the program a shape will be drawn that should be filled so the program must keep track of path and area needed to be filled
Tells the program shape is done and to fill the area created
Provide information for the following Python topics/commands.
pencolor(str)
Changes the fill color of the turtle to c
Changes the pen color to c and outline of turtle
Change or set the screen color to c
Tells the program a shape will be drawn that should be filled so the program must keep track of path and area needed to be filled
Tells the program shape is done and to fill the area created
Provide information for the following Python topics/commands.
bgcolor(str)
Changes the fill color of the turtle to c
Changes the pen color to c and outline of turtle
Change or set the screen color to c
Tells the program a shape will be drawn that should be filled so the program must keep track of path and area needed to be filled
Tells the program shape is done and to fill the area created
Provide information for the following Python topics/commands.
begin_fill()
Changes the fill color of the turtle to c
Changes the pen color to c and outline of turtle
Change or set the screen color to c
Tells the program a shape will be drawn that should be filled so the program must keep track of path and area needed to be filled
Tells the program shape is done and to fill the area created
Provide information for the following Python topics/commands.
end_fill()
Changes the fill color of the turtle to c
Changes the pen color to c and outline of turtle
Change or set the screen color to c
Tells the program a shape will be drawn that should be filled so the program must keep track of path and area needed to be filled
Tells the program shape is done and to fill the area created
Provide information for the following Python topics/commands.
xcor()
returns the x-coordinate of the turtle's current location
returns the y-coordinate of the turtle's current location
Returns the turtle's current location in the format (x,y)
Tells the program a shape will be drawn that should be filled so the program must keep track of path and area needed to be filled
Tells the program shape is done and to fill the area created
Provide information for the following Python topics/commands.
ycor()
returns the x-coordinate of the turtle's current location
returns the y-coordinate of the turtle's current location
Returns the turtle's current location in the format (x,y)
Tells the program a shape will be drawn that should be filled so the program must keep track of path and area needed to be filled
Tells the program shape is done and to fill the area created
Provide information for the following Python topics/commands.
pos()
returns the x-coordinate of the turtle's current location
returns the y-coordinate of the turtle's current location
Returns the turtle's current location in the format (x,y)
Tells the program a shape will be drawn that should be filled so the program must keep track of path and area needed to be filled
Tells the program shape is done and to fill the area created
Which of the following describes the reason for the error that occurs when the code segment executed?
The print function cannot print a number, only strings.
The print function cannot print multiple values, only one.
The multiplication cannot be performed because base and height are strings.
The multiplication cannot be performed because the incorrect operator is used
What is the output of the following code segment if red is entered for color1 and color2?
Red
Error: Incorrect color(s)
Orange
Purple
What segment of code should go in line 11 and 12?
Which of the following shows the location of the turtle after running the code segment?
Which of the following symbols marks the beginning of a single-line comment in Python?
**
*
#
&
A ____ is a sequence of characters.
Character collection
Char sequence
Text Block
String
A ____________ is a name that references a value in the computer's memory.
Register
Variable
RAM slot
Byte
What is the output of the code segment when the value 3 is given as an input?
Area = 28.26
Circumference = 28.26
Nothing will be printed since the code segment will result in an error.
Area = 28.26
Circumference = 18.84
Area = 18.84
Circumference = 18.84
Suppose the following statement is in a program: price = 99.0.
After this statement executes, what will be the data type of the variable price?
float
currency
int
str
What is the output of the code segment when given the following inputs: Yessenia, 15.367, and 36?
Nothing will be printed since the code will result in an error.
Salary: $ 553.21
Salary: $553.212
Salary: $553.21
number = 1234567.456
Which of the following statements will display the variable number formatted as 1,234,567.5
print(format(number, ',.1'))
print(format(',.1f', number))
print(format(number, ',.1f'))
print(format(',.1', number))
Which of the following statements will cause an error?
x = 99999
17 = x
a = 17
x = '17'
Which of the following operators is not an arithmetic (mathematical) operator in Python?
%
\\
+
**
What would the output of the code segment be?
31
11
1
21
A(n) ______________ expression has a value of either True or False.
binary
decision
unconditional
Boolean
What is the output of the code segment?
37 1
18 37
2 3
1 18
and, or, and not are ___________ operators.
logical
conditional
relational
ternary
Which of the following best describes the syntax error that is found in the code segment provided?
The colon is missing at the end of the if statements.
The number of books is obtained incorrectly because of the int before the input function.
The wrong type of quotes were used when printing text. Single quotes is used for strings in Python. For example, it should be print('Points Awarded:', points).
No syntax error is found in the code segment.
Which of the following best describes the logic error that is found when the code segment is executed, assuming there are no syntax errors?
All the conditional statements except the first one should be elif statements, not if statements.
The incorrect relational operators were used in all four conditions. The relational operator used should have been <=, not >=.
Logical operators should have been used for the last three conditions to check for the two numbers needed. Not doing so causes the points to be awarded incorrectly.
No logic error is found when the code segment is executed.
A(n) _____________ structure tests a condition and then takes one path if the condition is true, or nothing if the condition is false.
if-else statement
if-elif statement
if statement
sequence
A(n) _____________ structure tests a condition and then takes one path if the condition is true, or another path if the condition is false.
if-else statement
if-elif statement
if statement
sequence
Which of the following code segments will properly update the variable grade based on a student's perfomance on the bonus questions?
The symbols >, <, and == are all ____________ operators.
Ternary
Relational
Conditional
Logical
Which Python statement would best replace ''' Missing Code ''' for the code to work as intended?
max < n < min
max > n and n > min
max > n > min
max > n or n > min
What is the difference between a while loop and a for loop?
A while loop iterates over a sequence of data while a for loop iterates if a test expression (condition) is True.
A while loop iterates if a test expression (condition) is True while a for loop iterates over a sequence of data
A while loop has a variable that gets updated after every iteration and a for loop does not
A for loop has a variable tha gets updated after every iteration and a while loop does not.
Which of the following types of loops does not exist in Python
All exist in Python
while loop
do-while loop
for loop
A ______ controlled loop uses a true/false condition to control the number of times that it repeats
Boolean
condition
decision
count
A ______ controlled loop repeats a specific number of times.
Boolean
condition
decision
count
A(n) _______ loop has no way of ending until the program is interrupted.
indeterminate
infinite
timeless
interminable
Which of the following Python statements creates a sequence of numbers that are multiples of 4 and between 1 and 80 inclusive?
range(4,80)
range(80,4)
range(4,80,4)
range(4,81,4)
None of the range function calls provided creates the desired sequence.
Which of the following best describes the syntax error that is found in the code segment provided?
Every statement is missing a semicolon at the end. Python requires a semicolon at the end of each individual statement.
The incorrect operator was used when calculating the result. It should be *=not=*.
The wrong type of quotes were used when working with string literals. Double quotes are used for strings in Python. For example, it should be input("Enter number: ").
No syntax error is found in the code segment.
Which of the following best describes the logic error that is found when the code segment is executed, assuming there are no syntax errors?
The range function should start at 1, not 0. Thus, the code should be range(1, power).
The for loop was defined incorrectly. It should use of and not in. The code should be for p of range(power).
The calculation for the variable result uses the wrong variable. It should use p and not num. The statement should be result *= p.
No logic error is found in the code segment
Which of the following best describes the logic error that is found when the code segment is executed, assuming there are no syntax errors?
For the condition of the while loop, the logical operator or should have been used and not and
The relational operators used are incorrect. They should be = and not ==.
Line 6 should not be indented. This causes it to print something repeatedly when it is not supposed to.
No logic error is found when the code segment is executed.
Which of the following best describes the syntax error that is found in the code segment provided?
The wrong type of quotes were used when working with string literals. Single quotes are used for strings in Python
The colon is missing at the end of the while loop statement
The variables num1 and num2 should not be converted to int since the function input does that automatically.
No syntax error is found when the code segment is executed.
Provide information for the following Python topics/commands.
Function Header
1st line in function - def name_fun(parameters):
A special local variable that receives a copy of values given to a function - def n(x,y):
Exits the function and may return a value - return value_exp
Executes the function - name_fun(arguments)
Actual values given to a function when its called - n(x,y)
Provide information for the following Python topics/commands.
Parameters
1st line in function - def name_fun(parameters):
A special local variable that receives a copy of values given to a function - def n(x,y):
Exits the function and may return a value - return value_exp
Executes the function - name_fun(arguments)
Actual values given to a function when its called - n(x,y)
Provide information for the following Python topics/commands.
return Statement
1st line in function - def name_fun(parameters):
A special local variable that receives a copy of values given to a function - def n(x,y):
Exits the function and may return a value - return value_exp
Executes the function - name_fun(arguments)
Actual values given to a function when its called - n(x,y)
Provide information for the following Python topics/commands.
Function Call
1st line in function - def name_fun(parameters):
A special local variable that receives a copy of values given to a function - def n(x,y):
Exits the function and may return a value - return value_exp
Executes the function - name_fun(arguments)
Actual values given to a function when its called - n(x,y)
Provide information for the following Python topics/commands.
Arguments
1st line in function - def name_fun(parameters):
A special local variable that receives a copy of values given to a function - def n(x,y):
Exits the function and may return a value - return value_exp
Executes the function - name_fun(arguments)
Actual values given to a function when its called - n(x,y)
Provide information for the following Python topics/commands.
Modules
Another python file that just contains function definitions
A special local variable that receives a copy of values given to a function - def n(x,y):
Exits the function and may return a value - return value_exp
Executes the function - name_fun(arguments)
Actual values given to a function when its called - n(x,y)
Provide information for the following Python topics/commands.
math module
Another python file that just contains function definitions
module that contains math functions
Exits the function and may return a value - return value_exp
Executes the function - name_fun(arguments)
Actual values given to a function when its called - n(x,y)
Provide information for the following Python topics/commands.
random module
Another python file that just contains function definitions
module that contains math functions
module that contains functions for randomization
Executes the function - name_fun(arguments)
Actual values given to a function when its called - n(x,y)
Provide information for the following Python topics/commands.
Files
file = open("name","mode") #1
...... #2 -> process file
file.close() #3
'r' - read only
'w' - write only
'a' - append only
Only use the with 'w' and 'a' mode.
Reads everything into one string
Reads one line including '\n'
Provide information for the following Python topics/commands.
File Modes
file = open("name","mode") #1
...... #2 -> process file
file.close() #3
'r' - read only
'w' - write only
'a' - append only
Only use the with 'w' and 'a' mode.
Reads everything into one string
Reads one line including '\n'
Provide information for the following Python topics/commands.
write Function
file = open("name","mode") #1
...... #2 -> process file
file.close() #3
'r' - read only
'w' - write only
'a' - append only
Only use the with 'w' and 'a' mode.
Reads everything into one string
Reads one line including '\n'
Provide information for the following Python topics/commands.
read Function
file = open("name","mode") #1
...... #2 -> process file
file.close() #3
'r' - read only
'w' - write only
'a' - append only
Only use the with 'w' and 'a' mode.
Reads everything into one string
Reads one line including '\n'
Provide information for the following Python topics/commands.
readline Function
file = open("name","mode") #1
...... #2 -> process file
file.close() #3
'r' - read only
'w' - write only
'a' - append only
Only use the with 'w' and 'a' mode.
Reads everything into one string
Reads one line including '\n'
Provide information for the following Python topics/commands.
try/except
a structure to handle specific errors known as exceptions
'r' - read only
'w' - write only
'a' - append only
Only use the with 'w' and 'a' mode.
Reads everything into one string
Reads one line including '\n'
Provide information for the following Python topics/commands.
Exceptions
a structure to handle specific errors known as exceptions
Value Error, NameError, TypeError, ZeroDivisionError
Only use the with 'w' and 'a' mode.
Reads everything into one string
Reads one line including '\n'
Provide information for the following Python topics/commands.
Lists
An object that contains multiple values, enclosed in brackets []
The asterisk with sequence operand repeats that sequence x times
Return a portion or size of the list with only specialized elements
Determines if an item is in a sequence
Provide information for the following Python topics/commands.
Relational Operator
An object that contains multiple values, enclosed in brackets []
The asterisk with sequence operand repeats that sequence x times
Return a portion or size of the list with only specialized elements
Determines if an item is in a sequence
Provide information for the following Python topics/commands.
List Slicing
An object that contains multiple values, enclosed in brackets []
The asterisk with sequence operand repeats that sequence x times
Return a portion or size of the list with only specialized elements
Determines if an item is in a sequence
Provide information for the following Python topics/commands.
in Operator
An object that contains multiple values, enclosed in brackets []
The asterisk with sequence operand repeats that sequence x times
Return a portion or size of the list with only specialized elements
Determines if an item is in a sequence
List Methods - append(item)
Adds item to the end of list
Return index of 1st occurrence of value item
Insert item at specified index, shifting other elements to the right
Sort items in ascending order
Remove 1st occurrence of value item
List Methods - index(item)
Adds item to the end of list
Return index of 1st occurrence of value item
Insert item at specified index, shifting other elements to the right
Sort items in ascending order
Remove 1st occurrence of value item
List Methods - insert(index,item)
Adds item to the end of list
Return index of 1st occurrence of value item
Insert item at specified index, shifting other elements to the right
Sort items in ascending order
Remove 1st occurrence of value item
List Methods - sort()
Adds item to the end of list
Return index of 1st occurrence of value item
Insert item at specified index, shifting other elements to the right
Sort items in ascending order
Remove 1st occurrence of value item
List Methods - remove(item)
Adds item to the end of list
Return index of 1st occurrence of value item
Insert item at specified index, shifting other elements to the right
Sort items in ascending order
Remove 1st occurrence of value item
List Methods - reverse()
Reverse the current order of elements
Return index of 1st occurrence of value item
Insert item at specified index, shifting other elements to the right
Sort items in ascending order
Remove 1st occurrence of value item
Built-in Functions - len(list)
Returns length of sequence (number of elements)
Returns minimum value in sequence
Returns maximum value in sequence
Deletes an element in the list based on given index
Built-in Functions - min(list)
Returns length of sequence (number of elements)
Returns minimum value in sequence
Returns maximum value in sequence
Deletes an element in the list based on given index
Built-in Functions - max(list)
Returns length of sequence (number of elements)
Returns minimum value in sequence
Returns maximum value in sequence
Deletes an element in the list based on given index
del Statement
Returns length of sequence (number of elements)
Returns minimum value in sequence
Returns maximum value in sequence
Deletes an element in the list based on given index
Consider the following code segment.
Which of the following best describes the error found in the code segment?
The * operator is used for multiplication between two values only, not with lists.
The print function cannot print a list since it is multiple values.
The list function only accepts sequences, not an int like 0.
No error is found in the code segment.
Consider the following code segment.
What is the output of the following code segment?
pro
prob
lem
blem
The code provided below is a python program that generates a random list of numbers and prints the original list and the list of numbers with no duplicates.
What segment of code should go in line 13?
if numbers[c] not in no_rep:
if c not in no_rep:
if numbers.get(c) not in no_rep:
if numbers.c not in no_rep:
A group of statements that exist within a program for the purpose of performing a specific task is a(n) _________
block
parameter
function
expression
The first line of a function definition is known as the _______
Body
Introduction
Initialization
Header
You _____ a function to execute it.
Define
Call
Import
Export
A(n) _______ is a special variable that receives a piece of data when a function is called.
Argument
Parameter
Header
Packet
A(n) ______ is a piece of data that is sent into a function
Argument
Parameter
Header
Packet
A(n) _______ is a variable that is created inside a function and is only visible to that function.
Local variable
Hidden variable
Function-wide variable
Global variable
A(n) __________ is a variable that is visible to every function in a program file.
Local variable
Universal Variable
Program-wide variable
Global variable
What Python statement causes a function to end and sends a value back to the part of the program that called the function
end
send
exit
return
Consider the following code segment.
What will the following code display
1 3.4
0 0
1 3.4
1 3.4
0 0
0 0
1 3. 4
1 3. 4
1 3. 4
0 0
0 0
0 0
Which of the following function definitions creates a function that accepts an argument and displays it 10 times
def ten_times(n):
print(n*10)
def ten_times(n):
for i in range(10):
print(n)
def ten_times(n):
for i in range(10+1):
print(n)
def ten_times(n):
print(n ** 10)
Consider the following function definition below.
def my_function(a, b, c):
d = (a+c) / b
print(d)
Which of the following statements calls this function, pass 6 into c, 4 into b, and 2 into a?
my_function(2,4,6)
my_function(6,4,2)
my_function(4,2,6)
my_function(4,6,2)
