Fundamentals of Programming Ch04
What is the value of the binary number 10010110 in base-10? Select one: a.144 b.169 c.232 d.150
The correct answer is: 150
In the binary number system, each digit or bit has a positional value that is a power of what? Select one: a.8 b.1 c.2 d.16
The correct answer is: 2
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? Select one: a.5D b.FA c.7B d.9C
The correct answer is: 7B
What is the decimal number 98 in binary? Select one: a.1100011 b.1110010 c.1100010 d.110010
The correct answer is: 1100010
What two methods can be used to return a copy of a string named s converted to all lowercase and all uppercase respectively? Select one or more: a.s.upcase() b.s.lowcase() c.s.lower() d.s.upper()
The correct answers are: s.lower(), s.upper()
What does a block cipher utilize in order to change plaintext characters into two or more encrypted characters? Select one: a.A pseudorandom number generator defined by the encrypting language. b.A hardware encryption chip designed to perform obfuscation. c.A random noise sampling from the computer's hardware. d.A mathematical structure known as an invertible matrix.
The correct answer is: A mathematical structure known as an invertible matrix.
What statement regarding the structure of strings is accurate? Select one: a.A string's length as calculated by the len() function is always "1". b.A string is a sequence of zero or more characters. c.A string cannot be decomposed into more primitive parts. d.A string is a mutable data structure.
The correct answer is: A string is a sequence of zero or more characters.
What happens if you attempt to access a string using an index equal to the string's length? Select one: a.The entirety of the string will be accessed. b.The string's location in memory will be returned. c.An error will occur, indicating the index is out of range. d.The name of the string will be accessed.
The correct answer is: An error will occur, indicating the index is out of range.
The encryption method that replaces a character in a text with another character some given distance away in the alphabet from the original is known as what type of cipher? Select one: a.Alpha cipher b.Jumble cipher c.Caesar cipher d.Alternate cipher
The correct answer is: Caesar cipher
What does the os module function remove do when called? Select one: a.It removes a given file that is passed to it. b.It removes a given symbolic link file and it's associated inode. c.It removes a given directory that is passed to it. d.It removes a given file or directory that is passed to it.
The correct answer is: It removes a given file that is passed to it.
The decimal number system, which utilizes the numbers 0-9, is also known as what number system? Select one: a.The hexadecimal numbering system. b.The base-10 numbering system. c.The Octal numbering system. d.The base-9 numbering system.
The correct answer is: The base-10 numbering system.
When you launch Python, what file system path does it start with? Select one: a.The same folder as the Python executable file. b.The root directory of the file system. c.The current working directory. d.The user's home folder.
The correct answer is: The current working directory.
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? Select one: a.The file was opened using 'w' instead of 'b' as the mode string. b.The file was not closed using the close() method. c.The file is not being updated because it doesn't exist. d.The file is not being written to using the dump() method.
The correct answer is: The file was not closed using the close() method.
You are running a Python script that is supposed to write data to an open file, but discover that the file contents are being erased each time the script runs. What is most likely the issue? Select one: a.The file is erased when the script uses the close() method. b.The file was opened using a mode string other than 'a'. c.The file is truncated by default with the write() method. d.The file must be opened using a mode string of 'rw'.
The correct answer is: The file was opened using a mode string other than 'a'.
What does a mode string of 'r' indicate when opening a file in Python? Select one: a.The file will be opened for write access. b.The file will be opened in binary mode. c.The file will be opened for random access. d.The file will be opened for read access.
The correct answer is: The file will be opened for read access.
When a sender of information encrypts that information, what is the resulting text known as? Select one: a.garbage text b.junk text c.plain text d.cipher text
The correct answer is: cipher text
Your script is parsing filenames and is creating a count of how many files per file extension type exist within a directory. What slice could you use to extract the file extension substring, assuming the extensions are three letters only? Select one: a.filename[:-3] b.filename[$-3] c.filename[-3:] d.filename[-3]
The correct answer is: filename[-3:]
What os module function should you use to get the path of the current working directory? Select one: a.getcwd() b.getpwd() c.showcwd() d.cwd()
The correct answer is: getcwd()
What os.path module function can you use to convert a path to a pathname appropriate for the current file system? Select one: a.normcase(path) b.convert(path) c.system(path) d.localize(path)
The correct answer is: normcase(path)
You are attempting to open a file containing a list of integer numbers, each on a separate line, and read them into Python as int types. What statement could you use to do this, assuming each line is represented by the line variable in a continuous loop? Select one: a.num = line.strip() b.num = int(line.strip()) c.num = line[:-1] d.num = line.strip(int(line))
The correct answer is: num = int(line.strip())
What specific Python module can you use to determine the file size in bytes of a given file? Select one: a.file.ops b.io.file c.os.stat d.os.path
The correct answer is: os.path
What file access method can be used to read a single line of input and return the line as a string, including the newline character? Select one: a.getline b.readline c.fetch d.read
The correct answer is: readline
What string method can you use to locate the lowest index in a string named s where substring "findme" is found? Select one: a.s.find("findme") b.s.locate("findme") c.s.grep('findme') d.s.search("findme")
The correct answer is: s.find("findme")
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? Select one: a.string.delimit(',') b.string.parsetolist(',') c.string.split(',') d.string.strip(',')
The correct answer is: string.split(',')
Which of the following are examples of protocols that utilize encryption for data transfer? (Choose two.) Select one or more: a.RCP b.HTTP c.HTTPS d.FTPS
The correct answers are: HTTPS, FTPS