Answered step by step
Verified Expert Solution
Question
1 Approved Answer
1 ) True or False. A tuple is an immutable list, meaning once it is defined it cannot be changed. 2 ) Which of the
True or False. A tuple is an immutable list, meaning once it is defined it cannot be changed.
Which of the following is a valid tuple in Python?
a exampletuple
b exampletuple
c exampletuple
d exampletuple
Which of the following is a valid tuple in Python?
b mytuple
a mytuple
What is the proper way to save the contents of the following tuple as a list?
a weekenddays weekenddays.list
b weekenddayslist listweekenddays
c weekenddayslist listweekenddays
How would you remove the following tuple?
aweekenddays.del
b weekenddays.remove
c removeweekenddays
d del weekenddays
Suppose tuple is What is returned by maxtuple
a
b
c
d
Suppose tuple is What is returned by mintuple
a
b
c
d
To open a file c:testtxt for reading, use
atestfile openc:testtxtread
b testfile openc:testtxtreadonly
c testfile openc:testtxtro
d testfile openc:testtxt
To read the entire remaining contents of the file as a string from a file object testfile use
a testfile.read
b testfile.read
c testfile.readline
d testfile.readlines
To return to the beginning of a file object named testfile, use
a testfile.reset
b testfiile.restart
c testfile.seek
d testfile.seek
To determine your current position in a file object named testfile, use
a testfile.position
b positiontestfile
c testfile.tell
d telltestfile
How would you check to see if the file object named testfile is closed?
a testfile.open?
b testfile.open
c testfile.closed?
d testfile.closed
How would you open the etchosts file so that it automatically gets closed?
a hosts openetchostsautoclose
b hosts openetchosts
c with openetchosts as hosts
d with openetchosts as hosts:
Which of the following statements are true?
a When you open a file for reading, if the file does not exist, an error occurs.
b When you open a file for writing, if the file does not exist, and error occurs.
c When you open a file for reading, if the file exist, the program will open an empty file.
Which of the following statements is false?
a When you open a file for writing, if the file does not exist, a new file is created.
bWhen you open a file for writing, if the file exists, the existing file is overwritten.
c When you open a file for appending, if the file does not exist, an error occurs.
The write file object method automatically adds a carriage return and line feed character to the end of each line.
aTrue
b False
How would you import the time module such that all of the methods in the time module are available to be called in your program?
a import time:
b import time.
c import time
d import time
How would you import just the asctime method from the time module?
a from time import asctime
b from time import.asctime
c from time import asctime
How would you import the asctime and sleep methods from the time module?
a from time import asctime sleep
b from time import asctime, sleep
c from time import asctime sleep
d from time import asctime sleep
What builtin function allows you to see what attributes, methods, and classes exist within a module?
a info
b methods
c dir
d list
Which environment variable allows you to manipulate the module search path?
a PATH
b PYTHONPATH
c PYTHONPATH
d PYTHONSEARCHPATH
True or False. Python is distributed with a large library of modules called the Python Standard Library that provide standardized solutions for many problems that occur in everyday programming.
a True
b False
Which special variable can you check to determine if your Python program was executed interactively or imported by another Python program?
amain
bimported
cinteractive
dname
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started