MIS 304 Final Exam Review

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

T/F. Invalid indexes in slicing expressions can produce an 'out of bound' exception.

False. Slicing never causes out-of-bound exceptions.

What is a flowchart?

Flow charts are the graphical representation of algorithms.

T/F. An iterable is an object that is similar to a list and is created by the range function

True

T/F. An object is an entity that can be used effectively in many programs.

True

T/F. In Python, the first character of a variable name cannot be a number.

True

T/F. In a math expression, multiplication and division takes place before addition and subtraction.

True

T/F. Lists are mutable

True

T/F. Methods can be functions but not all functions can be methods.

True

T/F. Object reusability has been a factor in the increased use of object-oriented programming.

True

T/F. Strings are immutable

True

T/F. The del statement deletes an item at a specified index in a list

True

T/F. Tuples are immutable

True

T/F. Tuples process faster than lists.

True

T/F. You can have keyword and nonkeyword arguments in one function call

True

A language used to define the relationship between an object and the methods of the class is known as

UML

If you call the index method to locate an item in a list and the item is not found, this happens.

ValueError

A(n) ____ method gets the value of a data attribute but does not change it.

accessor

A(n)____ variable keeps a running total.

accumulator

What is pseudocode?

an informal description of algorithm. The sequence that is to be followed is written in simple steps. The series of steps written are not compiled or executed. It can be understood by both programmers and customer. It is meant only for human reading and not for machine reading.

This list method adds an item to the end of an existing list.

append

A(n) ____ is a piece of data that is sent into a function

argument

A(n) _____ makes a variable reference a value in the computer's memory.

assignment statemenet

The -= operator is an example of a(n)___ operator.

augmented assignment

By doing this you can hide a class's attribute from code outside the class.

begin the attribute's name with two underscores.

_____ is a keyword that is used to get out from the iteration of a loop immediately.

break

A design technique that helps to reduce the duplication of code within a program and is a benefit of using functions is ____.

code reuse

A ____ -controlled loop uses a true/false condition to control the number of times that it repeats.

condition

A ___ controlled loop repeats a specific number of times.

count

A variable used to calculate the number of iterations of a loop is called a(n)

counter

This is a feature of OOP that wraps data attributes and its relevant methods in a bundle

encapsulation

The built-in function can be used to convert an int value to a float .

float()

A____ is a diagram that graphically depicts the steps that take place in a program.

flowchart

What is an example of count-controlled loop?

for loop

A group of statements that exist within a program for the purpose of performing a specific task is a(n) __________.

function

Accessors aka____

getters

When possible, you should avoid using____variables in a program.

global

A global variable whose value cannot be changed is known as____.

global constant

A variable that is visible to every function in a program file is called a ______

global variable.

The first line of a function definition is known as the_____.

header

A ______ is a diagram that gives a visual representation of the relationships between functions in a program

hierarchy chart

A key word used to implement a predefined module in a class is called______.

import

A(n) ____ loop is sometimes called an error handler.

input validation

A(n) ____ is a component of a class that references data.

instance

Each repetition of a loop is known as a(n)____.

iteration

This is a prewritten function that is built into a programming language.

library function

Mutable objects in python

list,dict,set,byte array

A variable created inside a function block is known as a _____.

local variable

This built-in function returns the highest value in a list

max()

In Python, lists are

mutable data structures and dynamic data structures

A(n) ____ method stores a value in a data attribute or changes its value in some other way.

mutator

This method stores a value in a data attribute or changes the value of a data attribute

mutator

In the expression 12 + 7, the values on the right and left of the + symbol are called_____

operands

A(n) ____ is a special variable that receives a piece of data when a function is called

parameter

The For loop is a ___type of loop.

pretest

The While loop is a ____type of loop.

pretest

The input operation that appears just before a validation loop is known as the

priming read

This standard library function returns a random floating-point number in the range of 0.0 up to 1.0 (but not including 1.0)

random

The file object method returns a list containing the file's contents.

readlines

In one approach to identifying a class' data attributes and methods, the programmer identifies the class's_______.

responsibilities

The statement causes a function to end and sends a value back to the part of the program that called the function

return

A(n) _____ is the part of a program in which a variable may be accessed.

scope

This value initializes the formula that generates random numbers

seed value

A variable that is used to mark the end of a sequence of values is known as a(n)

sentinel

Mutators aka___

setters

A___ is a single function that the program must perform in order to satisfy the customer.

software requirement

A____ is a sequence of characters.

string

Immutable objects in python

string,tuple,frozen set,bytes

This string method returns a copy of the string with all leading and trailing whitespace characters removed

strip

A set of standard diagrams for graphically depicting object-oriented systems is provided by________.

the Unified Modeling Language

This string method returns true if a string contains only alphabetic characters and is at least one character in length

the isalpha method

A design technique that programmers use to break down an algorithm into functions is known as_____.

top-down design

my_stuff = (1,) this is an example of a____.

tuple

This standard library function returns a random floating-point number within a specified range of values.

uniform

A ___ is a name that references a value in the computer's memory.

variable

The method used to write an entire list to a file is known as

writelines

T/F. One way to find the classes needed for an object-oriented program is to identify all of the verbs in a description of the problem domain.

False

T/F. A list can be another element in another list

True

The _______ method is automatically called when an object is created.

__init__

T/F. The practice of procedural programming is centered on the creation of objects.

False

T/F. Variable names can have spaces in them.

False

Computer programs typically perform what three steps?

1. Receiving of input 2. Processing of input received from the user 3. Output is produced

Method v function

A method is on an object. They are functions that belong to a class. A function is independent of an object.

Variable

A place in a computer's memory where the data is stored.

What is an algorithm?

A set of rules or instruction which may be performed in order to complete the task. It is a step by step procedure to complete the task from the initial step to the finishing one.

A(n)____ is a set of well-defined logical steps that must be taken to perform a task.

Algorithm

This type of function returns either True or False.

Boolean

When the __init__ method executes, what does the self parameter reference?

Class instance/ object that the method is to operate on.

This term refers to an individual item in a list.

Element

What is encapsulation and how is it related to class and objects?

Encapsulation refers to the combining of data and code into a single object.

T/F. A class method does not have to have a self parameter

False

T/F. A file object's writelines method automatically writes a newline ('\n') after writing each list item to the file.

False

T/F. Assume list1 references a list. After the following statement executes, list1 and list2 will reference two identical but separate lists in memory. list2 = list1

False

T/F. If you print a variable that has not been assigned a value, the number 0 will be displayed.

False

What is a control structure?

Help to control the flow of execution of program, which could switch to different results when different information is given by the user at runtime

Properties of tuples in python.

Immutable, but value may change. Tuples support functions like len,min,max. Once created, cannot be altered. Tuples can be accessed just like lists.

This is a number that identifies an item in a list.

Index

This will happen if you try to use an index that is out of range for a list.

IndexError exception will occur.

A(n) _____ programming practice is centered on creating functions that are separate from the the data that they work on.

Procedural

An informal language that ha no syntax rules, and is not meant to be compiles or executed is called_____

Pseudocode

%

Remainder operator

If a math expression adds a float to an int, what will the data type of the result be?

Result will produce in float data type only.

When the * operator's left operand is a list and its right operand is an integer, the operator becomes this.

The repetition operator

This is the last index in a list.

The size of the list minus one

Why should an object's data attributes be hidden from code outside the class?

This protects the object's data attributes from accidental corruption.


Kaugnay na mga set ng pag-aaral

TMR Simple and Compound Interest

View Set

MCAT Physics formulas and concepts

View Set

Chapter 45: Management of patients with oral and esophageal disorders

View Set

Unit 4 - Interest Rate, Stock Index, and Foreign Currency Futures

View Set

energetics and rates of reaction and reversible reactions

View Set