wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Basics of programming - Quiz - 01

Total questions: 20

Worksheet time: 40mins

Name
Class
Date
1.

Is Python case sensitive?

a)

Yes

b)

No

c)

Maybe

d)

Depends up on the version of python

2.

Which of the following is the correct extension of the Python file?

a)

.python

b)

.pl

c)

.py

d)

.p

3.

Is Python code compiled or interpreted?

a)

Python code is both compiled and interpreted

b)

Python code is neither compiled nor interpreted

c)

Python code is only compiled

d)

Python code is only interpreted

4.

Which of the following character is used to give single-line comments in Python?

a)

//

b)

#

c)

!

d)

/*

5.

Which of the following functions is a built-in function in python?

a)

fact()

b)

print()

c)

seed()

d)

squareroot()

6.

Which code is correct?

a)

ptinf("Hello World")

b)

print("Helloworld")

c)

printf "hello world"

d)

print (hello world)

7.

Which symbol is used for product calculations?

a)

x

b)

X

c)

*

d)

**

8.

Which one is integer datatype?

a)

w=1

b)

x=10.00

c)

y=010010123459714523697

d)

z=xa

9.

Select the string datatypes.

a)

+91547963

b)

B+ve

c)

1243

d)

5679 222^2  

10.

Dictionary is an unordered set of a key-value pair of items. This statement is.......

a)

True

b)

False

11.

Which of the following is invalid?

a)

_a = 1

b)

__a = 1

c)

__str__ = 1

d)

none of the mentioned

12.

Which of the following is an invalid variable?

a)

my_string_1

b)

1st_string

c)

foo

d)

_

13.

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

14.

What is the answer to this expression, 22 % 3 is?

a)

7

b)

1

c)

0

d)

5

15.

Mathematical operations can be performed on a string.

a)

True

b)

False

16.

Which of these in not a core data type?

a)

Lists

b)

Dictionary

c)

Tuples

d)

Class

17.

What will be the output of the following Python code?

1. >>> str = "hello"

2. >>> str[ :2]

a)

he

b)

lo

c)

olleh

d)

hello

18.

What data type is the object below?

L = [1, 23, 'hello', 1]

a)

list

b)

dictionary

c)

array

d)

tuple

19.

In order to store values in terms of key and value we use what core data type.

a)

list

b)

tuple

c)

class

d)

dictionary

20.

>>> grade1 = 80

>>> grade2 = 90

>>> average = grade1 + grade2 / 2

What is the average value of the following Python code snippet?

a)

85.0

b)

85

c)

125.0

d)

125