• Wrong document? Swap it for free
  • Written by students who passed
  • Immediately available after payment
  • Read online or as PDF
Sell
Where do you study
Your language
Document preview thumbnail
Preview 4 out of 60 pages
Exam (elaborations)

WGU Scripting and Programming Foundations (C173/D278) – The Ultimate Practice Exam

Document preview thumbnail
Preview 4 out of 60 pages

WGU Scripting and Programming Foundations (C173/D278) – The Ultimate Practice Exam

Content preview

WGU Scripting and Programming Foundations
(C173/D278) – The Ultimate Practice Exam

Section 1: Programming Fundamentals & Data Types
Question 5
Which of the following is an example of a primitive data type?
• A) Array
• B) String
• C) Integer
• D) Object
Answer: C) Integer
Explanation: Primitive data types are the most basic data types built into a
programming language. Integers represent whole numbers and are considered
primitive in most languages. Arrays, Strings, and Objects are typically composite
or reference data types that are built from primitive types.


Question 6
What is the value of the variable result after the following operation? result = 17 %
5
• A) 3
• B) 2
• C) 3.4
• D) 12
Answer: B) 2

,Explanation: The modulus operator (%) returns the remainder after division. 17
divided by 5 equals 3 with a remainder of 2, so the result is 2. This is a common
operator used to check divisibility or to wrap values within a range.


Question 7
Which naming convention is considered best practice for variable names in most
programming languages?
• A) Using single letters like x, y, z
• B) Using descriptive names that indicate purpose
• C) Using numbers at the beginning of names
• D) Using all capital letters for all variables
Answer: B) Using descriptive names that indicate purpose
Explanation: Using descriptive variable names improves code readability and
maintainability. Names like studentGPA or totalSales clearly communicate what
data the variable holds, making the code self-documenting and easier for others to
understand.


Question 8
What is the correct ordering of data types from smallest to largest memory
footprint (assuming 32-bit system)?
• A) char < int < float < double
• B) int < char < float < double
• C) char < float < int < double
• D) float < char < int < double
Answer: A) char < int < float < double
Explanation: On most 32-bit systems, a char typically uses 1 byte, an int uses 4
bytes, a float uses 4 bytes, and a double uses 8 bytes. While int and float both use 4
bytes, the ordering in typical memory hierarchy places char first, then int and float,
then double.

,Question 9
Which of the following is a valid variable declaration in most programming
languages?
• A) 2ndPlace = "Silver"
• B) final-score = 95
• C) _totalAmount = 100.50
• D) class = "Computer Science"
Answer: C) _totalAmount = 100.50
Explanation: Variable names typically must start with a letter or underscore, not a
number. They cannot contain special characters like hyphens (which are
interpreted as subtraction operators). While "class" might be syntactically valid in
some languages, it is often a reserved keyword and should be avoided. The
underscore at the beginning of _totalAmount is acceptable in most languages.


Question 10
What is the primary purpose of using constants in programming?
• A) To store data that changes frequently
• B) To create dynamic arrays
• C) To store values that should not change during program execution
• D) To allow user input collection
Answer: C) To store values that should not change during program execution
Explanation: Constants are used to store values that remain fixed throughout
program execution, such as mathematical constants (PI), configuration settings, or
fixed conversion factors. Using constants prevents accidental modification and
improves code readability by giving meaningful names to fixed values.


Question 11

, What is the difference between a compiler and an interpreter?
• A) A compiler executes code line-by-line, while an interpreter translates the
entire program first
• B) A compiler translates the entire program at once, while an interpreter
executes code line-by-line
• C) Compilers are only used for web development
• D) There is no significant difference
Answer: B) A compiler translates the entire program at once, while an
interpreter executes code line-by-line
Explanation: A compiler processes the entire source code, translating it into
machine code before execution, creating an executable file. An interpreter
translates and executes the code line-by-line during runtime, without creating a
separate executable. Compiled programs typically run faster, while interpreted
programs offer more flexibility and easier debugging.


Question 12
Which of the following correctly identifies a Boolean data type?
• A) A data type that stores decimal numbers
• B) A data type that represents true or false values
• C) A data type that stores a single character
• D) A data type that stores text strings
Answer: B) A data type that represents true or false values
Explanation: Boolean data types represent logical values, typically true or false.
They are fundamental for conditional statements and logical operations in
programming. They are named after George Boole, who developed the algebra of
logic.


Question 13
What does the expression (5 > 3) && (2 < 4) evaluate to?

Document information

Uploaded on
August 3, 2026
Number of pages
60
Written in
2026/2027
Type
Exam (elaborations)
Contains
Questions & answers
$27.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
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.
Sold
41
Followers
0
Items
4036
Last sold
2 days 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