100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached 4.2 TrustPilot
logo-home
Exam (elaborations)

WGU D278 OA Exam | Scripting and Programming Foundations | Study Questions and Answers Rated A+ | 2025/2026 Guide

Rating
-
Sold
2
Pages
35
Grade
A+
Uploaded on
05-02-2025
Written in
2024/2025

WGU D278 OA Exam | Scripting and Programming Foundations | Study Questions and Answers Rated A+ | 2025/2026 Guide WGU D278 OA Exam | Scripting and Programming Foundations | Study Questions and Answers Rated A+ | 2025/2026 Guide

Institution
WGU D278
Course
WGU D278











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

Written for

Institution
WGU D278
Course
WGU D278

Document information

Uploaded on
February 5, 2025
Number of pages
35
Written in
2024/2025
Type
Exam (elaborations)
Contains
Questions & answers

Subjects

Content preview

WGU D278 OA Exam | Scripting and
Programming Foundations | Study
Questions and Answers Rated A+ |
2025/2026 Guide

Type Conversions - Correct Answer - Converts one data type to another
(e.g., integer → float).


Implicit Conversions (Automatic) - Correct Answer - Arithmetic Operators
(+, *, etc.): If either operand is a float, the other is converted to float, and
a floating-point operation is performed.


Ex: 0.504 * numBirths (if numBirths is an integer) → numBirths is
converted to float.


Assignments (=): The right side's type is converted to match the left
side's type.


Ex: Assigning a float to an integer variable will drop the fraction.


Conversions - Correct Answer - Integer → Float: Adds a .0.
Ex: 25 → 25.0.


Float → Integer: Drops the fractional part.
Ex: 4.9 → 4.

,Type Casting - Correct Answer - Explicitly convert a value from one data
type to another.


Why Use It? : To control the type of operation or result.
Ex: Ensure floating-point division instead of integer division.


How to Type Cast: Convert
Integer to Float:Multiply the integer by 1.0.
Ex: myIntVar * 1.0 → Converts 7 (integer) to 7.0 (float).


Ex. Use Case:


Without Casting: → Integer division → Result: 3
With Casting: (7 * 1.0) / 2 → Floating-point division → Result: 3.5


Modulo Operator (%) - Correct Answer - Calculates the remainder of
dividing two integers.


Ex:
9 % 5 → Result: 4Reason: 9 = 5 * 1 + 4 (remainder: 4).
70 % 7 → Result: 0Reason: 70 = 7 * 10 + 0 (no remainder).
1 % 2 → Result: 1Reason: 1 = 2 * 0 + 1 (remainder: 1).
Key Rule:


Only valid for integer operands.
Ex: 10 % 4.0 → Not valid (one operand is a float).

,Constants - Correct Answer - A named value that cannot change during
program execution.


Uses: Store mathematical/physical constants:
Ex: PI, SPEED_OF_LIGHT.


Replace literal numbers to improve code readability:Ex:Less clear:
newPrice = origPrice - 5.


More clear: newPrice = origPrice - PRICE_DISCOUNT.
Naming Convention: Use ALL UPPERCASE with underscores:


Example: PRICE_DISCOUNT, KG_PER_POUND.


Branches - Correct Answer - A branch is a sequence of statements that
executes only if a condition is true.


Decision: Evaluates a condition to decide which branch to execute.


Flow: If true → First branch executes. If false → Second branch
executes.


Branches rejoin after execution.


If-Else Branches - Correct Answer - Executes one branch if a condition is
true, and another branch if false.


If branch: Executes when the condition is true.

, Else branch: Executes when the condition is false.


If-ElseIf Branches - Correct Answer - A branch can contain additional
decisions and branches.


A series of decisions in the false branch forms
if-elseif branches.


Usage: Detects specific values of a variable.
Ex: Check if numYears equals 1, 25, or 50.


Equality Operator (==): - Correct Answer - Evaluates true if both sides
are equal.
Ex: numYears == 10 → True if numYears is 10.
Important: Use == for equality, not =.


Nested If-Else Branches - Correct Answer - Nested branches: An if-else
branch can contain another if-else branch within it.


Key Points: A branch's statements can include any valid statements,
including another if-else branch.
Nested branches can be structured in various ways and may use
different variables


Multiple If Branches - Correct Answer - A series of independent if
decisions in sequence.


Key Difference:

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.
nursehailey Chamberlain College Of Nursing
View profile
Follow You need to be logged in order to follow users or courses
Sold
2298
Member since
5 year
Number of followers
1357
Documents
3434
Last sold
1 day ago

3.9

531 reviews

5
261
4
110
3
72
2
25
1
63

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