Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

X-Quiz #5

Total questions: 10

Worksheet time: 5mins

Name
Class
Date
1.

Select the correct output of the following String operations.


str1 = 'Welcome' print (str1[:6] + ' PYnative')

a)

Welcome PYnative

b)

WelcomPYnative

c)

Welcom PYnative

d)

WelcomePYnative

2.

Select the correct output of the following String operations.


strOne = str("pynative")

strTwo = "pynative"

print(strOne == strTwo)

print(strOne is strTwo)

a)

False False

b)

True True

c)

True False

d)

False True

3.

Select the correct output of the following String operations.

str1 = "my isname isisis jameis isis bond";

sub = "is";print(str1.count(sub, 4))

a)

4

b)

5

c)

6

d)

7

4.

What is the output of the following code :

str1 = "My salary is 7000";

str2 = "7000";

print(str1.isdigit())print(str2.isdigit())

a)

False

True

b)

False

False

c)

True

False

d)

True

True

5.

Guess the correct output of the following code?

str1 = "PYnative"

print(str1[1:4], str1[:5], str1[4:], str1[0:-1],

str1[:-1])

a)

PYn PYnat ive PYnativ vitanYP

b)

Yna PYnat tive PYnativ vitanYP

c)

Yna PYnat tive PYnativ PYnativ

d)

PYn PYnat ive vitanYP vitanYP

6.

1. What will be the output of the following Python code?

x = ['ab', 'cd']

for i in x:

i.upper() print(x)

a)

[‘ab’, ‘cd’]

b)

[‘AB’, ‘CD’]

c)

[None, None]

d)

none of the mentioned

7.

Predict the output

a)

03

b)

00

c)

01

d)

02

8.

The smallest unit of measurement used to quantify computer data

a)

Bit

b)

Byte

c)

Nano byte

d)

Micro Bit

9.

In C language, when the ratio of loop repetition is unknown then the _______ loop is used.

Fill in the blanks

a)

for

b)

while

c)

do while

d)

nested for

10.

Predict the output of the following java program:

a)

0

b)

1

c)

2

d)

3