WorksheetsX-Quiz #5
Total questions: 10
Worksheet time: 5mins
Select the correct output of the following String operations.
str1 = 'Welcome' print (str1[:6] + ' PYnative')
Welcome PYnative
WelcomPYnative
Welcom PYnative
WelcomePYnative
Select the correct output of the following String operations.
strOne = str("pynative")
strTwo = "pynative"
print(strOne == strTwo)
print(strOne is strTwo)
False False
True True
True False
False True
Select the correct output of the following String operations.
str1 = "my isname isisis jameis isis bond";
sub = "is";print(str1.count(sub, 4))
4
5
6
7
What is the output of the following code :
str1 = "My salary is 7000";
str2 = "7000";
print(str1.isdigit())print(str2.isdigit())
False
True
False
False
True
False
True
True
Guess the correct output of the following code?
str1 = "PYnative"
print(str1[1:4], str1[:5], str1[4:], str1[0:-1],
str1[:-1])
PYn PYnat ive PYnativ vitanYP
Yna PYnat tive PYnativ vitanYP
Yna PYnat tive PYnativ PYnativ
PYn PYnat ive vitanYP vitanYP
1. What will be the output of the following Python code?
x = ['ab', 'cd']
for i in x:
i.upper() print(x)
[‘ab’, ‘cd’]
[‘AB’, ‘CD’]
[None, None]
none of the mentioned
Predict the output
03
00
01
02
The smallest unit of measurement used to quantify computer data
Bit
Byte
Nano byte
Micro Bit
In C language, when the ratio of loop repetition is unknown then the _______ loop is used.
Fill in the blanks
for
while
do while
nested for
Predict the output of the following java program:
0
1
2
3
