wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

python_quiz

Total questions: 25

Worksheet time: 13mins

Name
Class
Date
1.

Which of the following is not a feature of Python?

a)

High Level Language

b)

Open Source

c)

Compiled

d)

None of the above

2.

What among the following is true about scripting language?

a)

It use interpreter to translate source code into executable code

b)

Scripting executes instructions one by one

c)

Python is a scripting language

d)

All of the above

3.

Which of the following is not true?

a)

python is dynamic typed language

b)

there is no datatype in python

c)

type of data is automatically detected

d)

None of the above

4.

If we write string in triple quote, it is called ________

a)

multiline comment

b)

docstring

c)

string array

d)

none of the above

5.

What is the significance of the global keyword?

a)

It makes local variable as global

b)

It indicates to use global version of variable instead of creating local copy

c)

It converts local variable to global variable

d)

none of the above

6.

What is true about pass statement?

a)

It is used to have statement inside the block but do nothing

b)

It will create Empty Block without any executable Statement

c)

Pass statement do nothing

d)

All of the above

7.

Which of the following is not a loop in python?

a)

while

b)

for

c)

do .. while

d)

none of the above

8.

What is the output of the following code?

for i in range(1,10,2):

  print(i+1,end=' ')

a)

2 4 6 8

b)

2 4 6 8 10

c)

1 3 5 7 9 11

d)

1 3 5 7 9

9.

if L = [ ], then what L can be ?

a)

Syntax Error

b)

Empty Array

c)

Empty Tuple

d)

Empty List

10.

When you pass an array as an argument to a function in C, what actually gets passed?

a)

values of the elements of the array

b)

address of the first element of the array

c)

number of elements of the array

d)

none of the above

11.

How many book titles you can store properly if a 2-D array is declared as char title[10][15] in C?

a)

10

b)

15

c)

9

d)

Error

12.

State true or false. The C Structure stores homogeneous type of elements.

a)

True

b)

False

13.

Which of the following data types is immutable in Python?

a)

Set

b)

Dictionary

c)

List

d)

Tuple

14.

What will be the output of the following code?

print('Hello' + ' World')

a)

HelloWorld

b)

Error

c)

None of the above

d)

Hello World

15.

Which of the following is a valid way to create a function in Python?

a)

myFunction() = def:

b)

def myFunction():

c)

function myFunction():

d)

def myFunction[]:

16.

Which of the following is the correct way to declare a variable in Python?

a)

int myVariable = 10

b)

myVariable = 10

c)

myVariable: int = 10

d)

var myVariable = 10

17.

What will be the output of the following code?

for i in range(5):

  print(i*2,end=' ')

a)

0 2 4 6

b)

0 2 4 6 8

c)

0 1 2 3 4

d)

1 3 5 7 9

18.

Which of the following is a characteristic of a list in Python?

a)

Lists can contain mixed data types

b)

Lists cannot be nested

c)

Lists are immutable

d)

Lists are fixed in size

19.

What is the output of the following code?

for i in range(3):

  print(i**2,end=' ')

a)

0 1 4

b)

1 4 9

c)

0 1 2

d)

1 2 3

20.

Which of the following is a mutable data type in Python?

a)

Integer

b)

List

c)

Tuple

d)

String

21.

What will be the output of the following code?

print('Python' * 3)

a)

3 Python

b)

PythonPythonPython

c)

Python 3

d)

Error

22.

What is the output of the following code?

print('Hello' * 2)

a)

Error

b)

None of the above

c)

Hello Hello

d)

HelloHello

23.

Which of the following is a valid way to create a list in Python?

a)

list myList = []

b)

myList = list()

c)

myList: list = []

d)

list myList[]

24.

What will be the output of the following code?

for i in range(4):

  print(i*3,end=' ')

a)

1 2 3 4

b)

0 1 2 3

c)

0 3 6

d)

0 3 6 9

25.

What does Python string slicing s[:] means if s is an object of string?

a)

fetches items at offsets 0 through the end

b)

fetches items at offset 1 through the end (the sequence length).

c)

fetches items at offset 1 up to but not including last item.

d)

fetches items at offset 0 up to but not including the last item.