wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Python Exam 1

Total questions: 97

Worksheet time: 49mins

Name
Class
Date
1.

A ____-controlled loop uses a true/false condition to control the number of times it repeats.

a)

Boolean

b)

condition

c)

decision

d)

count

2.

A _____-controlled loop repeats a specific number of times.

a)

count

b)

condition

c)

Boolean

d)

decision

3.

Each repetition of a loop is known as a(n)

a)

cycle

b)

orbit

c)

revolution

d)

iteration

4.

a WHILE loop is...

a)

condition controlled

b)

count controlled

c)

loops forever

d)

never loops

5.

The -= operator is an example of a(n) operator.

a)

relational

b)

augmented assignment

c)

complex assignment

d)

reverse assignment

6.

A(n) ____ variable keeps a running total.

a)

sentinal

b)

sum

c)

total

d)

accumulator

7.

A(n) ____ is a special value that signals when there are no more items from a list of items to be processed.

a)

sentinel

b)

flag

c)

signal

d)

accumulator

8.

GIGO stands for?

a)

Gogobytes Gigibytes

b)

Garbage Input Garbage Output

c)

Garbage in Garbage Out

d)

Garbage Incorrect Garbage Output

9.

The integrity of a program’s output is only as good as the integrity of the program’s ____.

a)

compiler

b)

programming language

c)

input

d)

debugger

10.

The input operation that appears just before a validation loop is known as the ____.

a)

priming read

b)

initialization read

c)

error trap

d)

prevalidation input

11.

Validation loops are also known as ____.

a)

error traps

b)

doomsday loops

c)

error avoidance loops

d)

defensive loops

12.

A condition-controlled loop always repeats a specific number of times.

a)

True

b)

False

13.

While loop is a pretest loop

a)

True

b)

False

14.

The following statement subtracts 1 from x: x = x - 1

a)

True

b)

False

15.

It is not necessary to initialize accumulator variables.

a)

True

b)

False

16.

In a nested loop, the inner loop goes through all of its iterations for every single iteration of the outer loop.

a)

True

b)

False

17.

To calculate the total number of iterations of a nested loop, add the number of iterations of all the loops.

a)

True

b)

False

18.

Input validation loop works like this: when the user enters invalid data, it should ask the user "Are you sure? yes/no".

a)

True

b)

False

19.

This type of loop can repeat an undetermined number of times.

a)

for

b)

while

20.

A ___ error does not prevent the program from running, but causes it to produce incorrect results.

a)

syntax

b)

hardware

c)

logical

d)

fatal

21.

A ___ is a single function that the program must perform in order to satisfy the customer.

a)

Task

b)

Software requirement

c)

Prerequisite

d)

Predicate

22.

A(n) ___ is a set of well-defined logical steps that must be taken to perform a task.

a)

logarithm

b)

plan of action

c)

logic schedule

d)

algorithm

23.

An informal language that has no syntax rules and is not meant to be compiled or executed is called _______.

a)

faux code

b)

pseudocode

c)

Python

d)

flowchart

24.

A _______ is a diagram that graphically depicts the steps that take place in a program.

a)

flowchart

b)

step chart

c)

code graph

d)

program graph

25.

A sequence of characters that can be typed.

a)

LOOP

b)

STRING

c)

VARIABLE

d)

LIST

26.

A _______ is a name that references a value in the computer's memory.

a)

variable

b)

register

c)

RAM slot

d)

byte

27.

A _______ is any hypothetical person that is using a program and providing input for it.

a)

Designer

b)

User

c)

Guinea pig

d)

Test subject

28.

A string literal in Python must be enclosed in

a)

parentheses

b)

single-quotes

c)

double-quotes

d)

either single-quotes or double-quotes

29.

Short notes placed in different parts of a program explaining how those parts of the program work are called __.

a)

Comments

b)

Reference manuals

c)

Tutorial

d)

External documentation

30.

A(n) _______ makes a variable reference a value in the computer's memory.

a)

variable declaration

b)

assignment statement

c)

math expression

d)

string literal

31.

This symbol marks the beginning of a comment in Python

a)

&

b)

#

c)

++

d)

=

32.

Which of the following statements will cause an error?

a)

x = 17

b)

17 = x

c)

x = '99999'

d)

x = '17'

33.

In the expression 12 + 7, the values on the right and left of the + symbol are called:

a)

operands

b)

operators

c)

arguments

d)

math expressions

34.

This operator performs integer division:

a)

//

b)

%

c)

/

d)

*

35.

This is an operator that raises a number to a power

a)

%

b)

//

c)

**

d)

/

36.

This operator performs division, but instead of returning the quotient it returns the remainder

a)

%

b)

**

c)

//

d)

/

37.

price = 99.0 . After this statement executes, the price will be of which data type?

a)

int

b)

float

c)

currency

d)

str

38.

Which built-in function can be used to read input that has been typed on the keyboard?

a)

get_input()

b)

read_input()

c)

keyboard()

d)

input()

39.

A magic number is:

a)

a number that is mathematically undefined

b)

an unexplained value that appears in program's code

c)

a number that cannot be divided by 1

d)

a number that causes computers to crash

40.

A ____ is a name that represents a value that cannot be changed during the program's execution.

a)

named literal

b)

named constant

c)

variable signature

d)

key term

41.

Programmers must be careful not to make syntax errors when writing pseudocode programs

a)

True

b)

False

42.

In a math expression, multiplication and division take place before addition and subtraction.

a)

True

b)

False

43.

Variable names can have spaces in them.

a)

True

b)

False

44.

In Python the first character of a variable name cannot be a number.

a)

True

b)

False

45.

If you print a variable that has not been assigned a value, the number 0 will be displayed

a)

True

b)

False

46.

A _____ structure can execute a set of statements only under certain circumstances

a)

sequence

b)

circumstantial

c)

decision

d)

boolean

47.

The structure that provides one alternative path of execution:

a)

single alternative decision

b)

sequence

c)

one path alternative

d)

single execution decision

48.

A(n) ___ expression has a value of either true or false:

a)

Boolean

b)

binary

c)

decision

d)

unconditional

49.

The symbols >, <, and == are all operators.

a)

logical

b)

conditional

c)

ternary

d)

relational

50.

A(n) ___ structure tests a condition and then takes one path if true, and another if false.

a)

dual alternative decision

b)

sequence

c)

If-Then statement

d)

single alternative decision

51.

You use a(n) ___ statement to write a single alternative decision structure.

a)

test-jump

b)

if

c)

if-else

d)

if-call

52.

You use a(n) ___ statement to write a dual alternative decision structure.

a)

test-jump

b)

if

c)

if-else

d)

if-call

53.

and, or, and not are operators.

a)

relational

b)

conditional

c)

ternary

d)

logical

54.

A compound expression created with the ___ operator is true if both subexpressions are true.

a)

OR

b)

NOT

c)

AND

d)

BOTH

55.

A Boolean expression created with the ___ operator is true if either subexpressions are true.

a)

AND

b)

EITHER

c)

OR

d)

NOT

56.

The operator that takes a Boolean expression as its operand and reverses its logical value.

a)

NOT

b)

AND

c)

OR

d)

EITHER

57.

This is a boolean variable that signals when some condition exists in the program.

a)

flag

b)

signal

c)

sentinel

d)

siren

58.

You can write any program using only sequence structures.

a)

True

b)

False

59.

A program can be made of only one type of control structure. You cannot combine structures.

a)

True

b)

False

60.

Single alternative decision structure tests a condition, if true takes a path, or another path if false.

a)

True

b)

False

61.

A decision structure can be nested inside another decision structure.

a)

True

b)

False

62.

A Boolean expression created with the and operator is true only when both subexpressions are true.

a)

True

b)

False

63.

A(n) ______ is a set of instructions that a computer follows to perform a task.

a)

Compiler

b)

Interpreter

c)

Program

d)

Programming Language

64.

The physical devices that a computer is made of are referred to as

a)

hardware

b)

software

c)

the operating system

d)

tools

65.

The part of a computer that runs programs is called

a)

RAM

b)

secondary storage

c)

main memory

d)

the CPU

66.

Today, CPUs are small chips known as

a)

ENIAC's

b)

Microprocessors

c)

Memory chips

d)

Operating systems

67.

The computer stores a program while the program is running, as well as the data that the program is working with, in ___

a)

secondary

b)

the CPU

c)

main memory

d)

the microprocessor

68.

This volatile type of memory that is used only for temporary storage while a program is running

a)

RAM

b)

Secondary storage

c)

The disk drive

d)

The USB drive

69.

A type of memory that can hold data for long periods of time, even when there is no power

a)

RAM

b)

Main memory

c)

Secondary storage

d)

CPU storage

70.

A component that collects data from people or other devices and sends it to the computer is called ___

a)

an output device

b)

an input device

c)

a secondary storage device

d)

main memory

71.

A video display is a(n) ____ device.

a)

output

b)

input

c)

secondary storage

d)

main memory

72.

A ____ is enough memory to store a letter of the alphabet or a small number.

a)

byte

b)

switch

c)

transistor

d)

bit

73.

A byte is made up of eight ____.

a)

CPUs

b)

addresses

c)

variables

d)

bits

74.

In the ____ numbering system, all numeric values are written as sequences of 0s and 1s.

a)

Hexadecimal

b)

Binary

c)

Octal

d)

Decimal

75.

A bit that is turned off represents the following value.

a)

1

b)

-1

c)

0

d)

No

76.

A set of 128 numeric codes that represent the English letters, various punctuation marks, and other characters is ____.

a)

binary numbering

b)

ASCII

c)

ENIAC

d)

Unicode

77.

An extensive encoding scheme that can represent characters for many languages in the world is ____.

a)

binary numbering

b)

ASCII

c)

Unicode

d)

ENIAC

78.

Negative numbers are encoded using the ____ technique.

a)

two's complement

b)

floating point

c)

ASCII

d)

Unicode

79.

Real numbers are encoded using the ______ technique.

a)

Unicode

b)

floating point

c)

ASCII

d)

two's complement

80.

The tiny dots of color that digital images are composed of are called ______.

a)

bits

b)

bytes

c)

color packets

d)

pixels

81.

If you were to look at a machine language program, you would see ______.

a)

Python code

b)

stream of binary numbers

c)

English words

d)

circuits

82.

In the ______ part of the fetch-decode-execute cycle, the CPU determines which operation it should perform.

a)

execute

b)

deconstruct

c)

fetch

d)

decode

83.

Computers can only execute programs written in ______.

a)

Machine Language

b)

translator

c)

Assembly Language

d)

C#

84.

The ______ translates an assembly language program to a machine language.

a)

Assembler

b)

Compiler

c)

Interpreter

d)

Translator

85.

The words that make up a high level programming language are called ______.

a)

Binary instructions

b)

Mnemonics

c)

Commands

d)

Key words

86.

The rules that must be followed when writing a program are called _____

a)

Syntax

b)

Punctuation

c)

Key words

d)

Operators

87.

A(n) ___ program translates a high-level language program into a separate machine program.

a)

assembler

b)

compiler

c)

translator

d)

operators

88.

Today, CPUs are huge devices made of electrical and mechanical components such as vacuum tubes and switches.

a)

True

b)

False

89.

Main memory is also known as RAM.

a)

True

b)

False

90.

Any piece of data that is stored in a computer’s memory must be stored as a binary number.

a)

True

b)

False

91.

Images, like the ones created with your digital camera, cannot be stored as binary numbers.

a)

True

b)

False

92.

Machine language is the only language that a CPU understands.

a)

True

b)

False

93.

Assembly language is considered a high-level language.

a)

True

b)

False

94.

An interpreter is a program that both translates and executes the instructions of a program.

a)

True

b)

False

95.

A syntax error does not prevent a program from being compiled and executed.

a)

True

b)

False

96.

Windows, Linux, Android, iOS, and macOS are all examples of application software.

a)

True

b)

False

97.

Word processing, spreadsheet, email, web browsers, and games are all examples of utility programs.

a)

True

b)

False