Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Chapter 1: Statements Introduction

Total questions: 10

Worksheet time: 5mins

Name
Class
Date
1.

Programs typically execute how, with respect to statements?

a)

One after another sequentially

b)

Only upon user events

c)

All at once concurrently

d)

Randomly chosen per cycle

2.

What does the end parameter in Python's print() function control?

a)

Default text encoding used

b)

Spacing between printed values

c)

Order of arguments printed

d)

String appended after the output

3.

Which symbol is used as the assignment operator in Python?

a)

colon :

b)

double equals ==

c)

single equals =

d)

arrow ->

4.

You run code: print "Hello" and see a caret under the H in Hello plus a message: SyntaxError: Missing parentheses in call to 'print'. What does the error message primarily tell you?

a)

The version of the Python interpreter

b)

The operating system details

c)

The variable values at the crash

d)

The type and location of the error

5.

A programmer writes prints("Hello"). Which error will occur and why?

a)

IndentationError because leading spaces exist

b)

RuntimeError because function returns None

c)

SyntaxError because quotes are mismatched

d)

NameError because prints is undefined

6.

Choose the most informative comment for a line that asks the user for meal choice.

a)

# Input item1 and item2

b)

# Get the user's preference

c)

# Ask question to user

d)

# Menu choice

7.

Which statement about hash characters inside strings is correct?

a)

Inside strings, # becomes a docstring

b)

Inside strings, # starts a comment

c)

Inside strings, # is regular text

d)

Inside strings, # breaks execution

8.

இந்த குறியீட்டின் வெளியீடு என்ன: print("Hello, World!")?

a)

வணக்கம், உலகம்!

b)

SyntaxError

c)

None

d)

TypeError

9.

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

a)

myFunc() = function:

b)

function myFunc():

c)

def myFunc[]:

d)

def myFunc():

10.

What does the 'len()' function do in Python?

a)

Returns the length of an object

b)

Creates a new object

c)

Converts an object to a list

d)

Checks if an object is empty