wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

UNIT-1 PYTHON BASICS

Total questions: 10

Worksheet time: 5mins

Name
Class
Date
1.

What is the output of the following code?

a)

Good Bye

b)

Welcome

c)

An error message

d)

None of the above

2.

Analyze the following code and choose the most correct statement:

a)

The program runs and displays "It is even!"

b)

The program runs, but displays nothing.

c)

The program has a Syntax Error in line 1: even = false

d)

The program has an error in line 2: if Even == True

3.

Which code prints the output [3,7,8] for a given list -

[ [1,2,3] , [5,6,7] , [0,9,8] ]

a)

[i[2] for i in list]

b)

[i(2) for i in list]

c)

[i[3] for i in list]

d)

(i(3) for i in list)

4.

What will be the output of the following Python code?

str1 = 'hello'

str1=str1+2

a)

hello2

b)

Error

c)

hello

d)

hello 2

5.

Which of the following is invalid?

a)

_a=1

b)

__a=1

c)

__a__=1

d)

None of the above

6.

Q3. Which of the following is used to insert a new line in Python

a)

\n

b)

\t

c)

\N

d)

\T

7.

What is the result of this statement:

{'b', 'a', 'r'} & set('qux')

a)

{'b', 'r', 'a'}

b)

set()

c)

{'q', 'r', 'x', 'u', 'b', 'a'}

d)

{}

8.
What output will this code produce?
a)
4
b)
2
c)
3
d)
5
9.
What output will this code produce?
a)
1
b)
3
c)
2
d)
4
10.

Given the following string:

h = "Hello", which code results in an error?

a)

print (h)

b)

print(h.lower())

c)

h = 's'

d)

print(h+1)