PRG Final

Pataasin ang iyong marka sa homework at exams ngayon gamit ang Quizwiz!

In data processing, a collection of information about a person or thing is called a file

False

Instance variables go away once a method terminates

False

Keywords make good variable names

False

Method names should always begin with one or two underscores

False

Multi-way decisions must be handled by nesting multiple if-else statements

False

Operations like addition and subtraction are defined in the math library

False

Programs no longer require modification after they are written and debugged

False

Python does not allow the input of multiple values with a single statement

False

Python functions can never modify a parameter

False

Secondary memory is also called RAM.

False

Since floating point numbers are extremely accurate, they should generally be used instead of ints.

False

The Python random function returns a pseudo random int

False

The add method can be used to add an item to the end of a list

False

The best way to write a program is to immediately type in some code and then debug it until it works

False

The copy method is provided to make a copy of a graphics object

False

The first parameter of a Python method definition is called this

False

The math.sqrt function cannot compute the square root of a negative number

False

The process of associating a file with an object in a program is called "reading" the file

False

The statement myShape.move(10,20) moves myShape to the point (10,20)

False

The syntax of a language is its meaning, and semantics is its form

False

Unlike strings, Python lists are not mutable

False

Which of the following is NOT a step in the software development process? Specification Testing/Debugging Free Setting Maintenance

Free Setting

A user interface organized around visual elements and user actions is called a

GUI

Which of the following is NOT a characteristic of a Python list? - It is an object - It is a sequence - It can hold objects - It is immutable

It is immutable

What expression would create a line from (2,3) to (4,5)?

Line(Point(2,3), Point(4,5))

A simulation that uses probabilistic events is called...

Monte Carlo

Unit-testing is the process of trying out a component of a larger program in isolation

True

a and (b or c) == (a and b) or (a and c)

True

The literals for type bool are...

True, False

What is the fundamental question of computer science?

What can be computed?

When a program i being run directly, the value of __name__ is...

__main__

One difference between a compiler and an interpreter is...

a compiler is no longer needed after a program is translated

A statement is...

a complete computer commmand

The template for <variable> in range(<expr>) describes...

a counted loop

string

a data type for representing a sequence of characters (text)

Define constructor

a function that creates a new object

Define method

a function that lives inside and object

Which of the following is not a Python type-conversion function? float round int abs

abs

Which of the following computes the horizontal distance between points p1 and p2? abs(p1-p2) p2.getX() - p1.getX() abs(p1.getY() - p2.getY()) abs(p1.getX() - p2.getX())

abs(p1.getX() - p2.getX())

A method that returns the value of an object's instance variable is called an

accessor

The pattern used to compute factorial is...

accumulator

If a function returns a value, it should generally be called from...

an expression

In order to use functions in the math library, a program must include...

an important statement

A Python convention for defining methods that are "private" to a class is to begin the method name with...

an underscore (_)

The method that adds a single item to the end of a list is...

append

In a Button widget, what is the data type of the instance variable active?

bool

In the racquetball simulation, what data type is returned by the gameOver function?

bool

What statement can be executed in the body of a loop to cause it to terminate?

break

The part of a program that uses a function is called the...

caller

Define mutator

changes the state of an object (modifies one or more instance variables)

Wha Python reserved word starts a class definition?

class

software

computer programs

A statement that controls the execution of other statements is called a...

control structure

In moden Python, an int value that grows larger than the underlying hardware int...

converts to float

What color is color_gb(0, 255, 255)?

cyan

Define instance variable

data stored inside an object

The term applied to hiding details inside class definitions is...

encapsulation

Fragments of code that produce or calculate new data values are called...

expressions

The most appropriate data type for storing the value of pi is...

float

Difference between actual and formal parameters

formal parameters = variable (amount) actual parameters = constant amount (200)

A method defintion is similar to a...

function definition

In top-down design, the subcompacts of the design are...

functions

Which of the following is NOT a Python list method? - index - insert - get - pop

get

The best structure for implementing a multi-way decision in Python is...

if-elif-else

Accessing a single character out of a string is called...

indexing

Where mathematicians use subscripting, computer programmers use...

indexing

A loop that never terminates is called...

infinite

The arrows in a module hierarchy chart depict...

information flow

In Python, getting user input is done with a special expression called...

input

A loop pattern that asks the user whether to continue on each iteration is called an...

interactive loop

In a mixed-type expression involving ints and floats, Python will convert...

ints into floats

A method definition with four formal parameters is generally called with how many actual parameters?

it depends

A problem is intractable when...

it is not practical to solve

What keyword parameter is used to send a key-function to the sort method?

key

By convention, the statements of a program are often placed in a function called...

main

The parameter bar in stdDev is what?

mean

A multiple choice question is most similar to...

multi-way decisions

A function can modify the value of an actual parameter only if it's...

mutable

A method that changes the state of an object is called a

mutator

Computer languages designed to be used and understood by humans are...

natural languages

Placing a decision inside of another decision is an example of...

nesting

Before reading or writing to a file, a file object must be created via...

open

The items listed in the parentheses of a function definition are called...

parameters

Formal and actual parameters are matched up by...

position

A loop structure that test the loop condition after executing the loop body is called a...

post-test loop

The initial version of a system used in spiral development is called a...

prototype

Which expression is true approximately 66% of the time? - random() >= 66 - random() < 0.66 - random() < 66 - random() >= 0.66

random() >= 0.66

Which of the following is NOT a Python data type? int float string rational

rational

Which of the following is NOT a file-reading method in Python? read readline readall readlines

readall

AN algorithm is like a...

recipe

Define accessor

returns the value of one or more of an object's instance variables

Which of the following is the same as s[0:-1]? s[-1] s[:] s[:len(s)-1] s[0:len(s)]

s[:len(s)-1]

Within a method definition, the sentence variable x could be accessed via which expression?

self.x

A loop pattern that continues until a special value is input is called a...

sentinel loop

A priming read is part of the pattern for a...

sentinel loop

The items dictionary method returns a...

sequence of tuples

Which command would be used to draw the graphics object shape into the graphics window win?

shape.draw(win)

Which of the following is the most accurate model of assignment in Python? sticky-note variable-as-box simultaneous plastic-scale

simultaneous

Which of the following is NOT a dictionary method? - get - keys - sort - clear

sort

Which of the following is NOT a built-in sequence operation in Python? - sorting - concatenation - slicing - repetition

sorting

The process of describing exactly what a computer program will do to solve a problem is called...

specification

Which of the following is NOT a built-in operation? + % abs() sqrt()

sqrt()

Which of the following are NOT used in expressions? variables statements operators literals

statements

A graphical view of the dependencies among components of a design is called a...

structure chart

The easiest place in a system structure to start unit-testing is...

the bottom

hardware

the physical components of a computing system

A structure in which one decision leads to another set of decisions, which leads to another set of decisions, etc. is called a decision...

tree

In Python, actual parameters are passes to functions by...

value

What command would set the coordinates of win to go from (0,0) in the lower-left corner to (10,10) in the upper-right?

win.setcoords(0,0,10,10)

Which of the following expressions correctly tests if x is even? - x % 2 == 0 - even(x) - not odd(x) - x % 2 == x

x % 2 == 0

An object may have only one instance variable

False

Arrays are usually heterogeneous, but lists are homogeneous

False

Computer science is the study of computers.

False

Computers can generate truly random numbers

False

Functions that live in objects are called instance variables

False

In Python, a function can return only one value

False

In Python, some parameters are passed by reference

False

Every Python function returns some value

True

Expressions are built from literals, variables, and operators

True

Functions that live in objects are called methods

True

In a Python class, the constructor is called __int__

True

In python, x = x + 1 is a legal statement

True

In top-down design, the main algorithm is written in terms of functions that don't yet exist

True

Information can be passed into a function through parameters

True

Informtion that is stored and manipulated by computers is called data

True

Instance variables are used to store data inside an object

True

It is considered bad style to directly access an stance variable outside of a class definition

True

Items can be removed from a list with the del operator

True

New objects are created by invoking a constructor

True

Python identifiers must start with a letter or underscore

True

Python lists are mutable, but string are not

True

Standard deviation measures how spread out a data set is

True

Strings are compared by lexicographic ordering

True

The Boolean operator or returns True when both of its operands are true

True

The CPU is the "brain" of the computer.

True

The condition x <= y <= z is allowed in Python

True

The counted loop pattern uses a definite loop

True

The easiest way to iterate through the lines of a file in Python is to use a while loop

True

The first parameter of a Python method definition is called self

True

The int data type is identical to the mathematical concept of integer

True

The last character of a string s is at position len(s)-1

True

The main function is at the top of a functional structure chart

True

The split method breaks a string into a list of substrings, and join does the opposite

True

The upper-left corner of a graphics window has coordinates (0,0)

True

Top-Down design is also called stepwise refinement

True

A Python string literal can span multiple lines if enclosed with...

" " "

How is a percent sign indicated in a string formatting template?

%

Which of the following is NOT a valid rule to Boolean algebra? - (True or x) == True - (False and x) == False - not (a and b) == not(a) and not(b) - (True or False) == True

(False and x) == False

The value of 4! is

24

Which of the following is NOT a legal identifier? spam spAm 2spam spam4U

2spam

The number of distinct values that can be represented using 5 bits is...

32

What are the 6 steps to software development?

A - Analyze D - Determine C - Create I - Implement T - Test M - Maintain

An expression that evaluates to either true or false is called...

Boolean

Which of the following is NOT a step in the function-calling process? - The calling program suspends - The formal parameters are assigned the value of the actual parameter - The body of the function executes - Control returns to the point just before the function was called

Control returns to the point just before the function was called

What kind of object can be used to get text input in a graphics window?

Entry

What is the correct formula for converting Celsius into Fahrenheit?

F = 9/5(C) + 32

Which line would NOT be found in a truth table for or? - TTT - TFT - FTF - FFF

FTF

A Python dictionary is a kind of sequence

False

A Python int can represent indefinitely large numbers

False

A Python string literal is always enclosed in double quotes

False

A Python while implements a definite loop

False

A chaotic function can't be computed by a computer

False

A developer should use either top-down or spiral design, but not both

False

A function that creates a new instance of a class is called an accessor

False

A list must contain at least one item

False

A loop is used to skip over a section of a program

False

A programming environment refers to a place where programmers work

False

A simplified version of a program is called a simulation

False

A string always contains a single line of text

False

A two-way decision is implemented using an if-elif statement

False

Which of the following are NOT a part of the IPO pattern? Input Program Process Output

Program

Which of the following is NOT an example of secondary memory? RAM Hard Drive USB Flash Drive CD-ROM

RAM

What graphics class would be best for drawing a square?

Rectangle

Which of the following is NOT a step in pure top-down design? - Repeat the process on smaller problems - Detail the algorithm in terms of its interfaces with smaller problems - Construct a simplified prototype of the system - Express the algorithm in terms of smaller problems

Repeat the process on smaller problems

Which line would NOT be found in a truth table for and? - TTT - TFT - FTF - FFF

TFT

A Docstring is the same thing as a comment

True

A counted loop is designed to iterate a specific number of times

True

A function defintion is a sequence of statements that defines a new command

True

A hardware float can represent a larger range of values than a hardware int.

True

A sentinel loop asks the user whether to continue on each iteration

True

A sentinel loop should not actually process the sentinel value

True

A simple decision can be implemented with an if statement

True

A simple try statement can catch multiple kids of errors

True

A single point on a graphics screen is called a pixel

True

A top-down design is best implemented from the top down

True

A tuple is similar to a immutable list

True

A variable is used to give a name to a value so it can be referred to in other places

True

Aliasing occurs when 2 variables refer to the same object

True

All information that a computer is currently working on is stored in main memory.

True

An algorithm can be written without using a programming language

True


Kaugnay na mga set ng pag-aaral

Solicitation / Accomplice liability

View Set

12.4 Nervous Tissue: Glial Cells

View Set

Writing Parallel and Perpendicular Linear Equations

View Set

Mastering Math Facts Multiplication Set T (5x4, 4x5, 4x6, 6x4)

View Set

Test 1 - management 2010, Management chapter 2, Management 2010- Chapter 3, Chapter 4- MGT 2010

View Set