Chapter 5 Flashcards

You may prefer our related Brainscape-certified flashcards:
1
Q

TF

A Python string literal is always enclosed in double quotes.

A

False

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

TF

The last character of a string s is at position len(s)-1

A

True

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

TF

A string always contains a single line of text.

A

False

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

TF

In Python “4” + “5” is “45”.

A

True

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

TF

Python lists are mutable, but strings are not

A

True

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

TF

ASCII is a standard for representing characters using numeric codes.

A

True

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

TF

The split method breaks a string into a list of substrings, and join does the opposite.

A

True

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

TF

A substitution cipher is a good way to keep sensitive information secure.

A

False

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

TF

The add method can be used to add an item to the end of a list.

A

False

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

TF

The process of associating a file with an object in a program is called “reading” the file.

A

False

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

Accessing a single character out of a string is called:

A

Index

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

Which of the following is the same as s[0:-1]?

A

s[:len(s)-1]

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

What function gives the Unicode value of a character?

A

ord

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

Which of the following can not be used to convert a string of digits into a number?

A

str

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

A successor to ASCII that includes characters from (nearly) all written languages is

A

Unicode

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

Which string method converts all the characters of a string to uppercase?

A

Upper

17
Q

The string “slots” that are filled in by the format method are marked by:

A

{}

18
Q

Which of the following is not a file reading method in Python?

A

Readall

19
Q

The term for a program that does its I/O with files is

A

Batch

20
Q

Before reading or writing to a file, a file object must be created via

A

Open