Computer science final

0.0(0)
studied byStudied by 1 person
0.0(0)
full-widthCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/16

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

17 Terms

1
New cards

A ___ loop has no way of ending and repeats until the program is interrupted

infnite

2
New cards

The integrity of a programs output is only as good as the programs…

input

3
New cards

A _____ is a piece of data that is sent to a function

argument

4
New cards

A ___ is a special variable that receives data when a function is called

parameter

5
New cards

This type of file contains data that has not been converted yet

binary file

6
New cards

This is a single piece of data within a record

field

7
New cards

It is necessary to initialize your accumulator variables (T/F)

true

8
New cards

to calculate the total number of iterations in a nested loop, add the number of iterations to all the loops (T/F)

false

9
New cards

A statement in one function can access a local variable in another function (T/F)

false

10
New cards

some libraries are built into the python interpreter (T/F)

true

11
New cards

when you open a file that already exists on the disc using the ‘w’ method, the contents of the existing file will be erased (T/F)

true

12
New cards

you can have more than one except clause in a try/except statement (T/F)

true

13
New cards

What is a sentinel? Why is its value be chosen carefully?

it is a special value that marks the end of a sequence of values. Sentinels are useful when you dont know how many values are in the sequence, and it must not be taken as a regular value. A zero is often used as a sentinel

14
New cards

When a function is executing, what happens when the end of the function block is reached?

the interpreter jumps back to the part of the program that created it and resumes executing statements. Note that this highlights why indentation is so important - all lines in function blocks should be indented the same.

15
New cards

Why do global variables make a program difficult to debug?

Any program statement could change it, so its hard to understand and track an error. Also, if you use the function in another program you’ll likely need to redesign it.

16
New cards

What are the steps taken when a file is used by a program?

  1. Open the file and create an associated file object

  2. Process the file according to mode (r,w,a)

  3. Close the file

17
New cards

What is a files read position? Where is the read position when a file is first opened for reading?

it is a special value that marks the next item to be read from the file. Initially, it is set to the beginning of the file.