wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

CIS-115-81 Final Exam

Total questions: 148

Worksheet time: 1hrs 16mins

Name
Class
Date
1.

Which of the following are examples of algorithms? (multiple answers allowed)

a)

A dictionary

b)

A set of instructions for putting together a utility shed

c)

A recipe

d)

The spelling checker of a word processor

2.

Which of the following contain information? (Multiple answers)

a)

A running computer

b)

An audio CD

c)

A book

d)

A refrigerator

3.

Which of the following are general-purpose computing devices?

a)

A cell phone

b)

A laptop

c)

A portable music player

d)

A programmable thermostat

4.

Which of the following are input devices?

a)

Microphone

b)

Speaker

c)

A mouse

d)

Printer

5.

Which of the following are output devices?

a)

A printer

b)

A monitor

c)

A keyboard

d)

A camera

6.

What is the purpose of the CPU?

a)

Store information

b)

Send output to the human user

c)

Receive inputs from the human user

d)

Decode and execute instructions

7.

Which of the following translates and executes instructions in the Python programming language?

a)

A compiler

b)

An interpreter

c)

A loader

d)

A text editor

8.

Which of the following outputs data in a Python program?

a)

The main function

b)

The print statement

c)

The assignment statement

d)

The input statement

9.

What is IDLE used to do?

a)

Run Python programs

b)

Edit Python programs

c)

Save Python programs to files

d)

All of the above

10.

What is the set of rules for forming sentences in a language called?

a)

Pragmatics

b)

Logic

c)

Semantics

d)
syntax
11.

Which of the following is an example of an algorithm?

a)

A dictionary.

b)

The spelling checker of a word processor.

c)

A shopping list.

d)

A recipe.

12.

Which of the following contains information

a)

An audio CD

b)

A refrigerator

c)

An automobile

d)

A stereo speaker

13.

Which of the following is a general-purpose computing device?

a)

A programmable thermostat

b)

A smartphone

c)

A microwave oven

d)

A portable music player

14.

Which of the following is an input device?

a)
Headphones
b)

Printer

c)

Monitor

d)

Microphone

15.

Which of the following are output devices?

a)

A flatbed scanner

b)

A keyboard

c)

A digital camera

d)

A monitor

16.

What is the purpose of the CPU?

a)

Receive inputs from the human user

b)

Send output to the human user

c)

Decode and execute instructions

d)

Store information

17.

Which of the following translates and executes instructions in a programming language?

a)

An interpreter

b)

A loader

c)

A compiler

d)

A text editor

18.

Which of the following outputs data in a Python program

a)

The main function

b)

The input function

c)

The assignment statement

d)

The print function

19.

What is IDLE used to do?

a)

Save Python programs to files

b)

Edit Python programs

c)

Run Python programs

d)

All of the other answers

20.

What is the set of rules for forming sentences in a language called?

a)

Logic

b)

Pragmatics

c)

Syntax

d)

Semantics

21.

Which of the following are valid variable names?

a)

2MoreToGo

b)

length

c)

_width

d)

halt!

e)

firstBase

22.

Let the variable x be "dog" and the variable y be "cat". Write the values returned by the following operations:    

x + y

a)
dogdog
b)
dogcat
c)
dog
d)
catdog
23.

Let the variable x be "dog" and the variable y be "cat". Write the values returned by the following operations:    

x * 4

a)

dog dog dog dog

b)

16

c)

444

d)

dogdogdogdog

24.

What is used to begin an end-of-line comment

a)

/ symbol

b)

* symbol

c)

# symbol

d)

% symbol

25.

Which of the following lists of operators is ordered by decreasing precedence?

a)

**, *, +

b)

+, , *

c)

+, -

d)

*, /, %

26.

The expression 2 ** 3 ** 2 evaluates to which of the following values

a)

64

b)

512

c)

8

d)

12

27.

The expression round(23.67) evaluates to which of the following values?

a)

23.7

b)

23

c)

24

d)

24.0

28.

Assume that the variable name has the value 33. What is the value of name after the assignment name = name * 2 executes

a)

66

b)

35

c)

1089

d)

33

29.

How many times does a loop with the header for count in range (10): execute the statements in its body?

a)

10

b)

12

c)

11

d)

9

30.

A for loop is convenient for? (Choose as many as apply.)

a)

running a set of statements a predictable number of times

b)

counting through a sequence of numbers

c)

counting through a sequence of numbers

d)

making choices in a program

31.

What is the output of the loop for count in range(5): print(count, end = " ")?

a)

1 2 3 4

b)

0 1 2 3 4

c)

2 3 4 5

d)

0 1 2 3 4 5

32.

When the function range receives two arguments, what does the second argument specify?

a)

The last value of a sequence of integers plus 1

b)

The last value of a sequence of integers minus 1

c)

The step value for the loop

d)

The last value of a sequence of integers.

33.

Consider the following code segment:

     x = 5
     y = 4
     if x > y:
          print(y)
     else:
           print(x

a)

4

b)

5

c)

9

d)

20

34.

A Boolean expression using the and operator returns True when

a)

one operand is false

b)

both operands are true

c)

neither operand is true

d)

one operand is true

35.

By default, the while loop is a(n)

a)

exit-controlled loop

b)

loop that iterates a definite, preestablished number of times

c)

entry-controlled loop

d)

count-controlled loop

36.

Consider the following code segment:

count = 5
while count > 1:
     print(count, end = " ")
     count -=  1

a)

5 4 3 2

b)

5 4 3 2 1

c)

1 2 3 4 5

d)

2 3 4 5

37.

Consider the following code segment, which is intended to print the integers 1 through 10:

     count = 1
     while count <= 10:
          print(count, end = " ")

Which of the following describes the error in this code?

a)

The loop is infinite

b)

The comparison points the wrong way

c)

The loop control variable is not properly initalized

d)

The loop is off by 1

38.

Consider the following code segment:

     theSum = 0.0
     while True:
          number = input("Enter a number: ")
          if number == "":
                break
          theSum += float(number)

How many iterations does this loop perform

a)

Zero or more

b)

At least one

c)

None

d)

Ten

39.

In the binary number system, each digit or bit has a positional value that is a power of what?

a)

16

b)

8

c)

2

d)

1

40.

The decimal number system, which utilizes the numbers 0-9, is also known as what number system?

a)

hexadecimal numbering system

b)

base 9 numbering system

c)

base 10 numbering system

d)

octal numbering system

41.

What file access method can be used to read a single line of input and return the line as a string, including the newline character?

a)

read

b)

fetch

c)

getline

d)

readline

42.

What happens if you attempt to access a string using an index equal to the string’s length?

a)

The name of the string will be accessed.

b)

The entirety of the string will be accessed.

c)

The string’s location in memory will be returned.

d)

An error will occur, indicating the index is out of range.

43.

What is the index of the first character in a Python string?

a)

-1

b)

undefined

c)

1

d)

0

44.

What is the value of the binary number 10010110 in base 10?

a)

150

b)

144

c)

232

d)

169

45.

What is the value of the decimal number 98 in binary?

a)

1110010

b)

110010

c)

1100010

d)

1100011

46.

What os module function returns the path of the current working directory?

a)

listdir ()

b)

cwd ()

c)

getpwd ()

d)

getcwd ()

47.

What specific Python module can you use to determine the file size in bytes of a given file?

a)

io.file

b)

os.stat

c)

os.path

d)

file.ops

48.

What statement regarding the structure of strings is accurate?

a)

A string’s length as calculated by the len() function is always "1"

b)

Surrounding a Python string with double quote marks generates a syntax error.

c)

A string cannot be decomposed into more primitive parts.

d)

A string is a sequence of zero or more characters.

49.

What string method can you use to locate the lowest index in a string named s where the substring "findme" appears?

a)

s.grep('findme')

b)

s.find("findme")

c)

s.search("findme")

d)

s.locate("findme")

50.

When a sender of information encrypts that information, what is the resulting text known as?

a)

garbage text

b)

plain text

c)

cipher text

d)

key text

51.

You are attempting to open a file containing a list of integer numbers, each on a separate line, and read them into Python as int types. What statement could you use to do this, assuming each line is represented by the line variable in a for loop?

a)

num = int(line.strip())

b)

num = line.strip()

c)

num = line.strip(int(line))

d)

num = line[:-1]

52.

A binary number is sometimes referred to as a string of bits or a bit string.

a)

True

b)

False

53.

A Caesar cipher uses a plaintext character to compute two or more encrypted characters, and each encrypted character is computed using two or more plaintext characters.

a)

True

b)

False

54.

A module behaves like a function but has a slightly different syntax.

a)

True

b)

False

55.

In Python, all data values are objects.

a)

True

b)

False

56.

The exists file system function is included in the os.path module.

a)

True

b)

False

57.

The string method isalpha returns True if the string contains only letters or False otherwise.

a)

True

b)

False

58.

The string method isnumeric returns True if the string contains only digits or False otherwise.

a)

True

b)

False

59.

The two digits in the base two number system are 0 and 1.

a)

True

b)

False

60.

Using a text editor such as Notepad or TextEdit, you can create, view, and save data in a text file.

a)

True

b)

False

61.

When you use the open function to open a file for input (i.e., you pass in 'r' as the mode string), if the file does not exist, Python raises an error.

a)

True

b)

False

62.

The encryption method that replaces a character in a text with another character some given distance away in the alphabet from the original is known as what type of cipher?

a)

Alpha cipher

b)

Alternate cipher

c)

Caesar cipher

d)

Jumble cipher

63.

What does a mode string of 'r' indicate when opening a file in Python?

a)

The file will be opened in binary mode.

b)

The file will be opened for read access.

c)

The file will be opened for write access.

d)

The file will be opened for random access.

64.

In a Python dictionary, an association is formed between a key and a(n) __________.

a)

Module

b)

Index

c)

Value

d)

List

65.

What happens if you use the following statement to sort a list of numbers called numbers? numbers = numbers.sort()

a)

The numbers list is reordered in ascending order.

b)

The numbers variable becomes a reference to a sorted list.

c)

numbers is assigned a value of None.

d)

The numbers list is reordered in descending order.

66.

What is pattern matching?

a)

using a Boolean function to test for the presence or absence of some property

b)

the use of a structure containing variables to access data within another structure

c)

the situation where two different variables refer to the same object

d)

using structural equivalence to determine object identity 

67.

What is the return value for a function whose definition includes no return statement?

a)

The function will return the special value None.

b)

The function will return a value of False.

c)

The function will return a value of True, provided there are no errors.

d)

The function will return a NULL value.

68.

What list method should you use in order to remove and return the element at the end of the list named "books"?

a)

books.pop()

b)

books.get()

c)

books.fetch()

d)

books.pull()

69.

What method should you utilize to add the elements of list2 onto the end of list1?

a)

list1.append(list2)

b)

list2.extend(list1)

c)

list2.append(list1)

d)

list1.extend(list2)

70.

What will be the range of integers included in myList after the following statement is executed?
myList = list(range(50))

a)

1 through 49

b)

0 through 50

c)

0 through 49

d)

1 through 50

71.

When creating a list of items whose structure will not change in Python, what should you ideally use to contain the values?

a)

String

b)

Tuple

c)

Dictionary

d)

List

72.

Which statement accurately describes the difference between a list and a tuple?

a)

A list is created with elements in parentheses, whereas a tuple is created with square brackets.

b)

A tuple's contents cannot be changed.

c)

A tuple can only hold integer and float data.

d)

A list is immutable, whereas a tuple is not.

73.

Which statement correctly defines the term median?

a)

A median is the value that is less than half the numbers in a set and greater than the other half.

b)

A median is the maximum value in a set—the one that is greater than all the other values.

c)

A median is the sum of all odd values in a set.

d)

A median is the minimum value in a set—the one that is smaller than all the other values.

74.

You are creating a Python script that will prompt the user to input contact names and their associated phone numbers. What data structure would be ideal for storing and accessing these associated values?

a)

A list

b)

A dictionary

c)

A tuple

d)

A string

75.

A function’s body contains one or more statements, indented below the function header.

a)

True

b)

False

76.

A list is a sequence of data values called indexes.

a)

True

b)

False

77.

A Python dictionary is written as a sequence of key/value pairs separated by commas. These pairs are called indexes.

a)

True

b)

False

78.

Each item in a list has a unique index that specifies its position.

a)

True

b)

False

79.

The == operator returns True if the variables on either side are aliases for the same object and False if they reference two different objects holding the same contents.

a)

True

b)

False

80.

The index of the first item in a Python list is 1.

a)

True

b)

False

81.

The index of the last item in a Python list is the length of the list.

a)

True

b)

False

82.

The main function usually expects no arguments and returns no value.

a)

True

b)

False

83.

The median of a list of values is the value that occurs most frequently.

a)

True

b)

False

84.

The print function strips the quotation marks from a string, but it does not alter the appearance of a list.

a)

True

b)

False

85.

In a dictionary, a -> separates a key and its value.

a)

True

b)

False

86.

The definition of the main function and the other function definitions can appear in no particular order in a Python script, as long as main is called at the very end of the script.

a)

True

b)

False

87.

What is the first argument expected by the get method for a dictionary object?

a)

a default value

b)

a list of keys

c)

a possible key

d)

an index position

88.

The list method ascending mutates a list by arranging its elements in ascending order.

a)

True

b)

False

89.

The type of statement that returns a value from a function is the

a)

return statement

b)

while statement

c)

break statement

d)

if-else statement

90.

When a function does not include a return statement, that function returns the value______.

a)

nothing at all

b)

0

c)

none

d)

false

91.

The part of the function that can vary with the context of its call is (are) its

a)

Docstring

b)

Name

c)

Return statement

d)

Arguements

92.

The part of a function that provides information about its use is (are) its

a)

Arguments

b)

Set of statements in its body

c)

Docstring

d)

Return statement

93.

A function’s parameters

a)

are always required

b)

are synonymous with the function’s arguments

c)

name variables whose values are the values of the function’s arguments when it is called

d)

are synonymous with the function’s temporary variables

94.

Top-down design is a strategy that

a)

develops the functions for a program in alphabetical order by function name

b)

starts with the main function and develops the functions on each successive level beneath the main function

c)

develops the functions for a program in a random order

d)

develops lower-level functions before the functions that depend on those lower-level  functions

95.

The relationships among functions in a top-down design are shown in a

a)

structure chart

b)

flow diagram

c)

syntax diagram

d)

table of contents

96.

The scope of a temporary variable is

a)

he entire module in which the variable is introduced

b)

the statements in the body of the function after the statement where the variable is introduced

c)

he time during which storage for the variable is available

d)

The statements in the body of the function where the variable is introduced

97.

The lifetime of a parameter is

a)

the duration of program execution

b)

 approximately one hour

c)

few microseconds

d)

the duration of its function’s execution

98.

The required arguments to a function must appear

a)

after the optional arguments

b)

before the optional arguments

c)

in any order

d)

either before or after the optional arguments

99.

A mechanism developed to simplify or hide a complex process is known by what term?

a)

abstraction

b)

diffraction

c)

obfuscation

d)

redundancy

100.

What happens when a function is called without its default arguments?

a)

An exception is raised.

b)

Their default values are automatically assigned to them.

c)

The default values are overridden by the caller’s values.

d)

Random values are automatically assigned to them.

101.

What is the first thing that happens when a Python function is called?

a)

Any imported modules are evaluated.

b)

Python evaluates the return statement expression and makes its value available to the caller. 

c)

If there are no arguments, Python returns the value None to the caller.

d)

Any expressions supplied as arguments are evaluated.

102.

What term is used for the gradual process of developing functions to solve each subproblem in a top-down design?

a)

progressing resolution

b)

stepwise refinement

c)

incremental solving

d)

procedural refinement

103.

Where can the required arguments for a function be found?

a)

in the function keyword list

b)

in the function's return list

c)

in the function header

d)

in the module docstring

104.

Which of the following statements is accurate? 

a)

Parameters for a function receive values when they are declared.

b)

When module variables are introduced in a program, they are immediately given a value.

c)

Temporary variables receive their values when the function they are associated with is called.

d)

A nested variable can assign a new value to a variable outside of its scope.

105.

A function can be called from anywhere in a program’s code, including code within other functions.

a)

True

b)

False

106.

The use of a common pool of data allows a program to grow easily as new data sources are added to the program.

a)

True

b)

False

107.

To the computer, the only meaning of a variable name is the value to which it happens to refer at any given point in program execution.

a)

True

b)

False

108.

When you design an algorithm, it should be general enough to provide a solution to many problem instances, not just one or a few of them.

a)

True

b)

False

109.

A black-and-white photograph contains more than just the black and white colors, but various shades of gray known by what term?

a)

grayscale

b)

graycurve

c)

graymap

d)

grayshade

110.

How does digital information differ from analog information?

a)

Digital information consists of discrete values, while analog information contains a continuous range of values.

b)

Digital information consists of a continuous range of values, while analog information contains a set of discrete values.

c)

Digital information can be represented as wave patterns, while analog information consists of bits.

d)

Digital information is commonly used in basic image and sound devices, such as recorded records, while analog information is used for electronic media.

111.

Programming that relies on the use of objects and methods to control complexity and solve problems is known as what type of programming?

a)

access-based programming

b)

object-based programming

c)

serial-based programming

d)

entry-based programming

112.

The drawing of simple, two-dimensional shapes, such as rectangles, triangles, pentagons, and circles, is known as what type of graphics?

a)

geometric graphics

b)

planar graphics

c)

vector graphics

d)

targeted graphics

113.

The Turtle graphics toolkit was originally developed as part of what programming language for children?

a)

LISP

b)

CKids

c)

Logo

d)

Python

114.

What coordinate system is utilized for the Turtle graphics toolkit?

a)

Cartesian system

b)

Square System

c)

polar system

d)

fractal system

115.

What does the term "sampling" imply in relation to images?

a)

the conversion of digital into analog information for display on a sampling screen

b)

the mapping of digital information in a visual format to sample analog values

c)

the utilization of a sample of data to represent a larger digital data set

d)

the process of creating sample analog information from digital information for use in computer programs

116.

What is an image's aspect ratio?

a)

the ratio of the image's bitrate to its size

b)

the ratio of the image's width to its height

c)

the ratio of the image's color gamut to its bitrate

d)

the ratio of the image's colors to their brightness

117.

What is instantiation in Python?

a)

It is the process of creating a class-based object.

b)

It is the process of creating an IDLE session that utilizes a graphics window.

c)

It is the process of calling an object’s mutator method.

d)

It is the process of calling a function that returns no object.

118.

What is the maximum number of distinct color values that can be displayed by the true color RGB system?

a)

16,384

b)

16,777,216

c)

32,768

d)

256

119.

What is the term used to describe the processing of a multi-row, multi-column grid of information using a nested loop structure?

a)

field circuit mapping

b)

row-column mapping

c)

row-major traversal

d)

grid-centric retrieval

120.

What statement accurately defines what a pixel is?

a)

A pixel is the name for the graphical draw point of any graphics generating program.

b)

A pixel is the graphical equivalent of a byte in memory and is used to store graphics data.

c)

A pixel is a colored dot, also known as a picture element, that makes up part of a display.

d)

A pixel is a graphical font, which is used to write image data onto a screen.

121.

What Turtle method is used to move a Turtle object instance t to the center of the window, pointed east?

a)

t.start()

b)

t.return()

c)

t.home()

d)

t.restart()

122.

Which Image method returns a copy of an Image object? 

a)

new()

b)

clone()

c)

duplicate()

d)

copy()

123.

Which method call creates and returns a blank Image with height 300, width 150, the color of each pixel transparent, and the filename the empty string? 

a)

Image(300, 150, "", (0, 0, 0))

b)

Image(300, 150)

c)

Image(150, 300)

d)

Image(150, 300, (0, 0, 0), "")

124.

Which of the following image formats is considered to be one of the most popular for sampled images? 

a)

IMG

b)

SVG

c)

JPEG

d)

XCF

125.

Why is the conversion of an image to grayscale by simply replacing the color values of each pixel with their average less than ideal?

a)

The conversion will make details that are green or blue in color hard to see.

b)

The conversion will cause some areas of the image to be invisible.

c)

The conversion will still contain non-grayscale colors.

d)

The conversion does not take luminance into account.

126.

In the RGB system, the value 255 represents the total absence of that color component.

a)

True

b)

False

127.

RGB stands for red, green, and black.

a)

True

b)

False

128.

The coordinate system used by Turtle graphics places the origin (0, 0) at the bottom-left corner of a window.

a)

True

b)

False

129.

How can you associate a keyboard event and an event-handling method with a widget?

a)

You must map a shortcut in the host operating system to run the script with a specific argument.

b)

You must name the event-handling method onPress.

c)

You must use the bind method, which expects a string argument containing a key event.

d)

You must define the key's event in a YAML-based configuration file.

130.

In a GUI-based program, which elements are boxes within which a program can output text or receive it as input from the user?

a)

command buttons

b)

title bars

c)

labels

d)

entry fields

131.

In GUI terminology, what is the name used to describe a rectangular window component with its own grid that is useful for organizing other window components?

a)

panel

b)

superframe

c)

layout

d)

combo frame

132.

In the breezypythongui module, what class provides the basic functionality for any window, such as the command buttons in the title bar?

a)

WindowFrame

b)

ProgFrame

c)

BreezyFrame

d)

EasyFrame

133.

In which tkinter class are the basic elements of a window’s state defined and managed? 

a)

EasyFrame

b)

frame

c)

window

d)

EasyWindow

134.

One of the requirements for a breezypythongui-based Python script you're writing is that your user interface include a slider bar for selecting a value from a range of values. What type of window component do you want?

a)

Scale

b)

EasyRange

c)

EasySlider

d)

SlideRule

135.

What is one of the most important attributes of a window?

a)

parent frame

b)

terminal prompt

c)

hash code

d)

width and height in pixels

136.

What is the default width of a TextField in tkinter?

a)

30 characters

b)

20 characters

c)

10 characters

d)

40 characters

137.

What is the name of the standard GUI module for Python?

a)

PyQt5

b)

Kivy

c)

tkinter

d)

breezypythongui

138.

What scenario would be ideal for the use of a prompter box?

a)

You require a GUI element to allow a user to choose a file to open.

b)

You require a GUI element that allows a user to choose their preferred language from a list of languages.

c)

You require a GUI element to display an error message upon incorrect input.

d)

You require a GUI element to obtain a user’s password.

139.

When the EasyFrame class is used to create a window, what method initializes the window by setting its attributes and populating it with the appropriate GUI components?

a)

__main__

b)

__setup__

c)

__init__

d)

__window__

140.

Which argument to the addTextField method is required?

a)

width

b)

text

c)

state

d)

rowspan

141.

Which GUI element would be ideal for allowing a user to choose one or more recipients to send a message to from a list friends? 

a)

prompter box

b)

radio buttons

c)

check buttons

d)

text area

142.

A button has a state attribute, which can be set to “enabled” or “disabled.”

a)

True

b)

False

143.

Command buttons are created and placed in a window in the same manner as labels.

a)

True

b)

False

144.

In the RGB system, the hex string #00ff00 represents the color red.

a)

True

b)

False

145.

The addButton method returns an object of type tkinter.Button.

a)

True

b)

False

146.

The tkinter module does not support the RGB color system.

a)

True

b)

False

147.

The values that can be used within a window’s sticky attribute are "T,” “D,” “L,” and “R.”

a)

True

b)

False

148.

Window components are laid out in a window's three-dimensional grid.

a)

True

b)

False