End Test Flashcards

(60 cards)

1
Q

Which of the following are examples of algorithms?
Spell Checker for word processor, A recipe, A set of instructions for putting together a utility shed

A

Spell checker recipe and set of instructions

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

Which of the following are output devices?

A

A monitor

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

Which of the following outputs data in a Python program?

A

The print statement

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

Which of the following are input devices?

A

A mouse, Microphone

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

Which of the following contain information?

A

An audio CD, A running computer, A book

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

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

A

An interpreter

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

What is the purpose of the CPU?

A

Decode and execute instructions

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

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

A

Syntax

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

Which of the following are general-purpose computing devices?

A

A laptop computer

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

What is IDLE used to do?

A

All of the above

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

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

A

512

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

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

A

24

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

What must a programmer use to test a program?

A

A reasonable set of legitimate inputs

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

What must you use to create a multi-line string?

A

Embedded newline characters, A single pair of three consecutive double quotation marks

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

Which statement imports the functions sqrt and log from the math module?

A

from math import sqrt, log

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

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

A

symbol

symbol

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

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

A

**, *, +

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

What does a programmer do during the analysis phase of software development?

A

Decides what the program will do and determines its user interface

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

Which function returns a list of the named resources (functions and variables) in its argument?

A

dir

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

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

A

66

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

A Boolean expression using the and operator returns True when

A

both operands are true.

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

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

A

10 times

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

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

A

0 1 2 3 4

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

A for loop is convenient for

A

counting through a sequence of numbers, running a set of statements a predictable number of times.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
Consider the following code segment: count = 5 while count > 1: print(count, end = ' '); count -= 1. What is the output produced by this code?
5 4 3 2
26
When the function range receives two arguments, what does the second argument specify?
The last value in a sequence of integers minus 1
27
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?
At least one
28
Consider the following code segment: count = 1 while count <= 10: print(count, end = ' '). Which of the following describes the error in this code?
The loop is infinite.
29
By default, the while loop is an
entry-controlled loop.
30
Consider the following code segment: x = 5; y = 4; if x > y: print(y); else: print(x). What value does this code segment print?
4
31
The binary number 111 represents which decimal integer?
7
32
The variable data refers to the string 'No way!'. The expression data.find('way!') evaluates to
3
33
The variable data refers to the string 'No way!'. The expression data[-1] evaluates to
'!'
34
The variable data refers to the string 'No way!'. The expression data[3:6] evaluates to
'way'
35
A Caesar cipher locates the coded text of a plaintext character
a given distance to the left or to the right in the sequence of characters
36
The variable data refers to the string 'No way!'. The expression data[1] evaluates to
'o'
37
The variable data refers to the string 'No way!'. The expression len(data) evaluates to
7
38
Which of the following binary numbers represents the decimal integer value 8?
1000
39
Which file method is used to read the entire contents of a file in a single operation?
read
40
The variable data refers to the string 'No way!'. The expression data.replace('No', 'Yes') evaluates to
'Yes way!'
41
The variable data refers to the list [10, 20, 30]. The expression data[1] evaluates to
20
42
The variable data refers to the list [10, 20, 30]. The expression data.index(20) evaluates to
1
43
The variable info refers to the dictionary {'name':'Sandy', 'age':17}. The method to remove an entry from a dictionary is named
pop
44
The variable info refers to the dictionary {'name':'Sandy', 'age':17}. The expression info.get('hobbies', None) evaluates to
None
45
The variable data refers to the list [10, 20, 30]. After the statement data[1] = 5, data evaluates to
[10, 5, 30]
46
The variable data refers to the list [10, 20, 30]. The expression data + [40, 50] evaluates to
[10, 20, 30, 40, 50]
47
The variable data refers to the list [10, 20, 30]. After the statement data.insert(1, 15), the original data evaluates to
[10, 15, 20, 30]
48
The variable info refers to the dictionary {'name':'Sandy', 'age':17}. The expression list(info.keys()) evaluates to
['name', 'age']
49
The variable data refers to the list [10, 20, 30]. The expression data[1:3] evaluates to
[20, 30]
50
Which of the following are immutable data structures?
strings and tuples
51
When a recursive function is called, the values of its arguments and its return address are placed in a
stack frame
52
Top-down design is a strategy that
starts with the main function and develops the functions on each successive level beneath the main function
53
The relationships among functions in a top-down design are shown in a(n)
structure chart
54
The expression list(map(math.sqrt, [9, 25, 36])) evaluates to
[3.0, 5.0, 6.0]
55
The expression list(filter(lambda x: x > 50, [34, 65, 10, 100])) evaluates to
[65, 100]
56
A recursive function
usually runs more slowly than the equivalent loop
57
A data structure used to implement a jump table is a
dictionary
58
The lifetime of a parameter is
the duration of its function's execution
59
The scope of a temporary variable is
the statements in the body of the function where the variable is introduced
60
The expression reduce(max, [34, 21, 99, 67, 10]) evaluates to
99