What does the following code snippet do?
my_list = [1, 2, 3, 4, 5]
result = [num for num in my_list if num % 2 == 0]
PYTHON - 14.07.2023
Quiz
•
Computers
•
University
•
Hard
N.ILAYARAJA IT
Used 2+ times
FREE Resource
23 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What does the following code snippet do?
my_list = [1, 2, 3, 4, 5]
result = [num for num in my_list if num % 2 == 0]
Doubles each element in my_list
.
Filters out even numbers from my_list
.
Filters out odd numbers from my_list
.
Reverses the order of elements in my_list
.
2.
MULTIPLE SELECT QUESTION
30 sec • 1 pt
Which of the following are true of Python lists
A given object may appear in a list more than once
There is no conceptual limit to the size of a list
These represent the same list:
['a', 'b', 'c']
['c', 'a', 'b']
All elements in a list must be of the same type
A list may contain any type of object except another list
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is a keyword?
Reserved Word
Predefined Word
Keywords are part of the syntax and they cannot be used as an identifier.
All of them
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
def m(list):
v = list[0]
for e in list:
if v < e: v = e
return v
values = [[3, 4, 5, 1], [33, 6, 1, 2]]
for row in values:
print(m(row), end = " ")
3 33
1 1
5 6
5 33
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Identify the arithmetic operator which is used to calculate exponential.
*
%
!
**
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is output for − min(''hello world'')
e
a blank space character
w
none
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the output of the following code?
print(type(3.14))
int
float
str
bool
22 questions
EXCEPTION HANDLING IN PYTHON
Quiz
•
University
20 questions
Python Strings
Quiz
•
University
20 questions
Basics of programming - Quiz - 01
Quiz
•
University - Professi...
20 questions
Python Programming Quiz
Quiz
•
9th Grade - University
20 questions
COMP177 Module 3 Quiz
Quiz
•
University
20 questions
Python Recap
Quiz
•
7th Grade - University
20 questions
AI BootCamp: 2024 Edition- Session 1
Quiz
•
University
20 questions
Geeks for Geeks PCCOER Info Session CP Quiz
Quiz
•
University
15 questions
Character Analysis
Quiz
•
4th Grade
17 questions
Chapter 12 - Doing the Right Thing
Quiz
•
9th - 12th Grade
10 questions
American Flag
Quiz
•
1st - 2nd Grade
20 questions
Reading Comprehension
Quiz
•
5th Grade
30 questions
Linear Inequalities
Quiz
•
9th - 12th Grade
20 questions
Types of Credit
Quiz
•
9th - 12th Grade
18 questions
Full S.T.E.A.M. Ahead Summer Academy Pre-Test 24-25
Quiz
•
5th Grade
14 questions
Misplaced and Dangling Modifiers
Quiz
•
6th - 8th Grade