(Top QUALITY 2024/2025 EXAM REVIEW) WGU C173 Scripting and Programming Foundations, Exam Questions and answers, Graded A+.
WGU C173 Scripting and Programming Foundations, Exam Questions and answers, Graded A+. What is a variable? - -A name that can hold a value. Might be named x. Then, x = 7 assigns x with 7, which remains in x while the program runs, until x is assigned again. Assignment Statement - -Assigns the variable on the left-side of the = with the current value of the right-side expression Expression - -A mathematical phrase that contains operations, numbers, and/or variables. numApples is initially 5. What is numApples after: numApples = numApples + 3; - -8 Is the following statement valid? x+y =y+x - -Invalid. In programming, the left side of = must be a variable, which will be assigned with the right side's value. Thus, having x + y on the left side doesn't make sense. Is the following assignment statement valid? x + 1 = 3 - -Valid. The left side must be a variable, not an expression like x + 1. In programming, = does not mean equal. = means assign the left-side variable with the right-side's value. Thus, the left side MUST be a variable. x = 9 y = x + 1 What is y? - -10 2 What does = mean? - -Assignment What is the value of x? x = 2 y = 3 x = x * y x = x * y - -18. x is first assigned with 2. Then x is assigned with 2 * 3, or 6. Finally, x is assigned with 6 * 3, or 18. Run - -The act of carrying out each statement's action. Running a program is carried out by the interpreter, causing input values to be gotten, and values to be put to output. "Execute" is another word for run. Program - -A sequence of statements. Each statement describes an action. Each statement executes one at a time. Statement - -A specific action in a program. Each describes a specific action that the interpreter should carry out, such as get a value from input into a variable, assign a variable with a value, or put a value to the output. Interpreter - -A tool that runs a program's statements. The tool carries out each program statement's action, getting input values as needed, and generating output as well. Incidentally, the interpreter is itself a program. Pseudocode - -Text that resembles a program in a real programming language but is simplified to aid human understanding. Write a statement ending with - 1 that decreases the value of variable flyCount by 1. - -flyCount = flyCount - 1. The statement reads the value of flyCount, subtracts 1, and assigns flyCount with the result (overwriting the previous value). 3 Identifier - -Name created by a programmer for an item like a variable or function. It must: be a sequence of letters (a-z, A-Z), underscores (_), and digits (0-9) start with a letter Reserved Word - -A word that is part of the language, like integer, Get, or Put. Is not used an identifier. The list of words appears at the end of this section. + - -The addition operator is +, as in x + y. - - -The subtraction operator is -, as in x - y. Also, the - operator is for negation, as in -x + y, or x + -y. * - -The multiplication operator is *, as in x *
Written for
- Institution
- Western Governors University
- Course
- WGU C173 - Scripting & Programming Foundations
Document information
- Uploaded on
- November 2, 2023
- Number of pages
- 29
- Written in
- 2023/2024
- Type
- Exam (elaborations)
- Contains
- Questions & answers
Subjects
-
wgu c173 scripting and programming foundations e
Also available in package deal