WGU D278 Scripting and Programming Foundations Objective Assessment Exa, Exams of Nursing

WGU D278 Scripting and Programming Foundations Objective Assessment Exam Complete Exam-Style Questions with Detailed Rationales 2026/2027 Edition | A+ Graded | Pass Guaranteed

Typology: Exams

2025/2026

Available from 06/08/2026

StudyPlug
StudyPlug 🇺🇸

5

(3)

19K documents

1 / 29

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
WGU
D278 Scripting and
Programming Foundations
Objective Assessment Exam
Complete
Exam-Style
Questions with
Detailed
Rationales
2026/2027 Edition |
A+
Graded
|
Pass Guaranteed
SECTION 1: PROGRAMMING FUNDAMENTALS & DATA
TYPES
Q1. A car drove 200 miles using 10 gallons of fuel. Which operation should be
used to compute the miles per gallon, which is 20?
A. Addition
B. Subtraction
C. Multiplication
D. Division
Answer: D. Division
Rationale: Miles per gallon is calculated by dividing total miles by total gallons (200 ÷
10 = 20). Division is the correct arithmetic operation for this calculation.
Q2. Which operator should be used to determine if a number is evenly divisible by
5?
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d

Partial preview of the text

Download WGU D278 Scripting and Programming Foundations Objective Assessment Exa and more Exams Nursing in PDF only on Docsity!

WGU D278 Scripting and Programming Foundations

Objective Assessment Exam Complete Exam-Style

Questions with Detailed Rationales 2026/2027 Edition | A+

Graded | Pass Guaranteed

SECTION 1: PROGRAMMING FUNDAMENTALS & DATA

TYPES

Q1. A car drove 200 miles using 10 gallons of fuel. Which operation should be used to compute the miles per gallon, which is 20? A. Addition B. Subtraction C. Multiplication D. Division Answer : D. Division Rationale: Miles per gallon is calculated by dividing total miles by total gallons (200 ÷ 10 = 20). Division is the correct arithmetic operation for this calculation. Q2. Which operator should be used to determine if a number is evenly divisible by 5?

A. +

B. -

C. *

D. %

Answer : D. % (modulus operator) Rationale: The modulus operator (%) returns the remainder of a division operation. If a number % 5 equals 0, the number is evenly divisible by 5. For example, 15 % 5 = 0, confirming divisibility. Q3. A variable should hold a person's height in meters. Which data type should the variable be? A. Integer B. Float C. String D. Boolean Answer : B. Float Rationale: Height in meters is a decimal or fractional value (e.g., 1.75 meters). Float (floating-point) data types are designed to store numbers with decimal points. Q4. A variable should hold the names of all past U.S. presidents. Which data type should the variable be?

C. Python D. C++ Answer : A. C Rationale: C is a procedural programming language, not object-oriented. It lacks classes, inheritance, and polymorphism. Java, Python, and C++ all support OOP principles. Q7. A language substantially supports a programmer creating items like person, teacher, and students. Each item has internal data and some operations. Which characteristic describes that language? A. Procedural B. Functional C. Object-oriented D. Markup Answer : C. Object-oriented Rationale: The description matches object-oriented programming (OOP) where "items" (objects like person, teacher, student) contain both data (attributes) and operations (methods). OOP features encapsulation, inheritance, and polymorphism.

SECTION 2: TYPE CONVERSIONS & EXPRESSIONS

Q8. Given integer x = 3 and integer y = 5. What is the value of the expression (x / 2 .0) + y? A. 6 B. 6. C. 7 D. 6. Answer : B. 6. Rationale: When dividing an integer by a float (2.0), integer x=3 is implicitly converted to a float (3.0). The division yields 1.5. Adding y=5 gives 6.5. This demonstrates implicit type conversion where integers are promoted to floats in mixed-type arithmetic. Q9. Given float x = 10.2 and float y = 1.0. What is the value of the expression x / y? A. 0. B. 1. C. 10 D. 10. Answer : D. 10. Rationale: Both operands are floats, so the division operation returns a float result. 10. ÷ 1.0 = 10.2, maintaining the decimal precision. Q10. Which kind of operator is the "==" in the expression i == 20?

C. x + 0.5 / 2 D. x / 2 + 0.5 / 2 + 0. Answer : D. x / 2 + 0.5 / 2 + 0. Rationale: Following order of operations: 3.0 / 2 = 1.5; 0.5 / 2 = 0.25; then 1.5 + 0.25 + 0.25 = 2.0. Q13. Which data type is used for items that are measured in length? A. Integer B. Float C. String D. Boolean Answer : B. Float Rationale: Length measurements often require decimal precision (e.g., 5.75 meters). Float data types accommodate fractional values, while integers can only represent whole numbers.

SECTION 3: CONTROL STRUCTURES & LOOPS

Q14. Joe is building an online game. He wants to provide a riddle and have the player guess the answer. The game needs to prompt the user to enter the answer,

check if the input does not match the correct answer, and continue prompting until the answer matches. Which control structure supports Joe's needs? A. For loop B. While loop C. Do-while loop D. If-Else branch Answer : C. Do-while loop Rationale: A do-while loop guarantees the loop body executes at least once before checking the condition. This is ideal for prompting a user for input because the first prompt always occurs, and then the loop continues until the condition (answer correct) is met. Q15. What is put to output by the following pseudocode? text x = 3 do Put x to output Put " " to output x = x - 1 while x > 0 A. 3 2 1 0 B. 3 2 1 C. 2 1 0 D. 3 2 1 0 - Answer : B. 3 2 1

Q17. What is required for all function calls? A. Input arguments B. Parameters C. Output values D. Function name Answer : D. Function name Rationale: Every function call requires the function's name to identify which function to execute. Arguments/parameters are not always required (functions can have zero parameters), and output values are not required for void functions. Q18. A function calculates the weight difference (Diff) given two sample weights (S1 and S2). What should be the output from the function? A. S1 only B. S2 only C. S1 and S D. Diff Answer : D. Diff Rationale: The function's purpose is to calculate and return the weight difference (Diff). The output should be the computed value that the calling code needs. Returning S1 and S2 would be redundant as they were inputs to the function. Q19. Function P(Integer x) returns Integer y. y = 2 * x. What does P(5) evaluate to?

A. 2

B. 5

C. 10

D. 25

Answer : C. 10 Rationale: The function multiplies the input parameter x by 2. When P(5) is called, 5 is passed as x. The function returns 2 * 5 = 10. Q20. What is a valid user-defined function name? A. A reserved word B. Any valid identifier C. Any variable name D. A floating-point number Answer : B. Any valid identifier Rationale: Valid function names follow identifier naming rules: they can contain letters, digits, and underscores, cannot start with a digit, and cannot be reserved keywords. Any valid identifier that is not a reserved word can be used.

SECTION 5: PROGRAMMING LIBRARIES

Q21. What does a programmer do first to use an existing programming library?

C. The code can be used across all programming languages D. The code has already been compiled Answer : B. The code has already been tested Rationale: Libraries contain pre-written, pre-tested code that has been verified by other developers. This saves time and reduces bugs since reliable, proven code is used instead of writing everything from scratch. Q24. Which two situations would be helped by using a programming library? (Select TWO) A. A programmer needs to write several interacting objects for a student gradebook application, some of which need an inheritance structure B. A video game programmer needs to perform several animation tasks, all very common in the industry. The programmer does not want to code each task and is unsure how to code some C. A programmer needs to perform a series of file compression tasks commonly performed by programmers and does not want to code them all by hand D. A programmer is writing mathematical code that requires heavy use of recursive functions Answer : B and C Rationale: Libraries are most helpful when tasks are common and standardized across the industry (animation, file compression) allowing programmers to use existing tested code. Writing interacting objects with inheritance (OOP) is a fundamental programming task, not necessarily requiring a library. Recursive functions can be implemented without libraries unless using specific algorithms.

SECTION 6: VARIABLES & DECLARATIONS

Q25. What is put to output by the following pseudocode? text x = 3 do Put x to output Put " " to output x = x - 1 while x > 0 A. 3 2 1 0 B. 3 2 1 C. 2 1 0 D. 3 2 1 0 - Answer : B. 3 2 1 Rationale: The loop executes with x=3,2,1. When x becomes 0, the condition "x > 0" is false, so the loop terminates before outputting 0. Q26. A variable ___ declares a new variable, specifying the variable's name and type. A. assignment B. declaration

A. Whether x and y are the same B. Whether x and y are negative C. Whether x is greater than y D. Whether x is less than y Answer : A. Whether x and y are the same Rationale: The algorithm sets z=1 when x equals y, and z=0 otherwise. This effectively tests whether x and y are equal.

SECTION 7: SOFTWARE DEVELOPMENT METHODOLOGIES

Q29. Which phase of a waterfall approach would create a sequence diagram that specifies the required order of events between completed program components? A. Analysis B. Design C. Implementation D. Testing Answer : C. Implementation Rationale: In waterfall methodology, implementation is the phase where the actual code is written and components are integrated. Sequence diagrams showing order of events between components are typically created during this phase to guide the coding of component interactions.

Q30. Which phase of an agile approach would define a hypothesis to find a problem in a program? A. Analysis B. Design C. Implementation D. Testing Answer : D. Testing Rationale: In agile methodology, the testing phase involves defining hypotheses about potential problems and systematically verifying program behavior through test cases. This phase validates that the software works as intended. Q31. Which phase of an agile approach would create an executable program? A. Analysis B. Design C. Implementation D. Testing Answer : C. Implementation Rationale: Implementation is the phase where developers actually write the code and build the executable program. This transforms design documents and specifications into working software.

Q34. A company has a new project to track and analyze employee and customer interactions. Leadership determines that the system should support direct data entry as well as automated data capture of phone calls and emails. Which phase of the waterfall process is occurring? A. Analysis B. Design C. Implementation D. Testing Answer : A. Analysis Rationale: The company is determining requirements and system capabilities before development begins. This is the analysis phase, where project scope and requirements are defined. Q35. A programmer shows a program's first version to a customer. The customer provides feedback, which causes the programmer to change the program's goals. In which phase of an agile approach are goals changed based on customer feedback? A. Analysis B. Design C. Implementation D. Testing Answer : A. Analysis Rationale: Agile methodology is iterative and responsive to customer feedback. Changing program goals based on feedback occurs during analysis or re-analysis, as requirements evolve through customer collaboration.

Q36. A programmer shows a program's first version to a customer. Based on feedback, the programmer begins writing a second version of the program. In which phase of an agile approach does the writing of a second version occur? A. Analysis B. Design C. Implementation D. Testing Answer : C. Implementation Rationale: Writing code, regardless of which version, occurs during the implementation phase. Each iteration in agile includes implementation where code is written or revised based on feedback.

SECTION 8: ALGORITHMS & PROBLEM SOLVING

Q37. What is the outcome for the given algorithm? (NumList: [1, 3, 5, 6, 7, 8]) A. 5. B. 6. C. 8. D. 6. Answer : A. 5.