CH 1 & 2 Flashcards

1
Q

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

A

T

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

F

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

T

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

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

A

T

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
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

F

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
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
7
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

F

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

T/F | Python allows programmers to break a statement into multiple lines.

A

T

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

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

A

T

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

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

A

F

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

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

A

T

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

T/F | In Python, print statements written on separate lines do not necessarily output on separate lines.

A

T

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

T/F | The \t escape character causes the output to skip over to the next horizontal tab.

A

T

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

T/F | Since a named constant is just a variable, it can change any time during a program’s execution.

A

F

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
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
b. in the CPU
c. in secondary storage
d. in the microprocessor

A

a. in main memory

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

What type of volatile memory is usually used only for temporary storage while running a program?

a. ROM
b. TMM
c. RAM
d. TVM

A

c. RAM

17
Q

The smallest storage location in a computer’s memory is known as a

a. byte
b. ketter
c. switch
d. bit

A

d. bit

18
Q

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

a. 255
b. 128
c. 8
d. 65535

A

a. 255

19
Q

Which type of error prevents the program from running?

a. syntax
b. human
c. grammatical
d. logical

A

a. syntax

20
Q

Select all that apply. To create a Python program you can use

a. a text editor
b. a word processor if you save your file as a .docx
c. IDLE
d. Excel

A

a. a text editor

c. IDLE

21
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. flowchart
b. algorithm
c. source code
d. pseudocode

A

d. pseudocode

22
Q

A(n) __________ is a diagram that graphically depicts the steps that take place in a program?

a. flowchart
b. algorithm
c. source code
d. pseudocode

A

a. flowchart

23
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()
b. output()
c. eval_input()
d. str_input()

A

a. input()

24
Q

Which mathematical operator is used to raise 5 to the second power in Python?

a. /
b. **
c. ^
d. ~

A

b. **

25
Q

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.

a. stop
b. end
c. separator
d. newLine

A

b. end

26
Q
After the execution of the following statement, the variable sold will reference the numeric literal value as (n) \_\_\_\_\_\_\_\_\_\_ data type.
sold = 256.752
a.	int
b.	float
c.	str
d.	currency
A

b. float

27
Q
After the execution of the following statement, the variable price will reference the value \_\_\_\_\_\_\_\_\_\_.
price = int(68.549)
a.	68
b.	69
c.	68.55
d.	68.6
A

a. 68

28
Q
What is the output of the following print statement?
print 'I\'m ready to begin'
a.	Im ready to begin
b.	I\'m ready to begin
c.	I'm ready to begin
d.	'I\'m ready to begin'
A

c. I’m ready to begin

29
Q
What is the output of the following command, given that value1 = 2.0 and value2 = 12?
print(value1 * value2)
a.	24
b.	value1 * value2
c.	24.0
d.	2.0 * 12
A

c. 24.0

30
Q

The __________ built-in function is used to read a number that has been typed on the keyboard.

a. input()
b. read()
c. get()
d. keyboard()

A

a. input()

31
Q

Which of the following will display 20%?

a. print(format(20, ‘.0%’))
b. print(format(0.2, ‘.0%’))
c. print(format(0.2 * 100, ‘.0%’))
d. print(format(0.2, ‘%’))

A

b. print(format(0.2, ‘.0%’))

32
Q

What symbol is used to mark the beginning and end of a string?

a. a slash (/)
b. an asterisk (*)
c. a quote mark (“)
d. a comma (,)

A

c. a quote mark (“)

33
Q

To use Python’s turtle graphics, you must include which of the following statements in your program?

a. import turtle_module
b. import turtle_graphics
c. import turtle
d. import Turtle

A

c. import turtle

34
Q

What would the following display?

num = 99
num = 9
print(num)

A

9

35
Q

What would the following display?

print(‘george’, ‘john’, ‘paul’, sep= ‘@’)

A

george@john@paul