Use Data Structures — Cumulative exam Answers

25 verified answers
2
Free Preview

Which best describes the condition under which the Unicode output is the same as plain text?

A
when the text contains no punctuation
B
when the text contains only characters that are part of Unicode
C
when the text contains only characters that are part of ASCII
D
when the text contains no numbers
3

What does this loop that uses a range function do? for i in range(7, 15):print(“goodbye”)

A
It prints “goodbye” 8 times, numbered from 7 through 14.
B
It prints “goodbye” 9 times, numbered from 7 through 15.
C
It prints “goodbye” 9 times.
D
It prints “goodbye” 8 times.
5

Which statement about well-formatted code is true?

A
Well-formatted code is consistently aligned to the right margin to make it more readable.
B
Well-formatted code has no blank lines that could confuse the person reading it.
C
Well-formatted code is broken into meaningful segments to make it easier to understand.
D
Well-formatted code uses highlighting to feature important statements.
6

Which printout will result from the snippet of code?supplies = ["pencil", "notebook", "backpack", "pen", "calculator"]print("These are the supplies in the list:\n", supplies)

A
[‘pencil’, ‘notebook’, ‘backpack’, ‘pen’, ‘calculator’]
B
These are the supplies in the list: [‘pencil’, ‘notebook’, ‘backpack’, ‘pen’, ‘calculator’]
C
These are the supplies in the list: [‘pencil’, ‘notebook’, ‘backpack’, ‘pen’, ‘calculator’]
D
These are the supplies in the list:\n [‘pencil’, ‘notebook’, ‘backpack’, ‘pen’, ‘calculator’]
7

Effective character encoding requires

A
standardized code.
B
compatible browsers.
C
common languages.
D
identical operating systems.
8

Find the error in the statement below.if height_variable > 59; print("You can ride this roller coaster.")

A
The opening parenthesis should be at the beginning of the second line.
B
The second line should not be indented.
C
The semi-colon should be a colon.
D
The > should be a <.
10

Which is true of diagnosing and troubleshooting?

A
Diagnosing attempts to identify the source of a problem, while troubleshooting looks for the nature of the problem.
B
Diagnosing is used to fix problems with hardware, while troubleshooting is used to fix problems in program code.
C
Diagnosing looks for the nature of the problem, while troubleshooting attempts to identify the source of the problem.
D
Diagnosing is used to fix problems in program code, while troubleshooting is used to fix problems with hardware.
11

Which syntax error in programming is unlikely to be highlighted by a compiler or an interpreter?

A
a variable name misspelling
B
a missing space
C
a comma in place of a period
D
a missing closing quotation mark
12

In Python, arrays are usually reserved for

A
sorting operations.
B
indexing operations.
C
searching operations.
D
numerical operations.
13

Indenting the start and finish of segments

A
requires the new programmers to insert comments of their own.
B
requires a lot of extra effort for the programmer.
C
makes the flow of the program more difficult to follow.
D
makes the flow of the program easier to follow.
15

Which is true of software bugs?

A
Bugs can only be identified when error messages appear.
B
The number of bugs are reduced by careful attention to programming conventions.
C
Bugs cannot cause long-term harm.
D
Most software initially contains no bugs.
16

What happens when a Boolean expression is evaluated?

A
If the condition evaluates as True, then the next statement is executed.
B
If the condition evaluates as True, then nothing happens.
C
If the condition evaluates as False, then the next statement is false.
D
If the condition evaluates as False, then the next statement is executed.
17

Which are steps taken to diagnose a computer problem?

A
reproducing the problem and using error codes
B
reproducing the problem and troubleshooting
C
using error codes and troubleshooting
D
using error codes and stepping functions
18

What behavior do elements in a stack follow?

A
first in, last out, or FILO behavior
B
last in, first out, or LIFO behavior
C
first in, first out, or FIFO behavior
D
last in, last out, or LILO behavior
19

Read the code below. What will the computer print if the input for year_variable is 1700?if year_variable == 1776: print("Your answer is correct. The Declaration of Independence was signed in “year_variable”.")elif year_variable 1776: compute_variable = year_variable - 1776 print("Subtract “compute_variable” years from your answer for the correct answer.")

A
Your answer is incorrect. The Declaration of Independence was signed in 1776.
B
Subtract 76 years from your answer for the correct answer.
C
Add compute_variable years to your answer for the correct answer.
D
Add 76 years to your answer for the correct answer.
20

Which set of variables will make code easier to understand?

A
a, b, c
B
sum, price, count
C
xii, xix, xxi
D
x, y, z

Did you find these answers helpful?