Python If

Quiz
•
Computers
•
University
•
Medium
Tasanawan Soonklang
Used 25+ times
FREE Resource
7 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the result of this command?
x = 5; y = 2
print(x != y)
True
False
Error
Answer explanation
x != y
means " x is not equal to y"
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the result of this command
print("SIIT" > "TU")
True
False
Error
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
x * (-1) ** 2 + 3 / (2 * x)
x * (-1) ** 2 + 3 / 2 * x
(x * (-1) ** 2 + 3) / 2 * x
Answer explanation
x * (-1) ** 2 + 3 / 2 * x
check the precedence rules,
** highest level
*, /
+ lowest level
so the order of operators are
(-1) ** 2 -> [1]
x * [1] -> [2]
3/2 -> [3]
[3] * x -> [4]
[2] + [4] -> (x*(-1)**2)+((3/2)*x)
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
if x == 0:
if x > 0:
if x < 0:
if x != 0:
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the result of this program if
x = 100?
Perfect!
Perfect!
Pass
Pass
Perfect!
Invalid score
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the result of this program if
x = 40?
Pass
Fail
Pass
Fail
Invalid score
7.
REORDER QUESTION
1 min • 1 pt
Reorder the following to check a leap year as rules below
• Any year that is divisible by 400 is a leap year.
• Of the remaining years, any year that is divisible by 100 is not a leap year.
• Of the remaining years, any year that is divisible by 4 is a leap year.
• All the remaining years are not leap years.
if year % 400 == 0:
leap = True
elif year % 4 == 0:
leap = True
else:
leap = False
elif year % 100 == 0:
leap = False
Similar Resources on Wayground
12 questions
INFT124 Week 6 Quiz review

Quiz
•
University
10 questions
Machine Learning - Unit 1 - Quiz 1

Quiz
•
University
10 questions
Round 2: Some details about the Program :)

Quiz
•
University
12 questions
Programación Python

Quiz
•
University
10 questions
PREDICATE LOGIC

Quiz
•
University
10 questions
0xDebug - Python

Quiz
•
University
12 questions
Operators in C

Quiz
•
University
10 questions
Augmented Reality

Quiz
•
University
Popular Resources on Wayground
10 questions
Lab Safety Procedures and Guidelines

Interactive video
•
6th - 10th Grade
10 questions
Nouns, nouns, nouns

Quiz
•
3rd Grade
10 questions
9/11 Experience and Reflections

Interactive video
•
10th - 12th Grade
25 questions
Multiplication Facts

Quiz
•
5th Grade
11 questions
All about me

Quiz
•
Professional Development
22 questions
Adding Integers

Quiz
•
6th Grade
15 questions
Subtracting Integers

Quiz
•
7th Grade
9 questions
Tips & Tricks

Lesson
•
6th - 8th Grade
Discover more resources for Computers
21 questions
Spanish-Speaking Countries

Quiz
•
6th Grade - University
20 questions
Levels of Measurements

Quiz
•
11th Grade - University
7 questions
Common and Proper Nouns

Interactive video
•
4th Grade - University
12 questions
Los numeros en español.

Lesson
•
6th Grade - University
7 questions
PC: Unit 1 Quiz Review

Quiz
•
11th Grade - University
7 questions
Supporting the Main Idea –Informational

Interactive video
•
4th Grade - University
12 questions
Hurricane or Tornado

Quiz
•
3rd Grade - University
7 questions
Enzymes (Updated)

Interactive video
•
11th Grade - University