WGU C173 Study Guide

Lakukan tugas rumah & ujian kamu dengan baik sekarang menggunakan Quizwiz!

worst case execution

This is the time it takes for the algorithm to run where the input for a given size takes the longest to run. When analyzing programs, this is the most important case.

What is one factor that affects cost of an algorithm?

Time

Which two factors affect cost of an algorithm?

Time & Memory

invoke

To activate. One usually speaks of invoking a function in a program.

What is one purpose of the Python + operator?

To concatenate strings

concatenate

To connect or link in a series or chain.

What are two purposes of a use case diagram?

To document how to use system.; To visualize the fuctional requirements of a system.

indexing

To select sub-sequences. Positions are numbered starting with 0.

What is one reason to create a class diagram?

To understand the interaction between different objects in the application

False or True

True

Not False

True

True and True

True

True or False

True

True or True

True

circular definition

A definition that doesn't give us answers because it never finishes. It is stuck in a loop with each reference pointing to another reference. It has no base case.

recursive definition

A definition that has one or more base cases and thus provides an answer.

What is an algorithm?

A finite set of steps for performing a task or solving a problem.

inheritance

A form of code reuse. We can create a new class, but instead of writing it from scratch, we can base it on an existing class.

Scenario

A given path through a use case

benchmark

A known value of performance that can be compared against at a future time and under a specific load.

Comparison Operator Not Equal

!=

Modulo Operator (Outputs the remainder of dividing first number by the second)

%

Use Case

A major task forming part of an operational flow

list

A mutable collection of objects. The elements in a list can be of any type, including other lists.

use case

A non-technical written description of how a user accomplishes a goal. This is not a diagram. This description requires three things: a title that describes the goal we're looking for, the person who wants that goal, and the steps needed to accomplish the goal.

Actor

A person or entity that interacts with a system

validator

A program or service that checks for syntax errors prior to execution

compiler

A program that takes source code and converts it to machine code by producing a separate file.

interpreter

A program that takes source code and translates it to machine code when that code is needed.

interpreted programming

A programming language for which most of its implementations execute instructions directly, without previously compiling a program into machine-language instructions.

object-oriented programming

A programming language model organized around objects rather than "actions" and data rather than logic. Now each object contains its own data and its own logic, and they communicate between themselves.

subprogram

A section of a computer program that is stored only once but can be used when required at several different points in the program, thus saving space. Also called a procedure or function.

programming

A series of instructions telling the computer to do something. It's breaking apart a more complex idea, a more complex task, into its smallest individual instructions and then using a programming language to write those instructions.

algorithm

A set of commands that returns a value. This differs from a procedure, which is a set of commands that doesn't necessarily have to return a value.

What is a programming language library?

A set of related modules; possibly precompiled.

constructor

A special type of function used to create a class or object. The constructor prepares the new object for use.

two-way decision

A statement that can have two outcomes. An example would be an if/else statement.

variable

A storage location paired with an associated name or reference. The assigned name is used to reference the data.

non-terminal

A value that can be reduced further by the grammar rules until it is reduced to a terminal value.

terminal

A value that cannot be broken down further. Once you get to a terminal there is nothing else you can replace it with. In programming grammar, these never appear on the left side of a rule.

Boolean

A value that is either True or False

What does UML provide?

A way to visually model computing applications.

integer

A whole number (not a fraction) that can be positive, negative, or zero

What is one purpose of the Python + operator?

Addition

When should a use case be written?

After gathering requirements.

actors

An Actor in a use case is anything with behavior who lives outside of your system, outside of your application, but has a goal they want to accomplish within.

base case

An expression that has a value and is not defined in terms of some other thing we are defining. This breaks the chain of recursion.

A = True / B = False: not (A and B)

Answer: not (True and False) = not (False) = True

A = True / B = False: not (A or B)

Answer: not (True or False) = not (True) = False

A = True / B = False: not A and not B

Answer: not True and not False = False

A = True / B = False: not A or not B

Answer: not True or not False = True

expression

Any Python construct that has a value

encapsulation

Surrounding something to both keep the contents together and also to protect those contents. In Object Orientation this refers to the idea of taking our attributes and behaviors and bundling them together in the same unit, or the same class.

procedure

Takes in inputs, does some processing, and produces outputs. This differs from an algorithm, because the processing simply has to execute a set of commands and doesn't necessarily have to return a value.

If..Else

Takes one course of action if a condition is satisfied and a second otherwise.

UML

Unified Modeling Language. This is a graphical notation specifically for drawing diagrams of an object-oriented system. Utilizes text and graphic documents to enhance the analysis and design of software projects by allowing more cohesive relationships between objects.

Programming Utility: Validator

Used in reporting syntax errors prior to code execution.

if <condition>: else:

Used in to provide a two-way decision. If the initial condition is true the first block of code will execute. If the initial condition is false, the second block of code following the else clause will execute.

Programming Utility: Editor

Used in writing the program.

Programming Utility: Compiler

Used to convert high-level instructions into machine language.

Programming Utility: Interpreter

Used to convert high-level instructions to an intermediate representation.

comparison operator

Used to make a comparison between two values.

For Loop

Uses a counter to control iteration.

Ojected-oriented design and analysis step: Gather requirements.

What are the responsibilities of the different objects?

Ojected-oriented design and analysis step: Create a class diagram.

What ideas should be focused on in the application?

Ojected-oriented design and analysis step: Indentify the most important objects.

What problem needs to be solved?

A biologist wants to process water salinity measurement until water temperature falls below a certain level. Which control structure supports this biologist's needs?

While loop

Which control structure repeatedly tests the expression and if it is true executes the statements in the body of the structure?

While loop

Which execution time determines the overall efficiency of an algorithm?

Worst-case

operator

constructs which behave generally like functions, but which differ syntactically or semantically from usual functions. Examples: arithmetic (addition with +, comparison with >) and logical operations (such as AND or &&)

/

division operator, outputs the result of dividing the first number by the second

**

exponentiation operator, outputs the result of multiplying <base> by itself <power> number of times

When analyzing algorithms

which case is the most important to consider?,Worst-case

append()

Mutates <List> by adding <Element> to the end of the list.

pop()

Mutates a list by removing its last element. Outputs the value of that element.

immutable

Not able to change in form or nature

slicing

Obtaining a subset of data from a string, array, or list. You may have also heard this called string extraction. In Python you would do this: <String>[<Start Number>:<Stop Number>] = <String>

len()

Outputs the number of characters in a string

What is the list operation in Python that will remove a specified element?

Pop or Pop()

while <condition>:

Continues to execute a block of code as long as a test expression is True.

abstraction

Focus on the essential qualities of something rather than one specific example.

What is being measured when a programmer measures how algorithm speed varies with the amount of input?

Memory usage

Multiplication Operator

*

Exponent Operator

**

Addition Operator (Also Concatenates Strings)

+

Which operator is used to concatenate strings?

+

Subtraction Operator

-

Division Operator

/

Comparison Operator Less Than

<

Comparison Operator Less Than or Equal To

<=

Assignment Operator (Assigns A Value)

=

Comparison Operator Equal To

==

Comparison Operator Greater Than

>

Comparison Operator Greater Than or Equal To

>=

How does a hash-based index increase lookup speed?

By mapping an index to a speed table.

use case diagram

Can be used to describe the functionality of a system in a horizontal way. Details the actors, the system itself, the services that the system knows how to perform, and the lines that represent relationships between these elements. The reason it exists is so we can get an overview of these and see how they interact all in context.

mutation

Change or cause to change in form or nature

attributes

Characteristics of an object which may be used to reference other objects or save object state information.

What is a user-defined prototype for an object?

Class

machine code

Code that the computer actually understands. Written as numerical operations, works on the level of the CPU, too tedious for writing directly.

source code

Code written in a specific language like Java, C++, Ruby, or Python. This code would be converted to machine code at or before running.

if <condition>:

Controls what code executes based on the result of a test expression. If the condition is true the code executes. If it is false it does not execute.

Compiler

Converting high-level instruction into machine language.

Interpreter

Converting high-level instructions to an intermediate representation.

instantiation

Creating instances of a class, or creating an object from a class. Any number of instances may be created from a class.

input

Data that is passed into a procedure

def <Name>(<Parameters>):

Defines a function in Python.

class

Describes what an object will be, but it isn't the object itself. This is a blueprint for that object.

Which storage method ensures the fastest access to input data?

Dictionaries or Hash Table

code modularity

Dividing software or an application into smaller modules. This provides prewritten code which saves resources and provides greater manageability.

sequence diagram

Does not describe the entire system just one particular interaction between a few objects in one scenario. A diagram that shows how operations are done.

for <Name> in <Collection>:

Executes a block once for each element of a collection.

What is the correct grammar rule for a programming expression?

Expression -> Expression Operator Expression

False and False

False

False and True

False

False or False

False

Not True

False

True and False

False

What is an advantage of using library functions?

Functions allow code reuse.

class <ClassName> (<BaseClass>): <Block>

How to define a class in Python

Ojected-oriented design and analysis step: Describe the application.

How will people use the application?

Ojected-oriented design and analysis step: Describe object interactions.

How will polymorphism and inheritance work?

library

Huge amounts of code already written, already tested, ready for you to link to and use within your programs. Also called frameworks.

framework

Huge amounts of code already written, already tested, ready for you to link to and use within your programs. Also called libraries.

Which term describes strings that cannot be changed?

Immutable

grammar

In a programming language like Python, these are the rules that the code must adhere to. When not followed, the interpreter will return a Syntax Error message. This means that the structure of the code is inconsistent with the rules of the programming language. Proper formatting for an expression would be: Expression -> Expression Operator Expression

scenarios (UML)

In a use case this is a goal that an actor can accomplish in a single encounter

statements

In programming languages, these are like sentences in English. They use words, numbers, and punctuation to express one thought.

function

In programming, this is a named section of a program that performs a specific task. It only executes when invoked. Is able to both take inputs and provide outputs.

requirements (UML)

In the object-oriented analysis and design process requirements include both functional and non-functional features. What must the program do? What else needs to be considered (legal details, performance, support, security, etc).

What is an example of a comparison programming expression?

Inequality

What is a parmeter?

It is an input to a procedure.

What is the correct rule regarding the number of elements a Python list may contain?

It must be a sequence of zero or more elements.

What is the purpose of an if-else statement?

It provides a way to control what code executes.

While Loop

Iterates until a condition is satisfied.

In which programming language is a constructor used?

Java

Which language is built on object-oriented design principles?

Java

Which of the following can hold data of multiple types? List / String / Dictionary / Integer

List & String

polymorphism

Means many forms. It lets us automatically do the correct behavior even if what we're working with could take one of many different forms.

What is one factor that affects cost of an algorithm?

Memory

loop

Provide a way to evaluate the same block of code an arbitrary number of times

dictionary

Provides a mapping between keys, which can be values of any immutable type, and values, which can be any value. Because this is implemented using a hash table, the time to lookup a value does not increase (significantly) even when the number of keys increases.

What does a use case diagram do?

Provides an overview of several use cases.

Validator

Reporting syntax errors prior to execution.

string

Sequence of characters surrounded by quotes

user story

Similar to a use case, in that it describes a single scenario, but very short in length. Typically written as 1 or 2 sentences.

object

Something self-contained, has an identity separate from other objects. Has its own attributes and behaviors.

return <value>

Specifies the value to be returned by a function back to its function call

logical operators

The AND and OR operators. The important property they have which is different from other operators is that the second operand expression is evaluated only when necessary.

What does inheritance afford in object-oriented programming?

The ability to invoke attributes and methods from a base class.

Activity

The actions required to achieve or abandon a goal

Which aspect of a programming language would not likely affect the execution time (speed) of a program?

The compiler.

What is necessary for an entity to be considered an actor in a use case?

The entity needs to exist outside the described system.

operand

The inputs to a procedure. Also called arguments.

argument

The inputs to a procedure. Also called operands.

parameters

The inputs to a procedure. There can be any number of parameters (including none).

class diagram (UML)

The most common diagram in Object-Oriented Design. Shows the system classes and relationships between them. Diagrams the primary attributes and primary operations for each class.

What is the definition of instantiation?

The object that is created from a class.

precedence

The order of operations. A rule used to clarify which procedures should be performed first in a given mathematical expression.

What is an advantage of using programming libraries?

The save development time.

What is the main factor that determines the speed of an algorithm?

The size of input.

What are two advantages of using function in programs?

They increase code modularity. / They reduce the number of calls to subprograms.

<name> = <expression>

This is an assignment statement. A variable is named and also assigned a value or expression. If multiple values are assigned to the same named variable, the last assignment is the one used.

Editor

Writing the program.

interpreted language

You write source code and that file is used to run the program. When you run that file an interpreter is used to process the source code when it is needed. Can run on any platform and is easier to test. User must have the interpreter to run the program.

compiled language

You write source code, and compiler goes through that code and creates a separate file containing the machine code. That new file is used to run the program. Can be faster than interpreted code. Must be compiled for a specific platform.

==

a comparison operator used to compare if one operator is equal to another

>

a comparison operator used to compare if one operator is greater than another

>=

a comparison operator used to compare if one operator is greater than or equal to another

<

a comparison operator used to compare if one operator is less than another

<=

a comparison operator used to compare if one operator is less than or equal to another

!=

a comparison operator used to compare if one operator is not equal to another

+

addition operator, outputs the sum of the two input numbers OR concatenation operator, joins two values together

=

assignment operator, assigns a value

%

modulo operator, outputs the remainder of dividing the first number by the second

*

multiplication operator, outputs the product of the two input numbers

-

subtraction operator, outputs the difference between the two input numbers

iterate

to say or do again

index()

used to find elements in a list. Outputs the position of the first occurrence of an element matching <Value> in <List>. If <Value> is not found in <List>, produces an error.


Set pelajaran terkait

The Hematologic System ATI Pharmacology 4.0

View Set

AP U.S. Government Unit 3.1-3.7 & 3.8-3.13 Review

View Set

BY 471 Checkpoint Questions and Study Guide

View Set

Chapter 13 Diesel Engine Cooling Systems

View Set

Documentation and reporting Ch20 (exam 3 material)

View Set

La famille Sandrine and Martin are talking about their own families and those of their friends. Choose the correct possessive adjectives to complete their statements.

View Set

[CS 2337] Chapter 13: Overloading and Templates

View Set

Pharmaceutical Calculations (GREEN)

View Set