Find the output of the following program:
a = {i: i * i for i in range(6)} print (a)
PYTHON APTITUDE
Quiz
•
Information Technology (IT)
•
University
•
Hard
vanitha lawrance
Used 5+ times
FREE Resource
12 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Find the output of the following program:
a = {i: i * i for i in range(6)} print (a)
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the output of the following program :
print 0.1 + 0.2 == 0.3
0.3
False
Error
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the output of this program?
Runtime Error
16
Indentation Error
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the output of the expression : 3*1**3
1
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the output of the following program :
0
1
2
3
0
0
1
2
0
0
1
2
Error
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which line of code produces an error?
(a) “one” + “2”
(b) ‘5’ + 6
(c) 3 + 4
(d) “7” + ‘eight’
(a)
(b)
(c)
(d)
Answer explanation
The correct answer is (b) '5' + 6.
In Python, you cannot concatenate (add) a string and an integer directly. '5' is a string and 6 is an integer, so attempting to add them together will result in a TypeError.
Here's a breakdown of the other options:
(a) "one" + "2" is a valid string concatenation.
(c) 3 + 4 is a valid integer addition.
(d) "7" + 'eight' is a valid string concatenation.
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Identify the invalid variable name in python?
(a) this_is_a_variable = 7
(b) abc = 10.22
(c) ThisBook = “python”
(d) %name = “xyz”
(a)
(b)
(c)
(d)
12 questions
Review loops
Quiz
•
8th Grade - University
15 questions
Bài 29
Quiz
•
10th Grade - University
9 questions
Condition Programming Quiz
Quiz
•
1st Grade - University
10 questions
高二資訊課補考題目
Quiz
•
11th Grade - University
13 questions
Search questions from Quizizz Library
Quiz
•
University
12 questions
Python Programming Competition
Quiz
•
University
15 questions
Java_MCQ_3
Quiz
•
University
17 questions
Codean - Java Loop
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