wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Python Revision

Total questions: 53

Worksheet time: 41mins

Name
Class
Date
1.

Which of the following is the correct syntax for the input ( ) function in Python?

a)

a) input("Enter your name: ")

b)

b) Input("Enter your name: ")

c)

c) input["Enter your name: "]

d)

d) INPUT("Enter your name: ")

2.

(a)   is the correct syntax for the input ( ) function in Python?

3.

What does the print ( ) function do in Python?

a)

a) Accepts user input

b)

b) Displays output to the console

c)

c) Performs mathematical operations

d)

d) Reads data from a file

4.

Which of the following statements is true about the print ( ) function?

a)

a) It returns a value

b)

b) It can only display integers

c)

c) It can display strings and variables

d)

d) It can execute conditional statements

5.

print( ) in Python is a/an..............

a)

a) Identifier

b)

b) function

c)

c) data type

d)

d) None

6.

Commenting in Python can be done by using ...........

a)

a) @

b)

b) DoubleQuotes“”

c)

c) #

d)

d) None

7.

Which of the following are valid Python variable names?

a)

a) total123

b)

b) ca$h

c)

c) abc_abc_

d)

d) If

8.

An identifier in python is the name allocated to any variable.

a)

True

b)

False

9.

Input occurs when the syntax of a statement is wrong.

a)

True

b)

False

10.

turtle.left (angle) turns the pointer left to the given angle.

a)

True

b)

False

11.

print (‘Hello world’) and print (“Hello world”) will give the same output.

a)

True

b)

False

12.

print (‘Hello world’) and print (“Hello world”) will give the same output.

a)

True

b)

False

13.

a*b and a**b give the same output.

a)

True

b)

false

14.

List is a data type in Python that is used to store multiple values in a single item.

a)

True

b)

false

15.

Index is the position of an element in String or List data types.

a)

true

b)

false

16.

Distance can be defined using pixel Python turtle.

a)

True

b)

False

17.

turtle. move(10) is used to move forward.

a)

True

b)

False

18.

… (a)   …… represents the index from which the elements are to be accessed.

19.

The print () function in Python is used to … (a)  

20.

Print () in Python is a …………….

(a)  

21.

The ……… function, used to find the data type of a variable

a)

type()

b)

print()

c)

if()

d)

pop()

22.

The len( ) function gives the ………….. of the characters present in a String.

a)

count

b)

speech

c)

sound

d)

uncount

23.

The upper( ) function converts all the characters to ………...

a)

title

b)

lowercase

c)

uppercase

d)

max

24.

…….... provides a virtual canvas where you can draw pictures and attractive shapes.

a)

turtle

b)

Birds

c)

lion

d)

flies

25.

The title( ) function converts the …....…… character of each word into uppercase.

a)

last

b)

first

c)

next

d)

second

26.

What are the Reserved words/Keyword?

a)

none of these

b)

Words that have a predefined meaning in a programming language

c)

Words that have a defined meaning

d)

Names that have a predefined meaning

27.

Give an example of the Literal?

a)

(“Enter a number: ”)

b)

"9()"

c)

"(())"

d)

name

28.

What is a Delimiter?

a)

(" ")

b)

None of these

c)

They are symbols performing three special roles in python.

d)

They are elements in python.

29.

Give an example of the identifier?

a)

name=

b)

print ()

c)

type()

d)

if()

30.

What is an Operator?

a)

to perform an operation in a python expression.

b)
  • (+) Sign

c)

??

d)

@!

31.

Give an example of the symbol used for string concatenation?

a)

the + operator can be used to combine two strings

b)

**

c)

(num1)+str1

d)

//

32.

What do you use to store items in the list?

a)

the **

b)

the ( )

c)

the [ ] brackets

d)

the " "

33.

What is the symbol of the Escape character?

a)

\\

b)

\n

c)

**

d)

%

34.

How can you display a variable value along with a String?

(a)  

35.

Write an example of the .count( ) function?

a)

print(phrase. count(“sea”))

b)

print(phrase. pop(“”))

c)

print(phrase. upper())

d)

Print()

36.

Two Python numeric data types are ……… and …………….

a)

a) Int and float.

b)

b) String and Boolean.

c)

c) Even num.

d)

d) An Odd num.

37.

An operator ………. is used for floor division.

a)

a) =

b)

b) //

c)

c) **

d)

d) none

38.

.………… is a decimal number.

a)

a) Integer

b)

b) Bool

c)

c) Float

d)

d) String

39.

…………… is a whole number that can be positive or negative, including zero.

a)

a) Integer

b)

b) Bool

c)

c) Footer

d)

d) All the above

40.

Which of the following options is valid in Python variable names?

a)

a) Student_list

b)

b) happy)

c)

c) “Citations$

d)

d) All the above

41.

…………… are a series or a sequence of alphabetical, numbers, and special character that enclosed in single(‘ ’) or double(“ ”) quotes.

a)

a) Float

b)

b) Bool

c)

c) String

d)

d) none of the above

42.

Which is the correct way of declaring a variable x, and assigning a value 10 to it.

a)

a) int x
x=10

b)

b) int x=10

c)

c) x=10

d)

d) None of the above

43.

What will be the output of the following code snippet?
x = 5
y = "10"
z = x + int(y)
print(z)

a)

a) 510

b)

b) 15

c)

c) "510"

d)

d) Error

44.

Which operator is used for exponentiation in Python?

a)

a) **

b)

b)^

c)

c) "^

d)

d) ^*

45.

A ………… is a collection of items in an ordered and sequenced.

a)

a) Integer

b)

b) List

c)

c) Float

d)

d) String

46.

…….. is the symbol used for String Slicing

a)

x=[2:5:6]

b)

y=456

c)

#

d)

my string = (“Welcome to Python”)

47.

The items in a String can be stored within……........

a)

my string = (“Welcome to Python”)

b)

x=[2:5:6]

c)

y=8,9,0

d)

#

48.

Commenting in Python can be done by using:…

a)

#

b)

%

c)

&

d)

**

49.

Find the mistakes and correct the program given below:

print “Welcome to Python)”
name1 = “Nina”
print (name”

4 lines
50.

Find the output of the program given below:
Num1=20
Num2=25
print(“printing Num1: ”,num1)
print(“printing Num2: ”,num2)

4 lines
51.

Look at the String given below:
“it is a Beautiful Day”
In the program, it converts the entire String to capital letters. It uses slicing to separate the String. Write the output .
Program:
my_string="it is a Beautiful Day"
print(my_string.upper())
str=my_string[8:]
print(str.upper())

4 lines
52.

Look at the String given below:
“It is a beautiful day.”
Find out the output of the String with index values 0, 4, 8, 12.
Program:
strg = "It is a beautiful day."
print(strg[0])
print(strg[4])
print(strg[8])
print(strg[12])

4 lines
53.

What would happen if a decimal number like 2.9 is converted to an integer?
Write the output of the program.
Code:
x=2.9
y=int(x)
print(y)

(a)