COMPUTER SCIENCE EXAM QUESTIONS
AND ANSWERS COMPLETE AND VERIFIED
RATED A.
What is one advantage of using external data files
a. repeating commands in programs
b. inputting large amounts of data from a file instead of the keyboard
c. inputting data from the internet instead of a keyboard
d. repeating data input from multiple sources
b
______________ holds running programs and the information they are using
main memory
which command sends information to a data file
write()
why do we use the close command when outputting to a data file
a. to save the data to secondary memory
b. to clear the data from secondary memory
c. to clear the data from the CPU
d. to save the data to the CPU
a
why do we use while loops when processing data files?
a. we know exactly how many lines are in the file
b because we are inputting values from the keyboard
c. we do not know ahead of time how many lines are in the file
d. because files contain special characters to mark the end of the file
,c
which of the following is used to mark the end of the line in a text file?
a. \n
b. \f
c. \e
d. \t
a
which of the following is not one of the three steps needed to import data
from a text file
a. open the file
b. add comments to each line of data in the file
c input and process the data
d close the file
b
the CPU carries out the commands from programs running in
main memory
main memory is _____________ and ______________
a. permanent, slow
b. temporary, slow
c. temporary, fast
d. permanent, fast
c
text files contain
characters
which of the following applies to functions and describes a reason we use
functions?
, a. to enable code to be reused
b. to stop the program from repeating
c. to ask the user for input
d. to test a condition for true and false
a
the ___________ keyword is used to create a function
def
a variable used to send information to a function is called a
a. constant
b. parameter
c. call
d. main
b
why do we use functions?
a to stop the program from repeating
b to test for true and false
c to simplify code
d to ask the user for input
c
the __________ go above the __________ in the source code file
a main program, return
b main program, functions
c subprograms, main program
d def, functions
c
AND ANSWERS COMPLETE AND VERIFIED
RATED A.
What is one advantage of using external data files
a. repeating commands in programs
b. inputting large amounts of data from a file instead of the keyboard
c. inputting data from the internet instead of a keyboard
d. repeating data input from multiple sources
b
______________ holds running programs and the information they are using
main memory
which command sends information to a data file
write()
why do we use the close command when outputting to a data file
a. to save the data to secondary memory
b. to clear the data from secondary memory
c. to clear the data from the CPU
d. to save the data to the CPU
a
why do we use while loops when processing data files?
a. we know exactly how many lines are in the file
b because we are inputting values from the keyboard
c. we do not know ahead of time how many lines are in the file
d. because files contain special characters to mark the end of the file
,c
which of the following is used to mark the end of the line in a text file?
a. \n
b. \f
c. \e
d. \t
a
which of the following is not one of the three steps needed to import data
from a text file
a. open the file
b. add comments to each line of data in the file
c input and process the data
d close the file
b
the CPU carries out the commands from programs running in
main memory
main memory is _____________ and ______________
a. permanent, slow
b. temporary, slow
c. temporary, fast
d. permanent, fast
c
text files contain
characters
which of the following applies to functions and describes a reason we use
functions?
, a. to enable code to be reused
b. to stop the program from repeating
c. to ask the user for input
d. to test a condition for true and false
a
the ___________ keyword is used to create a function
def
a variable used to send information to a function is called a
a. constant
b. parameter
c. call
d. main
b
why do we use functions?
a to stop the program from repeating
b to test for true and false
c to simplify code
d to ask the user for input
c
the __________ go above the __________ in the source code file
a main program, return
b main program, functions
c subprograms, main program
d def, functions
c