WorksheetsProgramming Concepts Quiz
Total questions: 35
Worksheet time: 28mins
Why is collaboration important in programming?
To work with project stakeholders and understand functionality needs
To create well-named variables and procedures
To use procedures/functions rather than duplicating code
To identify syntax errors and correct them
What is the purpose of debugging in programming?
To create a clear understanding of the issues to solve
To trace through a program and understand its purpose
To troubleshoot and fix errors in the code
To ensure all features work in the way the user needs
What is an algorithm in programming?
A collection of items
A computer procedure that tells your computer what steps to take to solve a problem
A placeholder for values a program needs to use
A text field denoted by quotation marks around the field
What is a list in programming?
The position of the items in a collection
The number of elements in a collection
A loop that iterates through each element in a collection
A collection of numbers, words, phrases, or a combination of these
In this code, what is the "i"
a while loop
a variable
iteration
a loop
random letter
What will this code output?
nothing at all
dude
dude, 4 times
dude, 6 times
dude, 3 times
In this code, what is "range"?
a function
a variable
iteration
a loop
selection
In this code, what is "for"?
a function
sequence
iteration
a while loop
selection
In this code, how would the code need to be changed, to print "dude" 10 times?
change the "dude", to a 10
change the 4, to a 10
change the for, to a while
change the 4, to an 11
change the print to an input()
What will be displayed?
1,2,3,4
2,3,4,5
1,1,1,1
1,2,3
0,1,2,3
what does int mean?
whole number
single character
True or False
A decimal
collection of characters
What value will "num" start with when the code is run?
0
1
10
2
Whatever is input from the user
Correct this line of code
input=num
(a)
Correct this line of code.
Vote_Age=>18
(a)
What is the output?
more than 7
more than 23
spam
7
Pieces of code that only run "under certain conditions":
conditional statements
control flow statments
syntax
variables
Which symbol means "not equal to"?
==
<=
>=
!=
What is the output?
True
False
condition1
condition2
What will be displayed at the end of the program?
Case 1
Case 2
Nothing will be displayed.
Case 1 and Case 2
What will display at the end of the program running?
You can ride the carousel!
Nothing will display
You cannot ride the carousel!
There will be an error.
What is the name of the function?
Which of the following is the correct code to define a function?
def area ( ):
area ( )
def area:
def area ( )
How do you identify the statements that belong to the body of a function?
Indent those statement the same amount underneath the function "def" statement
Add opening and closing curly braces { and } to mark the start and stop of the function body
Add the "def" keyword to the beginning of each statement
Add the same comment (#) to the right of each statement within the body
If a function named "mystery" is defined as taking no parameters, how would you call that function from your code?
#mystery
mystery[]
mystery()
mystery
Which of the following is NOT a Python rule for naming functions?
Functions names can contain letters, numbers and underscores
Function names must be less than 32 characters
The first character in a function name cannot be a number
Function names are case-sensitive
If X is odd and Y is even, then X must have a greater value than Y. Which example(s) support this statement?
X = 3, Y = 2
X = 4, Y = 3
X = 11, Y = 12
X = 2, Y = 2
Hello world!
Hello world!
Hello world!
Hello world!
Hello world!
(repeated continuously)
break
