
Programming Functions Quiz
Quiz
•
Computers
•
1st Grade
•
Practice Problem
•
Medium
Adham Elmuntser
Used 1+ times
FREE Resource
Enhance your content in a minute
30 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What will be the output of the function call greet("Bob") if the function is defined as def greet(name="Guest"): print(f"Hello, {name}!")
Hello, Bob!
Hello, Guest!
Syntax Error
Hello, Alice!
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following statements correctly defines a function that returns the square of its argument?
def square(x): return x to the power of 2
def square(x): return x + x
def square(x): return x ** 2
def square(x): return x - x
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What will be the output of check_even_odd(4) if check_even_odd is defined as def check_even_odd(number): if number % 2 == 0: print(f"{number} is even.") else: print(f"{number} is odd.")?
4 is odd.
4 is even.
Syntax Error
None
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following functions correctly calculates the factorial of a number n?
def factorial(n): return n * (n-1)
def factorial(n): for i in range(1, n + 1): n *= i return n
def factorial(n): result = 1 for i in range(1, n + 1): result *= i return result
def factorial(n): result = 1 for i in range(n): result *= i return result
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
In the function def add_numbers(a, b): return a + b, what will be the output of print(add_numbers(2, 3))?
23
5
TypeError
6
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What will be the output of the function call reverse_string("Python") if the function is defined as def reverse_string(s): return s[::-1]?
nohtyP
Python
Syntax Error
Pnohty
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
If count_vowels("Hello World") is called, what will be the output given the function def count_vowels(s): vowels = "aeiouAEIOU" count = 0 for char in s: if char in vowels: count += 1 return count?
2
3
4
5
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?
Similar Resources on Wayground
31 questions
Javascript Simulado
Quiz
•
1st Grade
25 questions
jquery
Quiz
•
1st Grade
25 questions
КИгр №16 Финал
Quiz
•
1st - 3rd Grade
27 questions
Пайтон новый
Quiz
•
1st - 5th Grade
29 questions
Arduino_Testing
Quiz
•
1st Grade
30 questions
10 сынып инф 3-нұсқа
Quiz
•
1st Grade
31 questions
Algoritmos e lógica de programação - 2
Quiz
•
1st Grade
30 questions
PORT_23
Quiz
•
1st Grade
Popular Resources on Wayground
15 questions
Fractions on a Number Line
Quiz
•
3rd Grade
20 questions
Equivalent Fractions
Quiz
•
3rd Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
22 questions
fractions
Quiz
•
3rd Grade
20 questions
Main Idea and Details
Quiz
•
5th Grade
20 questions
Context Clues
Quiz
•
6th Grade
15 questions
Equivalent Fractions
Quiz
•
4th Grade
20 questions
Figurative Language Review
Quiz
•
6th Grade
Discover more resources for Computers
20 questions
Telling Time to the Hour and Half hour
Quiz
•
1st Grade
10 questions
Exploring Rosa Parks and Black History Month
Interactive video
•
1st - 5th Grade
20 questions
Place Value
Quiz
•
KG - 3rd Grade
13 questions
Fractions
Quiz
•
1st - 2nd Grade
20 questions
CVC Words
Quiz
•
KG - 1st Grade
15 questions
Place Value tens and ones
Quiz
•
1st Grade
16 questions
Money - Coins
Lesson
•
1st - 2nd Grade
20 questions
Halves and Fourths
Quiz
•
1st Grade
