wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Python Study quiz Test 1

Total questions: 43

Worksheet time: 34mins

Name
Class
Date
1.

____________ is detected by the interpreter.

a)

  • Syntax Error

b)

  • Syntax Error

c)

Runtime Error

2.

____________ represents a computation involving values, variables, and operators that, taken together, evaluate to a value.

a)

Statement

b)

Expression

c)

Declaration

3.

What happens if the user enters 5a when executing the following code?  radius = float(input("Enter a radius: "))

a)

Value of 5 will be assigned to radius.

b)

It will cause Syntax error.

c)

It will cause an error. You have to enter a numeric value.

d)

The program will run just fine.

4.

is a software that translates python code

(a)  

5.

What is not a high-level programming language?

a)

  • Ada

b)

  • Python

c)

COBOL

d)

JavaScript

e)

  • Assembly

6.

is an operating system

(a)  

7.

 is the physical aspect of the computer that can be seen.

(a)  

8.

What is the statement to display the message "Hello world" to the console?

a)

print("hello World")

b)

print("Hello World")

c)

print(Hello World)

d)

Print(Hello World)

9.

Why do computers use zeros and ones?

a)

  • because binary numbers are simplest.

b)

  • because combinations of zeros and ones can represent any numbers and characters.

c)

  • because digital devices have two stable states and it is natural to use one state for 0 and the other for 1.

d)

because binary numbers are the bases upon which all other number systems are built.

10.

is a program that runs on a computer to manage and control a computer's activities.

(a)  

11.

____________ are instructions to the computer. Please select all that apply.

a)

Software

b)

Hardware

c)

Programs

d)

Keyboards

12.

The (a)   specifies the number of pixels in horizontal and vertical dimensions of the display device.

13.

(a)   is the brain of a computer.

14.

(a)   errors occur when a program does not perform the way it was intended to.

15.

If you forget to put a closing quotation mark on a string, what kind of error will be raised? 

Responses


a)

Logic error

b)

Syntax error

c)

Script error

d)

Runtime error

16.

What is the Python source code filename extension by convention?

a)

.python

b)

.py

c)

.pi

17.

(a)   describes how a problem is solved by listing the actions that need to be taken and the order of their executions.

18.

Python source programs are (a)   .

19.

(a)   translates high-level language program into machine language program.

20.

To run a Python source file from the windows command prompt, the (a)   command

21.

To exit Python, type the command (a)  

22.

A computer's (a)   is volatile; that ism any information stored in it is lost when the system's power is turned off.

23.

Which of the following are storage devices? Please select all that apply.

a)

portable disk

b)

CD-ROM

c)

Flash Stick

d)

hard disk

24.

(a)   is the symbol to denote a comment line in Python.

25.

(a)   is a device to connect a computer to local area network (LAN).

26.

Can a program written in Python 2 run in Python 3?

(a)  

27.

Python is a (a)   language, meaning that Python translates each statement and processes it one at a time.

28.

One byte has (a)   bits.

29.

Which of the following are the reserved words in Python? Please select all that apply.

a)

all

b)

while

c)

return

d)

with

30.

___________ errors cause python program to terminate abnormally.

a)

Logic

b)

Compiled

c)

Runtime

d)

Syntax

31.

___________ represents a value stored in the computer's memory.

a)

Variable

b)

Class

c)

Definition

d)

Import

32.

Which of the following lines is not a Python comment? Please select all that apply.


a)

/** Comment */

b)

# comments

c)

--comments

d)

"'comments'"

e)

** comments **

33.

(a)   is not a n object-oriented programming language.

34.

Show the output for the following line: print("3.5 * 4 / 2 - 2.5")

a)

4.5

b)

NameError

c)

3.5 * 4 / 2 - 2.5

35.

The ____________ statement is one of Python’s built-in functions that can be used to display a string on the console.

a)

print

b)

write

c)

read

36.

The speed of the CPU may be measured in __________. Please select all that apply.

a)

gigahertz

b)

megahertz

c)

megabytes

d)

gigabytes

37.

If your program needs to read data from a file, but the file does not exist, an error would occur when running this program. What kind of error is this?

a)

Logic

b)

Runtime

c)

Syntax

38.

Programming style is important, because ______________. Please select all that apply.

a)

good programming style helps reduce programming errors

b)

good programming style makes a program more readable

c)

good programming style can make a program run faster

d)

a program may not compile if it has a bad style

39.

____________ is to type a statement at the >>> prompt and to execute it.

a)

Interpreted mode

b)

Script mode

c)

Interactive mode

40.

A program and its data must be moved into the computer's (a)   before they can be executed by the CPU.

41.

One gigabyte is approximately ____________ bytes.

a)

1 billion

b)

1 million

c)

1 thousand

d)

1 hundred

42.

CPU understands ____________ language.

a)

machine

b)

assembly

c)

high-level

d)

none of the above

43.

Algorithms can be described in natural languages or in (a)   (natural language mixed with some programming code)