wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Python Basic

Total questions: 38

Worksheet time: 20mins

Name
Class
Date
1.

Which one is correct print command?

a)

print("Hello world!")

b)

print"Hello world!"

c)

print(Hello world!)

d)

print Hello world!

2.

Which one is correct input command?

a)

name=input(Enter your name)

b)

name=input("Enter your name")

c)

name=input"Enter your name"

d)

name=("Enter your name")

3.

What is the function of the "int" command in python?

a)

Print commands

b)

Input data from the user

c)

Enter data to the output

d)

Converts input to an integer

4.

We use _________to store values that can be used to control commands in our code. We can also alter these values throughout the code.

a)

Value

b)

Constant

c)

Iteration

d)

Variable

5.

We can use _________ from the user to control our code.

a)

print

b)

variable

c)

input

d)

output

6.

We can tell the computer how to make decisions using _________________. Make sure that all the code inside your if/else statement is indented one level!

a)

Loop

b)

if/else statements

c)

print()

d)

variable

7.

What is the function of the tag below?

a)

store meta information about the title

b)

show the server how to index the website

c)

show the title of the website for the browser and search engine result

d)

show the server how to title the website

8.

What is an HTML element?

a)

What is an HTML element?What is an HTML element?What is an HTML element?What is an HTML element?What is an HTML element?

b)

start tag and an end tag, with content in between

c)

everything which is visible when viewing the site

d)

everything inside the head tag

9.

2) What symbol do you use to make a comment in Python?

a)

¬

b)

@

c)

#

d)

\

10.

What data type is 1 letter e.g. f

a)

String

b)

Char

c)

Float

d)

Integer

11.

What is syntax in python?

a)

Syntax is the word used to describe a computer error

b)

It is used to output information

c)

It is used to read information

d)

Syntax is the rules of the programming language

12.

7) To make a value stored in python as an Integer. Which function is used?

a)

word integer

b)

number

c)

num

d)

int

13.

The symbol that must be at the end of the line for if, while, for is:

a)

,

b)

;

c)

.

d)

:

14.

What is the data type for a whole number?

a)

String

b)

Boolean

c)

Float

d)

Integer

15.

What does INT do?

a)

Converts the specified value into an integer number

b)

Inputs number

c)

prints the output

d)

Ask user to input a value

16.

What does the print function do in python?

a)

It can input data.

b)

It's a variable.

c)

It displays something like a string or integer

d)

It loops the code.

17.

How do you display text?

a)

input

b)

print

c)

output

d)

variable

18.

What will the output?

a)

nothing

b)

display I do not know you

c)

display Hello Rashed

d)

Syntax error

19.

What does an IF statement do?

a)

Closes the program

b)

Asks a question

c)

Makes a decision

d)

Starts the program

20.

The correct way to write a variable in Python?

a)

my_variable = 10

b)

my_variable: 10

c)

my_variable is 10

d)

my variable = 10

21.

Which function converts data to an integer

a)

input()

b)

print()

c)

def

d)

int()

22.

How do you create a variable with the numeric value 5?

a)

x=5

b)

Both the other answers are correct

c)

x = int(5)

d)

x 5

23.

In Python, 'Hello', is the same as "Hello"

a)

True

b)

False

24.

How do you start writing an if statement in Python?

a)

if x > y:

b)

if (x > y)

c)

if x > y then:

d)

if x < y):

25.

What would be the output?

a)

x

b)

6

c)

error

d)

User to enter a number

26.

What is the output of the code below?

a)

Syntax error

b)

print line 3 and line 4 need to be indented

c)

else should not be indented

d)

Ask the user to enter their age

27.

There are ____ types of tag.

a)

3

b)

2

c)

1

d)

4

28.

What will be the output for the following program?

a)

<Hello SJPS>

b)

Hello SJPS

c)

both are correct

d)

Error

29.

Which is the correct tag to insert an image?

a)

<img src="img_football.jpg" alt="Manchester United" width="500" height="600">

b)

<img src="img_football.jpg" alt="Manchester United" width="500" height="600>

c)

img src="img_football.jpg" alt="Manchester United" width="500" height="600">

d)

<img src"img_football.jpg" alt="Manchester United" width="500" height="600">

30.

HTML is a ........................language.

a)

programming

b)

object oriented

c)

markup

d)

scripting

31.

What should a HTML web page start with?

a)

<b>

b)

<html>

c)

<li>

d)

<start>

32.

What are the 3 main parts of an HTML document ?

a)

head, paragraph tag, and html

b)

head, body and html

c)

head, body and text header

d)

html, body and tags

33.

Above is a visualization of an HTML page structure :Which of the following section is displayed in a browser?

a)

<body> section

b)

<head> section

c)

none of the above

d)

<title> section

34.

These are label pieces of content such as "heading", "paragraph", "table", and so on

a)

HTML (Hyper Text Markup Language)

b)

HTML elements

c)

Web Browsers

d)

HTML tags

35.

Container tags are also known as ______

a)

Paired tag

b)

non-paired tag

c)

Empty tag

d)

both a and c

36.
a)

Syntax error

b)

print line 3 and line 4 need to be indented

c)

else should not be indented

d)

Ask the user to enter their age

37.
a)

90

b)

6

c)

invalid code

d)

90,6

e)

6,90

38.

What does this code output?

a)

The answer to 10+10 is 20

b)

The answer to 10+10 is,20

c)

Nothing, the code is invalid.

d)

The answer to 10+10 is20