100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached 4.2 TrustPilot
logo-home
Class notes

WGU Programming and Scripting D278 notes

Rating
-
Sold
2
Pages
22
Uploaded on
03-10-2024
Written in
2024/2025

WGU Programming and Scripting D278 notes











Whoops! We can’t load your doc right now. Try again or contact support.

Document information

Uploaded on
October 3, 2024
Number of pages
22
Written in
2024/2025
Type
Class notes
Professor(s)
Debsankar mukhopadhyay, ph.d.
Contains
All classes

Content preview

Introduction: Section 1.1
A computer program consists of instructions executing one at a time. Basic instruction types are:

 Input: A program gets data, perhaps from a file, keyboard, touchscreen, network, etc.
 Process: A program performs computations on that data, such as adding two values like x + y.
 Output: A program puts that data somewhere, such as to a file, screen, network, etc.

Programs use variables to refer to data, like x, y, and z below. The name is due to a variable's value "varying" as a program
assigns a variable like x with new values.

Computational thinking, or creating a sequence of instructions to solve a problem, will become increasingly important for work
and everyday life. A sequence of instructions that solves a problem is called an algorithm.

Section 1.2
A flowchart is a graphical language for creating or viewing computer programs.

A program is a list of statements, each statement carrying out some action and executing one at a time. In a Coral flowchart,
each statement is in a graphical node, with different shapes for different types of statements.

For Coral, an interpreter runs a program's statements. Run and execute are words for carrying out a program's statements.

In a Coral flowchart, a parallelogram represents either an input or output statement

 Input statement: variable = Get next input
 Output statement: Put item to output

A string literal consists of text (characters) within double quotes, as in "Go #57!". A character includes any letter (a-z, A-Z), digit
(0-9), or symbol (~, !, @, etc.).

A cursor indicates where the next output item will be placed in the output. The system automatically moves the cursor after the
previously-output item.

A newline is a special two-character sequence \n whose appearance in an output string literal causes the cursor to move to the
next output line. The newline exists invisibly in the output.

Section 1.3
A comment is text a programmer adds to a program, to be read by humans to better understand the code, but ignored by the
program when executing. In Coral, a comment starts with // and includes all the subsequent text on that line. The comment must
be on its own line.

Whitespace refers to blank spaces (space and tab characters) between items within a statement, and to newlines.

Section 1.4
Engineers have reduced switch sizes by half about every 2 years, a trend known as Moore's Law

The industrial age starting in the late 1700's transformed civilization towards manufacturing goods, leading to mass migration to
cities, creation of strong nations, world wars, doubling of lifespans and thus dramatic world population growth.

The information age just began in the 1990's, with human activity shifting from traditional industry to creating/managing/using
computerized information.

Section 1.5
An embedded computer is a computer inside another electrical device, like inside a TV, car, printer, thermostat, satellite, etc.
1

,Section 1.6
A single 0 or 1 is called a bit. 1011 is four bits. Eight bits, like 11000101, are called a byte.

A character is a letter (a, b, ..., z, A, B, ..., Z), symbol (!, @, #, ...), or single-digit number (0, 1, ..., 9).

Unicode is another character encoding standard, published in 1991, whose codes can have more bits than ASCII and thus can
represent over 100,000 items, such as symbols and non-English characters.

Section 1.10
Pseudocode is text that resembles a program in a real programming language but is simplified to aid human understanding.




Variables/Assignments: Section 2.1
variable is a named item, such as x or numPeople, used to hold a value.

 An assignment statement's left side must be a variable.
 The right side is an expression.
 A variable may appear on the left and right of an assignment statement

An assignment statement assigns a variable with a value, such as x = 5.

 In programming, = is an assignment of a left-side variable with a right-side value.

Section 2.2
A variable declaration declares a new variable, specifying the variable's name and type.

 A variable of type integer can hold whole number values, like 1, 999, 0, or -25 (but not 3.5 or 0.001).

An assignment statement assigns the variable on the left-side of the = with the current value of the right-side expression.

 numApples = 8 assigns numApples with the value of the right-side expression (in this case 8).
 An expression may be a number like 80, a variable name like numApples, or a simple calculation like numApples + 1.

Section 2.3
Rules for Identifiers:

 be a sequence of letters (a-z, A-Z), underscores (_), and digits (0-9)
 start with a letter
 **A name created by a programmer for an item like a variable or function is called an identifier, which must follow
certain rules to be valid. Programmers typically follow identifier naming conventions that are defined by their company,
team, teacher, etc.

Naming conventions: A set of style guidelines defined by a company, team, teacher, etc., for naming variables.

 Camel case: Lower camel case abuts multiple words, capitalizing each word except the first, as in numApples or
peopleOnBus.
 Underscore separated: Words are lowercase and separated by an underscore, as in num_apples or people_on_bus.



2

, Section 2.4
An expression is a combination of items, like variables, literals, operators, and parentheses, that evaluates to a value. Ex: 2 * (x +
1) is an expression. This can just be a variable as well Ex: x.

 A literal is a specific value in code, like 2 (part of an expression)
 An operator is a symbol that performs a built-in calculation, like the operator + which performs addition. (part of an
expression)
 Expression can’t have an = sign because at that point it is an assignment not an expression. Y=x+1 is not valid
 Expression can’t have two literals next to one another without an operator associated. 2+ (xy) is not valid.

An expression evaluates to a value, which replaces the expression. Ex: If x is 5, then x + 1 evaluates to 6, and y = x + 1 assigns y
with 6.

An expression is evaluated using the order of standard mathematics, such order known in programming as precedence rules,
listed below.
Convention Description Explanation
() Items within parentheses are evaluated first In 2 * (x + 1), the x + 1 is evaluated first, with the result then multiplied by 2.
unary - - used for negation (unary minus) is next In 2 * -x, the -x is computed first, with the result then multiplied by 2.
*/ Next to be evaluated are * and /, having equal precedence.
In y = 3 + 2 * x, the 2 * x is evaluated first, with the result then added to 3,
+- Finally come + and - with equal precedence. because * has higher precedence than +. Spacing doesn't matter: y = 3+2 * x
would still evaluate 2 * x first.
If more than one operator of equal precedence could be evaluated, evaluation
left-to-right In y = x * , the x * 2 is first evaluated, with the result then divided by 3.
occurs left to right.




Section 2.6
Incremental development is the process of writing, compiling, and testing a small amount of code, then writing, compiling, and
testing a small amount more (an incremental amount), and so on.

Section 2.7
A floating-point number is a real number, like 98.6, 0.0001, or -666.667. The term "floating-point" refers to the decimal point
being able to appear anywhere ("float") in the number. A variable declared as type float stores a floating-point number.

A floating-point literal is a number with a fractional part, even if that fraction is 0, as in 1.0, 0.0, or 99.573. Good practice is to
always have a digit before the decimal point, as in 0.5, since .5 might mistakenly be viewed as 5.

Float vs. Integer:

 Integer variables are typically used for values that are counted, like 42 cars, 10 pizzas, or -95 days.
 Floating-point variables are typically used for values that are measured, like 98.6 degrees, 0.00001 meters, or -666.667
grams.
 Floating-point variables are also used when dealing with fractions of countable items, such as the average number of
cars per household.

*Can tell program to round to specific decimal point: Put hoursToDrive to output with 1 decimal places

Section 2.8
A function is a list of statements executed by invoking the function's name, with such invoking known as a function call. Any
function input values, or arguments, appear within ( ), and are separated by commas if more than one.



3

Get to know the seller

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
melissarosario1 Western Governor\'s University
View profile
Follow You need to be logged in order to follow users or courses
Sold
118
Member since
1 year
Number of followers
0
Documents
32
Last sold
1 week ago

3.7

3 reviews

5
0
4
2
3
1
2
0
1
0

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Frequently asked questions