wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Basics of Python Programming Unit-1

Total questions: 20

Worksheet time: 12mins

Name
Class
Date
1.

Who developed Python Programming Language?

a)

Wick van Rossum

b)

Rasmus Lerdorf

c)

Guido van Rossum

d)

Niene Stom

2.

Which type of Programming does Python support?

a)

object-oriented programming

b)

structured programming

c)

functional programming

d)

all of the mentioned

3.

What will be the value of the following Python expression?

4 + 3 % 5

a)

7

b)

2

c)

4

d)

1

4.

Which of the following is used to define a block of code in Python language?

a)

Indentation

b)

Key

c)

Brackets

d)

All of the mentioned

5.

Expand IDLE

(a)  

6.

What is the order of precedence in python?

a)

Exponential, Parentheses, Multiplication, Division, Addition, Subtraction

b)

Exponential, Parentheses, Division, Multiplication, Addition, Subtraction

c)

Parentheses, Exponential, Multiplication, Division, Subtraction, Addition

d)

Parentheses, Exponential, Multiplication, Division, Addition, Subtraction

7.

What is the output of the following piece of code when executed in Python shell?

>>> a=("Check")*3

>>> a

a)

(‘Check’,’Check’,’Check’)

b)

* Operator not valid for tuples

c)

(‘CheckCheckCheck’)

d)

Syntax error

8.

Which are arithmetic operators?

a)

+

b)

-

c)

>

d)

<

9.

Examples of String Literals

a)

"ABC1273"

b)

nfjdlsj@@$

c)

12638

d)

'7e920938'

10.

Which of the following is true for variable names in Python?

a)

underscore and ampersand are the only two special characters allowed

b)

unlimited length

c)

all private members must have leading and trailing underscores

d)

none of the mentioned

11.

What will be the output of the following Python statement?

>>>"a"+"bc"

a)

bc

b)

abc

c)

a

d)

bca

12.

Which one of the following is not a keyword in Python language?

a)

pass

b)

eval

c)

assert

d)

nonlocal

13.

What are the two main types of functions in Python?

a)

System function

b)

Custom function

c)

Built-in function & User defined function

d)

User function

14.

Which of the following is an invalid statement?

a)

abc = 1,000,000

b)

a b c = 1000 2000 3000

c)

a,b,c = 1000, 2000, 3000

d)

a_b_c = 1,000,000

15.

what is the output of

int('32')

a)

32

b)

'32'

c)

int

d)

str

16.

What is the output of the following code?

p, q, r = 10, 20 ,30

print(p, q, r)

a)

10 20

b)

10 20 30

c)

Error: invalid syntax

17.

x = 36 / 4 (3 + 2) 4 + 2

print(x)

a)

182.0

b)

37

c)

117

d)

The Program executed with errors

18.

What is the output of the following code?

var= 'James' * 2 * 3

print(var)

a)

JamesJamesJamesJamesJamesJames

b)

JamesJamesJamesJamesJames

c)

james

d)

Error: invalid syntax

19.

What is the output of the following code?

var1 = 1

var2 = 2

var3 = "3"

print(var1 + var2 + var3)

a)

6

b)

33

c)

123

d)

Error. Mixing operators between numbers and strings are not supported

20.

Which operator has higher precedence in the following list

a)

% (Modulus)

b)

& (BitWise AND)

c)

** (Exponent)

d)

> (Comparison)