Font size
Worksheetspython
Total questions: 30
Worksheet time: 20mins
Which operator is used in Python to import modules from packages?
.
"->"
&
*
Which translates source code into object code?
compiler
assembler
interpreter
all
print(9//3,9/3)
3 3.3
3.3 3
3.0 3.3
3.3 3.3
Valid operation?
'2'-'1'
'third'*'2'
'sum'**3
"2"+"1"
What is the output of this expression, 3*1**3?
3
21
9
33
print(1.1+2.2==3.3)
True
False
Error
3.3
Suppose the following statements are executed:
a = 100 b = 200
What is the value of the expression a and b?
200
100
0
False
What is the output of “hello”+1+2+3 ?
hello123
hello
Error
hello6
str1 = "My salary is 7000"; str2 = "7000" print(str1.isdigit()) print(str2.isdigit())
False True
False False
True False
True True
What is the output for − 'python ' [-3]?
o
t
h
negative index error
What is the slice expression that gives every third character of string s, starting with the last character and proceeding backward to the first?
(a)
print(-18//-2)
print(18//2)
print(18/2)
print(18%2)
print(str(18/2))
find output
9.0
9
9.0
0
9.0
9
9
9.0
0
"9.0"
9
9
9.0
0
9.0
9
9
9.0
0
90
x = 10
y = 50
if x ** 2 > 100 and y < 100:
print(x, y)
find output
NONE
Error
10,50
100
4 is 100 in binary and 11 is 1011. What is the output of the following bitwise operators?a = 4
b = 11
print(a | b)
print(a >> 2)
15
0
0
15
15
1
1
15
y = 10
x = y += 2
print(x)
12
10
0
Error
print(int(12.53))
print(round(12.53))
print(round(12.36,1))
13
12
12.4
12
13
12.4
12
13
12.3
error
Single line comment Symbol?
//
/
$
#
Choose the correct function to get the character from ASCII number
ascii(number)
char(number)
chr(number)
ord(number)
str1 = 'Welcome'
print (str1[:6] + ' PYnative')
Welcome PYnative
WelcomPYnative
Welcom PYnative
WelcomePYnative
str1 = "PYnative"
print(str1[1:4], str1[:5], str1[4:], str1[0:-1], str1[:-1])
Yna PYnat tive PYnativ PYnativ
PYn PYnat ive PYnativ vitanYP
PYna PYnat ive PYnativ vitanYP
Yna PYnat ive PYnativ vitanYP
type('Hello, World!') output of the given code.
<type 'int'>
<type 'float'>
<type 'str'>
<type 'chr'>
What is an Algorithm?
A flowchart
A decision
A Pseudocode
Step by step instructions used to solve a problem
In a flowchart a calculation (process) is represented by
A rectangle
A parallelogram
A rhombus
A circle
The function pow(x,y,z) is evaluated as:
(x**y)**z
(x**y) / z
(x**y) % z
(x**y)*z
print("welcome0",end=" ")
print("welcome0")
welcome#welcome0
welcome#
welcome0
welcome welcome0
Invalid
Which method should I use to convert String "welcome to the beautiful world of python" to "Welcome To The Beautiful World Of Python"
capitalize()
title()
swapcase()
eachcap()
str = "my name is James bond"; print (str.capitalize())
My Name Is James Bond
TypeError: unsupported operand type(s) for * or pow(): 'str' and 'int'
My name is james bond
not a function
python built in functions
pow()
Len()
len()
length()
python keywords
str()
if
else
For
decimal equivalent for (110001)2
49
48
32
16
