Filters
Question type

Study Flashcards

When used with strings, the left operand of Python's in operator is a target substring and the right operand is the string to be searched.

A) True
B) False

Correct Answer

verifed

verified

After input is finished, another call to read returns an empty string to indicate that the end of the file has been reached.

A) True
B) False

Correct Answer

verifed

verified

What os.path module function can you use to convert a path to a pathname appropriate for the current file system?


A) localize(path)
B) system(path)
C) convert(path)
D) normcase(path)

E) A) and D)
F) All of the above

Correct Answer

verifed

verified

A legacy program is outputting values in octal format, and you need to translate the octal to hexadecimal. What is 173 in octal expressed as a hexadecimal value?


A) FA
B) 7B
C) 5D
D) 9C

E) A) and C)
F) B) and C)

Correct Answer

verifed

verified

What does the os module function remove do when called?


A) It removes a given file or directory that is passed to it.
B) It removes a given directory that is passed to it.
C) It removes a given file that is passed to it.
D) It removes a given symbolic link file and it's associated inode.

E) C) and D)
F) B) and D)

Correct Answer

verifed

verified

You are parsing a comma separated value string with Python. What method can you use to separate the values in each line and place them in a list?


A) string.split(',')
B) string.delimit(',')
C) string.parsetolist(',')
D) string.strip(',')

E) All of the above
F) None of the above

Correct Answer

verifed

verified

The string method isnumeric returns True if the string contains only digits or False otherwise.

A) True
B) False

Correct Answer

verifed

verified

You are running a Python script that is supposed to write data to an open file, but discover that the file contents are not updating even after the script finishes. What is most likely the issue?


A) The file was opened using 'w' instead of 'b' as the mode string.
B) The file is not being updated because it doesn't exist.
C) The file is not being written to using the dump() method.
D) The file was not closed using the close() method.

E) A) and B)
F) All of the above

Correct Answer

verifed

verified

What os module function should you use to get the path of the current working directory?


A) getcwd()
B) cwd()
C) getpwd()
D) showcwd()

E) A) and B)
F) B) and C)

Correct Answer

verifed

verified

What is the value of the binary number 10010110 in base-10?


A) 144
B) 150
C) 169
D) 232

E) A) and B)
F) All of the above

Correct Answer

verifed

verified

When using the open function to open a file for output (i.e., using 'w' as the mode string), if the file does not exist, Python raises an error.

A) True
B) False

Correct Answer

verifed

verified

The file method write expects a single string as an argument.

A) True
B) False

Correct Answer

verifed

verified

Some applications extract portions of strings called characters.

A) True
B) False

Correct Answer

verifed

verified

What is the decimal number 98 in binary?


A) 110010‬
B) 1100011
C) 1100010‬
D) ‭1110010‬

E) A) and D)
F) B) and C)

Correct Answer

verifed

verified

What string method can you use to locate the lowest index in a string named s where substring "findme" is found?


A) s.locate("findme")
B) s.find("findme")
C) s.grep('findme')
D) s.search("findme")

E) A) and B)
F) A) and C)

Correct Answer

verifed

verified

In Python, all data values are objects.

A) True
B) False

Correct Answer

verifed

verified

When a sender of information encrypts that information, what is the resulting text known as?


A) plain text
B) garbage text
C) cipher text
D) junk text

E) A) and D)
F) A) and C)

Correct Answer

verifed

verified

All data output to or input from a text file must be strings.

A) True
B) False

Correct Answer

verifed

verified

When using the open function to open a file for input (i.e., using 'r' as the mode string), if the file does not exist, Python raises an error.

A) True
B) False

Correct Answer

verifed

verified

A binary number is sometimes referred to as a string of bits or a bit string.

A) True
B) False

Correct Answer

verifed

verified

Showing 21 - 40 of 50

Related Exams

Show Answer