wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Page 1

Total questions: 50

Worksheet time: 37mins

Name
Class
Date
1.

A problem-solving approach includes

a)

Coding only

b)

Testing only

c)

Algorithm and flowchart

d)

Debugging only

2.

Which data type stores unique values?

a)

List

b)

Tuple

c)

Set

d)

Dictionary

3.

Python is a

a)

Low-level language

b)

Assembly language

c)

High-level interpreted language

d)

Machine language

4.

Who developed Python?

a)

Dennis Ritchie

b)

James Gosling

c)

Guido van Rossum

d)

Bjarne Stroustrup

5.

Python programs are executed using

a)

Compiler only

b)

Interpreter

c)

Assembler

d)

Linker

6.

Which data type is immutable in Python?

a)

List

b)

Dictionary

c)

Tuple

d)

Set

7.

Which symbol is used for comments in Python?

a)

//

b)

/* */

c)

#

d)

<!-- -->

8.

Which keyword is used for conditional branching?

a)

for

b)

if

c)

while

d)

break

9.

The range(1,5) function generates

a)

1,2,3,4

b)

1,2,3,4,5

c)

0,1,2,3,4

d)

Error

10.

Which loop is used when number of iterations is known?

a)

while

b)

do-while

c)

for

d)

switch

11.

Which statement terminates a loop prematurely?

a)

continue

b)

exit

c)

break

d)

pass

12.

Which operator is used for exponentiation?

a)

^

b)

**

c)

%

d)

//

13.

What is the output of: 5//2?

a)

2.5

b)

3

c)

2

d)

Error

14.

A function is defined using keyword

a)

function

b)

define

c)

def

d)

fun

15.

Which function returns length of a string?

a)

size()

b)

count()

c)

len()

d)

length()

16.

Default arguments are

a)

Mandatory

b)

Optional

c)

Invalid

d)

Global

17.

Which operator concatenates strings?

a)

*

b)

+

c)

&

d)

%

18.

Which method converts string to uppercase?

a)

upper()

b)

capitalize()

c)

lower()

d)

swap()

19.

Lambda functions are

a)

Named functions

b)

Recursive functions

c)

Anonymous functions

d)

Built-in functions

20.

Which function is used to open a file?

a)

open()

b)

file()

c)

read()

d)

write()

21.

File opened in write mode uses

a)

r

b)

w

c)

a

d)

x

22.

Which method reads entire file content?

a)

readline()

b)

readlines()

c)

read()

d)

open()

23.

Dictionary stores data in the form of

a)

Index-value

b)

Key-value pairs

c)

Lists

d)

Sets

24.

Which symbol defines a dictionary?

a)

()

b)

[]

c)

{}

d)

<>

25.

Which method returns dictionary keys?

a)

keys()

b)

values()

c)

items()

d)

get()

26.

OOP stands for

a)

Object Oriented Programming

b)

Open Operation Program

c)

Optional Object Programming

d)

Object Operating Platform

27.

A class is

a)

Object

b)

Blueprint of object

c)

Method

d)

Variable

28.

An object is an

a)

Instance of a class

b)

Method

c)

Constructor

d)

Function

29.

Which keyword refers to current object?

a)

this

b)

self

c)

current

d)

object

30.

Constructor method in Python is

a)

init

b)

start

c)

create

d)

main

31.

Inheritance represents

a)

HAS-A relationship

b)

USES relationship

c)

IS-A relationship

d)

PART-OF relationship

32.

Which feature allows same function name with different behaviour?

a)

Encapsulation

b)

Abstraction

c)

Inheritance

d)

Polymorphism

33.

Data hiding is achieved using

a)

Polymorphism

b)

Encapsulation

c)

Inheritance

d)

Abstraction

34.

Which of the following is mutable?

a)

Tuple

b)

String

c)

List

d)

Integer

35.

Output of: print(type(10))

a)

int

b)

<class 'int'>

c)

integer

d)

number

36.

Which keyword is used to handle exceptions?

a)

try

b)

catch

c)

throw

d)

final

37.

Which block executes always?

a)

try

b)

except

c)

finally

d)

raise

38.

Python supports

a)

Only OOP

b)

Only procedural

c)

Multiple paradigms

d)

Only functional

39.

Which function takes user input?

a)

input()

b)

scan()

c)

read()

d)

get()

40.

Which statement does nothing?

a)

break

b)

continue

c)

pass

d)

return

41.

Python index starts from

a)

0

b)

1

c)

-1

d)

Any number

42.

Which operator checks equality?

a)

=

b)

==

c)

!=

d)

<=

43.

What is the output of bool(0)?

a)

True

b)

False

c)

0

d)

Error

44.

Which keyword is used to exit function?

a)

break

b)

stop

c)

return

d)

exit

45.

Python file extension is

a)

.pt

b)

.java

c)

.py

d)

.p

46.

What is the output of len([1,2,3,4])?

a)

3

b)

4

c)

5

d)

Error

47.

Which method adds element to list?

a)

add()

b)

insert()

c)

append()

d)

push()

48.

What does continue do?

a)

Stops loop

b)

Skips current iteration

c)

Ends program

d)

Restarts loop

49.

Which type of inheritance is supported by Python?

a)

Single

b)

Multiple

c)

Multilevel

d)

All of the above

50.

Which is NOT an OOP principle?

a)

Encapsulation

b)

Abstraction

c)

Compilation

d)

Polymorphism