Question 21
EasyWhat is the output of this program?
print(round(3.14159, ))
Popular companies
Prepare company by company
Hiring pattern, syllabus, past questions and mocks for each company.
All companiesPractice by subject
Programming Languages
What is the output of this program?
print(round(3.14159, ))
3.1
3
3.142
3.14
Sign up free to see the answer and a step-by-step explanation.
What is the output of this program?
a = [3, 1, 2]
print(sorted(a), a)
[1, 2, 3] [3, 1, 2]
[3, 1, 2] [1, 2, 3]
None [1, 2, 3]
[1, 2, 3] [1, 2, 3]
Sign up free to see the answer and a step-by-step explanation.
What is the output of this program?
print(10 / 4)
2.5
3
2.0
2
Sign up free to see the answer and a step-by-step explanation.
What is the output of this program?
d = {"x": 1}
print(d.get("y", 0))
None
1
0
Error
Sign up free to see the answer and a step-by-step explanation.
Which keyword defines a function in Python?
func
define
def
function
Sign up free to see the answer and a step-by-step explanation.
How does Python mark which statements belong to a block, such as a loop body?
By indentation
By semicolons
By the keywords begin and end
By curly braces { }
Sign up free to see the answer and a step-by-step explanation.
Which keyword is used to bring a module into a Python program?
require
include
using
import
Sign up free to see the answer and a step-by-step explanation.
What is the output of this program?
a = [1, 2, 3]
b = a
b.append(4)
print(a, b)
[1, 2, 3] [1, 2, 3, 4]
[1, 2, 3, 4] [1, 2, 3]
[1, 2, 3, 4] [1, 2, 3, 4]
Error
Sign up free to see the answer and a step-by-step explanation.
What is the output of this program?
def add(x, items=[]):
items.append(x)
return items
print(add(1), add(2))
[1] [2]
[1] [1, 2]
Sign up free to see the answer and a step-by-step explanation.
What is the output of this program?
print(dict(zip(['a', 'b'], [1, 2])))
Error
{'b': 2, 'a': 1}
Sign up free to see the answer and a step-by-step explanation.
Error
[1, 2] [1, 2]
[('a', 1), ('b', 2)]
{'a': 1, 'b': 2}