NEW
Font size
WorksheetsPython Programming
Total questions: 25
Worksheet time: 12mins
Write the output of the following code:
x=2
x=5
x=x+x
print(x)
7
10
4
Error
Write the output of the following code :
x=2
y=3
x+y+5
print(x+y)
8
6
10
5
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
Which statement will display square of number (n)
print(n * n)
print(math.pow(n,2)) # math module is already imported
All of the above
Only First
Select the reserved keyword in python-
else
raise
import
All of them
What will be the output of this string operation s[2:5] , if s="hello world" -
lo
llo
llow
ell
Which of the following character is used to give single-line comments in Python?
//
#
!
/*
What will be the output?
name = 'Python'
print (type(name))
char
'Python'
str
Error
What will be the output?
d = 10 < 11
print (d)
10
11
True
False
Identify the arithmetic operator which is used to calculate exponential.
*
%
!
**
What will be the output?
str1 = "Deep Learning"
print (len(str1))
11
12
13
Out of Range Error
What will be the output?
a = 25
b = 4
print (a%b)
1
6
6.2
1.5
What will be the output ?
print (type(5 // 2))
int
float
2
2.5
A string
carries out an action
the elements of a command
a collection of characters
how elements in a commad are arranged
1. He is a Dutch Programmer known as the creator of Python?
a. Rasmus Lerdorf
b. James Gosling
c. Guido van Rossum
d. Niklaus Wirth
2. What does IDE mean?
a. Internet Detection Entertainment
b. Integrated Development Environment
c. Instantaneous Differentiation Equipment
d. Intermediate Development Element
3. Which of the following is not an IDE for Python?
a. XML
b. Pycharm
c. Visual Studio Code
d. Thonny
5. It is the process of joining two or more strings.
a. Addition
b. Concatenation
c. Integration
d. Differentiation
6. What does % math operator do?
a. To get the remainder of the two numbers.
b. To get the square root of two numbers.
c. To get the percentage from those two numbers.
d. To get the quotient of the two numbers.
7. What does == mean?
a. Assignment operator
b. Answer operator
c. Equality operator
d. Mathematical operator
8. What symbol is used to denote "not equal"?
a. *=
b. @=
c. ?=
d. !=
for i in 100 :
print ( i )
Syntax error
prints numbers 0 to 100
prints numbers 1 to 100
prints numbers 0 to 99
prints numbers 1 to 99
