Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Document preview thumbnail
Preview 4 out of 51 pages
Exam (elaborations)

WGU D278 Final Exam (Latest 2026 / 2027 Updates ) Scripting and Programming - Foundations | Questions and Verified Answers | 100% Correct | Grade A

Document preview thumbnail
Preview 4 out of 51 pages

WGU D278 Final Exam (Latest 2026 / 2027 Updates ) Scripting and Programming - Foundations | Questions and Verified Answers | 100% Correct | Grade A

Content preview

WESTERN GOVERNORS UNIVERSIT Y

Bachelor of Science in Computer Science
D278 Scripting and Programming Foundations Academic Year: 2026/2027

Ultimate Study Guide: Complete Question Bank

Question 1

Which operator should be used to determine if a number is evenly divisible by 5?

A. %

B. /

C. *

D. +


CORRECT ANSWER: A. %


RATIONALE: The modulus operator (%) returns the remainder of a division operation. If a
number % 5 equals 0, the number is evenly divisible by 5.

,Question 2

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


CORRECT ANSWER: D. Division


RATIONALE: Miles per gallon is calculated by dividing the number of miles driven by the
number of gallons used ( = 20).



Question 3

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


CORRECT ANSWER: B. Float


RATIONALE: Height in meters is a decimal value (e.g., 1.75), so a floating-point data type
(float) should be used.

,Question 4

A variable should hold the names of all past U.S. presidents. Which data type should
the variable be?

A. Integer

B. Float

C. String

D. String array


CORRECT ANSWER: D. String array


RATIONALE: A list of names is a collection of strings, so a string array (or list of strings)
should be used.



Question 5

A program uses the number of seconds in a minute in various calculations. How should
the item that holds the number of seconds in a minute be declared?

A. Constant integer secondsPerMinute

B. Variable integer secondsPerMinute

C. Constant float secondsPerMinute

D. String secondsPerMinute


CORRECT ANSWER: A. Constant integer secondsPerMinute


RATIONALE: The number of seconds in a minute (60) is a constant value that never
changes, so it should be declared as a constant integer.

, Question 6

A program determines if a user's age is high enough to run for U.S. president. The
minimum age requirement is 35. How should the item that holds the minimum age be
declared?

A. Constant integer minAge

B. Variable integer minAge

C. Constant float minAge

D. String minAge


CORRECT ANSWER: A. Constant integer minAge


RATIONALE: The minimum age requirement (35) is a fixed value that does not change,
so it should be declared as a constant integer.



Question 7

Given integer x = 3 and integer y = 5. What is the value of the expression ( x / 2.0) + y?

A. 6.5

B. 6.0

C. 7.0

D. 5.5


CORRECT ANSWER: A. 6.5


RATIONALE: .0 = 1.5; 1.5 + 5 = 6.5.

Document information

Uploaded on
July 10, 2026
Number of pages
51
Written in
2025/2026
Type
Exam (elaborations)
Contains
Questions & answers
$10.99

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Seller avatar
LectMargaret
3.0
(1)
Sold
10
Followers
0
Items
358
Last sold
2 weeks ago




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

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions