Python Set 1: Output,
assignment, operators,
datatypes
Go to:
www.diagnosticquestions.com
Author: MangoLearning
Complete task:
Python coding: Output, assignm
ent, datatypes and operators GC
SE
Which lines contain Python syntax errors on?
1. print("Always ")
2. print("look )
A) B)
1,5 2,6
3. print("on ")
4. print("the ")
5. print("bright ")
6. print("side "
7. print("of ")
8. print("life.")
C) D)
3,7 4,8
How many arguments does the following operation have?
print(“Harry Potter”,”and”,”Ron Weasley”)
A) B)
1 3
C) D)
4 5
What data type would you use for 9.23?
A) B)
float integer
C) D)
Boolean String
What is output from the following code?
print(3 - 9)
A) B)
6 -6
C) D)
3 3–9
Which of the following Python statements will output the
value 1?
A) B)
print(5%3) print(6%3)
C) D)
print(7%3) print(8%3)
Which of the following statements are true given a=5 and b=1?
A) B)
a == b a >= 1
C) D)
b>a a !=5
What data type would you use for someone’s age
in years?
A) B)
float integer
C) D)
Character String
Which of the following contain an error?
A) B)
print(2,”two”) print()
C) D)
print(“Hi”+3) print(“2”+”3”)
What is output from the following code?
A) B)
a="3" 3bananas 3
b="bananas"
print(b+a)
C)
D)
Runtime error
bananas3
occurs
What is output from the following Python code?
print(“2”+”5”)
A) B)
7 25
C) D)
“25” “7”