1. What is the output of the following for loop and range() function
for num in range(-2,-5,-1):
print(num, end=", ")
Assignment 2(CIVIL)
Quiz
•
Computers
•
University
•
Hard
D. CSE2481
Used 2+ times
FREE Resource
25 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
1. What is the output of the following for loop and range() function
for num in range(-2,-5,-1):
print(num, end=", ")
-2, -1, -3, -4
-2, -1, 0, 1, 2, 3,
-2, -1, 0
-2, -3, -4,
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Given the nested if-else structure below, what will be the value of x after code execution completes
x = 0
a = 0
b = -5
if a > 0:
if b < 0:
x = x + 5
elif a > 5:
x = x + 4
else:
x = x + 3
else:
x = x + 2
print(x)
2
0
3
4
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the output of the following range() function
for num in range(2,-5,-1):
print(num, end=", ")
2, 1, 0
2, 1, 0, -1, -2, -3, -4, -5
2, 1, 0, -1, -2, -3, -4
2, 1, 0, -1, -2
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the output of the following if statement
a, b = 12, 5
if a + b:
print('True')
else:
print('False')
False
True
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following is a valid conditional statement in Python?
if a = 5:
if a == 5:
if a <> 5:
if (a = 5):
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the outcome if the elif and else blocks are missing in an if statement?
Syntax error
he program will stop
Nothing, it's optional
Runtime error
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the output of the following code?
x = 10;
if x > 5:
print("Greater")
Error
Greater
Nothing
Less
30 questions
Coding Competation(Round 1)
Quiz
•
University
20 questions
Code Junction 4
Quiz
•
University
20 questions
Python Programming Quiz
Quiz
•
9th Grade - University
20 questions
TECHFEST QUALIFYING ROUND
Quiz
•
University
20 questions
Week 6 Quiz
Quiz
•
University
20 questions
Geeks for Geeks PCCOER Info Session CP Quiz
Quiz
•
University
20 questions
kuis pertama
Quiz
•
University
22 questions
EXCEPTION HANDLING IN PYTHON
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