Quizzes Flashcards

1
Q

T/F: A software developer is the person with the training to design, create, and test computer programs.

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

T/F: All programs are normally stored in ROM and are loaded into RAM as needed for processing.

A

False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

T/F: The CPU understands instructions written in a binary machine language.

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

T/F: The main reason to use secondary storage is to hold data for long periods of time, even when the power supply to the computer is turned off.

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

T/F: RAM is a volatile memory used for temporary storage while a program is running.

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

T/F: The Python language uses a compiler which is a program that both translates and executes the instructions in a high-level language.

A

False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

T/F: IDLE is an alternative method to using a text editor to write, execute, and test a Python program.

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Programs are commonly referred to as

A

software

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Where does a computer store a program and the data that the program is working with while the program is running?

A

in main memory

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Which computer language uses short words known as mnemonics for writing programs?

A

Assembly

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

The process known as the __________ cycle is used by the CPU to execute instructions in a program.

A

fetch-decode-execute

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

The __________ coding scheme contains a set of 128 numeric codes that are used to represent characters in the computer’s memory.

A

ASCII

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

The disk drive is a secondary storage device that stores data by __________ encoding it onto a spinning circular disk.

A

magnetically

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What is the decimal value of the following binary number?

10011101

A

157

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What is the largest value that can be stored in one byte?

A

255

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

T/F: Comments in Python begin with the # character.

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

T/F: When using the camelCase naming convention, the first word of the variable name is written in lowercase and the first characters of all subsequent words are written in uppercase.

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

T/F: According to the behavior of integer division, when an integer is divided by an integer, the result will be a float.

A

False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

T/F: Python formats all floating-point numbers to two decimal places when outputting with the print statement.

A

False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

T/F: A flowchart is a tool used by programmers to design programs.

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

T/F: In Python, math expressions are always evaluated from left to right, no matter what the operators are.

A

False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

T/F: Computer programs typically perform three steps: input is received, some process is performed on the input, and output is produced.

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
23
Q

What is the informal language, used by programmers use to create models of programs, that has no syntax rules and is not meant to be compiled or executed?

A

pseudocode

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
24
Q

The __________ function reads a piece of data that has been entered at the keyboard and returns that piece of data, as a string, back to the program.

A

input()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
In a **print** statement, you can set the __________ argument to a space or empty string to stop the output from advancing to a new line.
end
26
After the execution of the following statement, the variable sold will reference the numeric literal value as (n) __________ data type. **sold = 256.752**
float
27
After the execution of the following statement, the variable **price** will reference the value __________. **price = int(68.549)**
68
28
What is the output of the following code? **val = 123.456789** **print(f'{val:.3f}')**
123.457
29
Which of the following will display **20%**? - print(f'{20:.0%}') - print(f'{0.2:.0%}') - print(f'{0.2 * 100:.0%}') - print(f'{0.2:%}')
print(f'{0.2:.0%}')
30
What is the output of the following statement, given that **value1 = 2.0** and **value2 = 12**? **print(value1 * value2)** - 24 - value1 * value2 - 24.0 - 2.0 * 12
24.0
31
T/F: The Python language is not sensitive to block structuring of code.
False
32
T/F: The **if** statement causes one or more statements to execute only when a Boolean expression is true.
True
33
T/F: Python allows you to compare strings, but it is not case sensitive.
False
34
T/F: Nested decision statements are one way to test more than one condition.
True
35
T/F: Python uses the same symbols for the assignment operator as for the equality operator.
False
36
T/F: Expressions that are tested by the **if** statement are called Boolean expressions.
True
37
T/F: Decision structures are also known as selection structures.
True
38
A(n) __________ structure is a logical design that controls the order in which a set of statements execute.
control
39
Multiple Boolean expressions can be combined by using a logical operator to create __________ expressions.
compound
40
When using the __________ logical operator, one or both of the subexpressions must be true for the compound expression to be true.
or
41
A Boolean variable can reference one of two values which are
True or False
42
What is the result of the following Boolean expression, given that **x = 5**, **y = 3**, and **z = 8**? **x < y or z > x**
True
43
What is the result of the following Boolean expression, given that **x = 5**, **y = 3**, and **z = 8**? **x < y and z > x**
False
44
In Python the __________ symbol is used as the not-equal-to operator.
!=
45
In Python the __________ symbol is used as the equality operator.
==
46
T/F: Reducing duplication of code is one of the advantages of using a loop structure.
True
47
T/F: A good way to repeatedly perform an operation is to write the statements for the task once and then place the statements in a loop that will repeat as many times as necessary.
True
48
T/F: In Python, an infinite loop usually occurs when the computer accesses an incorrect memory address.
False
49
T/F: Both of the following **for** clauses would generate the same number of loop iterations. **for num in range(4):** **for num in range(1, 5):**
True
50
T/F: In a nested loop, the inner loop goes through all of its iterations for each iteration of the outer loop.
True
51
T/F: A **while** loop is called a pretest loop because the condition is tested after the loop has had one iteration.
False
52
T/F: The integrity of a program's output is only as good as the integrity of its input. For this reason, the program should discard input that is invalid and prompt the user to enter valid data.
True
53
What type of loop structure repeats the code a specific number of times?
count-controlled loop
54
What are the values that the variable **num** contains through the iterations of the following for loop? **for num in range(2, 9, 2):**
2,4,6,8
55
A variable used to keep a running total is called a(n)
accumulator
56
A(n) __________ structure is a structure that causes a statement or a set of statements to execute repeatedly.
repetition
57
In Python, a comma-separated sequence of data items that are enclosed in a set of brackets is called
list
58
In Python, the variable in the **for** clause is referred to as the __________ because it is the target of an assignment at the beginning of each loop iteration.
target variable
59
The first operation is called the __________ and its purpose is to get the first input value that will be tested by the validation loop.
priming read
60
When will the following loop terminate? **while keep_going != 999:**
when keep_going refers to a value equal to 999
61
Which of the following is associated with a specific file and provides a way for the program to work with that file? - filename - file extension - file object - file variable
file object
62
Which of the following describes what happens when a piece of data is written to a file? - The data is copied from a variable in RAM to a file. - The data is copied from a variable in the program to a file. - The data is copied from the program to a file. - The data is copied from a file object to a file.
The data is copied from a variable in RAM to a file.
63
Which step creates a connection between a file and a program?
Open the file
64
A(n) __________ access file is also known as a direct access file.
random
65
A single piece of data within a record is called a
field
66
Which mode specifier will erase the contents of a file if it already exists and create the file if it does not already exist?
w
67
Which mode specifier will open a file but not let you change the file or write to it?
r
68
Which method could be used to convert a numeric value to a string?
str
69
Which method will return an empty string when it has attempted to read beyond the end of a file?
readline
70
Which statement can be used to handle some of the runtime errors in a program?
a try/except statement
71
Given that the **customer** file references a file object, and the file was opened using the **'w'** mode specifier, how would you write the string **'Mary Smith'** to the file?
customer.write("Mary Smith")
72
T/F: If a file with the specified name already exists when the file is opened and the file is opened in **'w'** mode, then an alert will appear on the screen.
False
73
T/F: Closing a file disconnects the communication between the file and the program.
True
74
T/F: The **ZeroDivisionError** exception is raised when the program attempts to perform the calculation **x/y** if **y = 0**.
True
75
T/F: Strings can be written directly to a file with the **write** method, but numbers must be converted to strings before they can be written.
True
76
T/F: The function header marks the beginning of the function definition.
True
77
T/F: A local variable can be accessed from anywhere in the program.
False
78
T/F: Python allows you to pass multiple arguments to a function.
True
79
T/F: To assign a value to a global variable in a function, the global variable must be first declared in the function.
True
80
T/F: A value-returning function is like a simple function except that when it finishes it returns a value back to the part of the program that called it.
True
81
T/F: One of the drawbacks of a modularized program is that the only structure you can use in such a program is the sequence structure.
False
82
T/F: One reason not to use global variables is that it makes a program hard to debug.
True
83
What is a group of statements that exists within a program for the purpose of performing a specific task?
function
84
A set of statements that belong together as a group and contribute to the function definition is known as a
block
85
The _____________ keyword is ignored by the Python interpreter and can be used as a placeholder for code that will be written later.
pass
86
The __________ of a local variable is the function in which that variable is created.
scope
87
A(n) __________ is any piece of data that is passed into a function when the function is called.
argument
88
When a function is called by its name during the execution of a program, then it is
executed
89
The Python library functions that are built into the Python __________ can be used by simply calling the required function.
interpreter
90
A(n) __________ chart is also known as a structured chart.
hierarchy
91
What are the data items in a list called?
elements
92
The primary difference between a tuple and a list is that
once a tuple is created, it cannot be changed
93
Which list will be referenced by the variable **number** after the following code is executed? **number = range(0, 9, 2)**
[0, 2, 4, 6, 8]
94
Which method or operator can be used to concatenate lists?
+Which method can be used to convert a list to a tuple?
95
Which method can be used to convert a list to a tuple?
tuple
96
Which method can be used to convert a tuple to a list?
list
97
T/F: Lists are dynamic data structures such that items may be added to them or removed from them.
True
98
T/F: A list cannot be passed as an argument to a function.
False
99
T/F: The **remove** method removes all occurrences of an item from a list.
False
100
T/F: The index of the first element in a list is **1**, the index of the second element is **2**, and so forth.
False
101
T/F: The index **-1** identifies the last element in a list.
True
102
T/F: To calculate the average of the numeric values in a list, the first step is to get the total of values in the list
True
103
T/F: In order to create graphs using the **matplotlib** package, you need to import the **pyplot** module.
True
104
T/F: The **sort** method rearranges the elements of a list so they are in ascending or descending order.
False
105
T/F: In slicing, if the end index specifies a position beyond the end of the list, Python will use the length of the list instead.
True
106
To refer to an item in a list, you code the list name followed by
an index number in brackets, starting with the number 0
107
The __________ method adds an item to the end of a list.
append()
108
Which of these methods would you use to insert the item “melon” after “grapes” in the following list? fruit = ["apple", "banana", "grapes", "mangos", "oranges"]
fruit.insert(3, "melon")
109
Which of these methods would you use to remove the item “mangos” from the following list? fruit = ["apple", "banana", "grapes", "mangos", "oranges"]
fruit.remove("mangos") or fruit.pop(3)
110
The primary difference between a tuple and a list is that a tuple
is immutable
111
Given the following list, what is the value of ages[5]? ages = [22, 35, 24, 17, 28]
None, index error
112
Given the following list, what is the value of names[2]? names = ["Lizzy", "Mike", "Joel", "Anne", "Donald Duck"]
Joel
113
To work with a file when you’re using Python, you must do all but one of the following. Which one is it?
decode the file
114
Which of the following is not true about a CSV file? - Each row or record in the file usually ends with a new line character. - The columns or fields are usually separated by commas. - The first line is ALWAYS a header line. - To write data to a file, you need to get a writer object.
The first line is ALWAYS a header line.
115
To determine the length of a string that’s in a variable named city, you can use
len(city)
116
Which of the following symbols is used for string concatenation? - * - = - + - -
+
117
Each item in a dictionary is
key-value pair
118
To delete all items from a dictionary you can
use the clear() method
119
How many items does the following dictionary contain? flowers = {"red": "rose", "white": "lily", "yellow": "buttercup"}
3
120
The items() method returns a
object containing all of the key/value pairs in a dictionary