
Code.org Foundations of AI Programming Unit 2 Lesson 6-8
Authored by Dan Yochum
Engineering
8th Grade
Used 8+ times

AI Actions
Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...
Content View
Student View
25 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following correctly defines a function with a parameter?
def greet(name): print("Hello, " + name)
print("Hello, name")
name = input("Hello")
greet = "Hello, name"
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following is an example of a syntax error?
Forgetting to define a function
Writing an infinite loop
Running a program without output
Using incorrect indentation
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which type of loop runs as long as a condition remains true?
if loop
while loop
else loop
function loop
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following best describes the difference between a function and a method in Python?
A method performs a task, while a function cannot
A function belongs to an object, but a method does not
A method is defined with a different key word than a function
A method is attached to an object, while a function is not.
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is missing from this function definition?
def greet()
print("Hello")
The def keyword
A colon : at the end of the function header
Parentheses around "Hello!"
The function name
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
The best definition of snake_case?
An action that an object can do
A naming style where all letters are lowercase and words are separated by underscores
A named block of code that performs a task.
A blueprint or set of instructions for creating something that can do specific tasks
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
The best definition of method?
An action that an object can do
A naming style where all letters are lowercase and words are separated by underscores
A named block of code that performs a task.
A blueprint or set of instructions for creating something that can do specific tasks
Access all questions and much more by creating a free account
Create resources
Host any resource
Get auto-graded reports

Continue with Google

Continue with Email

Continue with Classlink

Continue with Clever
or continue with

Microsoft
%20(1).png)
Apple
Others
Already have an account?