Tag the questions with any skills you have. Your dashboard will track each student's mastery of each skill.
Give this quiz to my class
Q 1/16
Score 0
Which of the following Python code snippets correctly uses sequence and selection to check if a user is old enough to vote (18 or older)?
30
age = int(input("Enter age: "))\nif age = 18:\n print("You can vote")
age = input("Enter age: ")\nif age > 18:\n print("You can vote")
if age >= 18:\n print("You can vote")\nage = int(input("Enter age: "))
age = int(input("Enter age: "))\nif age >= 18:\n print("You can vote")
Q 2/16
Score 0
Consider the following code:
x = 10
y = 5
if x > y:
x = x - 2
y = y + 3
print(x + y)
What value is printed after this sequence and selection are executed?
30
15
16
18
13
16 questions
Q.
Which of the following Python code snippets correctly uses sequence and selection to check if a user is old enough to vote (18 or older)?
1
30 sec
Q.
Consider the following code:
x = 10
y = 5
if x > y:
x = x - 2
y = y + 3
print(x + y)
What value is printed after this sequence and selection are executed?
2
30 sec
Q.
In Python, which term describes the structure where the computer executes instructions one after another from top to bottom, and which term describes choosing a path based on a condition?
3
30 sec
Q.
What will be the output of the following Python program?\n\nscore = 50\nif score < 50:\n score = score + 10\nelse:\n score = score - 10\nprint(score)
4
30 sec
Q.
Which code snippet correctly demonstrates the sequence of taking a numerical input and using selection to check if the number is even?
5
30 sec
Q.
What will the output of the following Python code be?\n\na = 10\nb = 20\nif a > b:\n print("Blue")\na = b\nif a == b:\n print("Red")
6
30 sec
Q.
Which of these Python codes shows the correct sequence to calculate a discounted price only if the original price is greater than 100?
7
30 sec
Q.
Which of the following describes the effect of changing the sequence of lines in this code snippet?\n\nLine 1: x = 5\nLine 2: x = x + 2\nLine 3: if x > 5:\nLine 4: print("Large")
8
30 sec
Q.
Identify the output of this Python program:
points = 10
points = points + 5
if points >= 15:
points = points * 2
if points < 20:
points = points + 5
print(points)
9
30 sec
Q.
What is the final value of the variable 'result' after the following code runs?\n\nx = 15\nresult = 0\nif x > 10:\n result = x * 2\nif x > 20:\n result = x + 5\nelse:\n result = result - 5
10
30 sec
Q.
Which of the following lines of Python code will cause a Syntax Error?
11
30 sec
Q.
Which of these Python snippets will result in a Syntax Error due to incorrect keyword usage?
12
30 sec
Q.
Which of the following code snippets will trigger a Syntax Error in Python?
13
30 sec
Q.
Which of the following examples will produce a 'SyntaxError' in Python?
14
30 sec
Q.
Which of the following would Python identify as a Syntax Error?
15
30 sec
Q.
Which of the following code snippets will trigger a Syntax Error due to an incorrectly closed bracket?