wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Class 8A Unit 9.1 Python Basic

Total questions: 20

Worksheet time: 10mins

Name
Class
Date
1.

Which of the following best describes Python?

a)

Python is a high-level and interpreter based programming language.

b)

Python is a high-level programming language

c)

Statically-typed programming language

d)
Python is a low-level programming language.
2.

What is an object-oriented programming language?

a)

A language based on objects and lacking classes

b)

A language that uses only procedures and functions

c)

A language that supports objects, classes, and inheritance

d)
  • A language used only for web development

3.

Which statement is true about Python?

a)

Python is primarily used for system programming

b)

Python does not support object-oriented programming

c)

Python can be used for web development, software development, and data science

d)
  • Python codes are compiled before execution

4.

What does an 'if' statement in Python do?

a)

It stops the program

b)

It repeats a block of code multiple times

c)

It declares a variable

d)

It makes a decision based on a condition

5.

What is the correct way to start an 'if' statement in Python?

a)

if (condition)

b)

if condition:

c)

if [condition]

d)

if condition;

6.

Which of the following is an example of an 'else' statement in Python?

a)

else condition:

b)

else (condition)

c)
  • else:

d)

else [condition]

7.

What is a loop in programming?

a)

A syntax error

b)

A way to repeatedly execute a block of code

c)

A condition statement

d)
  • A function declaration

8.

What is the output of the following Python code?

if 5 > 3: print("Hello") else: print("Bye")

a)

Hello

b)
  • Bye

c)

Error

d)
  • No output

9.

What keyword is used to check multiple conditions sequentially in Python?

a)
  • switch

b)
  • for

c)
  • check

d)

elif

10.

Which of the following correctly declares a variable in Python?

a)

int x = 10

b)
  • var x = 10

c)

x = 10

d)
  • declare x = 10

11.

What symbol is used to start a block of code in Python?

a)
  • {

b)
  • (

c)

:

d)

;

12.

Which operator is used to compare two values?

a)

=

b)

==

c)

===

d)

!=

13.

What is the result of the following code if the input is 10?

  1. x = int(input())

  2. if x < 20: print("Less than 20") else: print("20 or more")

a)

Less than 20

b)

20 or more

c)

Error

d)
  • No output

14.

What will be the output?

name = 'Dave'

print (name)

a)

name

b)

(name)

c)

Dave

d)

'Dave'

15.

Which of these would work as a piece of code?

a)

IF answer == "Yes":

b)

if answer == "Yes"

c)

if answer= = "Yes":

d)

if answer = "yes":

16.

What syntax would you use to create a name variable?

a)

name=INPUT

b)

name=input{}

c)

name=input()

d)

input=name

17.

What is the answer to print( 12/6)?

a)

2

b)

6

c)

10

d)

1

18.

In the following code, n is a/an _______?

n = '5'

a)

tuple

b)

integer

c)

string

d)

operator

19.

What will the output be from the following code?

print("3+4")

a)

SyntaxError

b)

7

c)

3+4

d)

34

20.

Which is the Python logo?

a)

b)

c)

d)