WGU D278 SCRIPTING AND PROGRAMMING -
FOUNDATIONS FINAL EXAM PREPARATION
QUESTION 1:
What does a programmer do first to use an existing programming library?
A) Write the library's functions
B) Modify the library's functions
C) Include the library
D) Discard the library
Answer: C
Explanation: To use an existing programming library, the programmer must first include or import
the library in their code. This makes the library's functions and resources available for use. The
library already contains pre-written, tested code, so writing or modifying it isn't necessary .
QUESTION 2:
What relationship is common among a programming library's functions?
A) Functions all relate to the same purpose
B) Each function competes with other functions
C) Each function fixes bugs in other functions
D) Every function performs the identical computation
Answer: A
Explanation: Functions within a programming library typically relate to the same purpose or
domain. For example, a math library contains mathematical functions, while a graphics library
contains drawing functions. They are organized thematically to provide related functionality .
QUESTION 3:
What is an advantage of using a programming library?
A) The code has not been tested
B) The code has already been tested
C) The code is always faster
D) The code requires no documentation
Answer: B
,Explanation: One of the main advantages of using programming libraries is that the code has
already been tested and validated by the library developers. This saves time and reduces bugs
since you're using proven, reliable code rather than writing everything from scratch .
QUESTION 4:
Which language is dynamically typed?
A) C
B) Java
C) Python
D) C++
Answer: C
Explanation: Python is a dynamically typed language, meaning variable types are checked
during runtime rather than compile time. In dynamically typed languages, you don't need to
explicitly declare variable types - the interpreter infers them based on the assigned values .
QUESTION 5:
Which language is NOT built on object-oriented design principles?
A) Java
B) Python
C) C++
D) C
Answer: D
Explanation: C is a procedural programming language and is not built on object-oriented design
principles. While C can be used in ways that mimic object-oriented programming, it lacks built-in
support for classes, objects, inheritance, and polymorphism that are fundamental to OOP .
QUESTION 6:
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) Dynamically typed
B) Object-oriented
C) Markup
,D) Statically typed
Answer: B
Explanation: This describes an object-oriented language, where you can create classes (like
Person, Teacher, Student) that contain both data (attributes) and operations (methods).
Object-oriented programming organizes code around objects rather than functions and logic .
QUESTION 7:
A programmer wants a compiler to report an error if an integer variable is assigned with a string.
Which kind of language should the programmer use?
A) Dynamically typed
B) Object-oriented
C) Markup
D) Statically typed
Answer: D
Explanation: Statically typed languages check type compatibility at compile time. If you try to
assign a string to an integer variable, the compiler will report an error before the program even
runs. This helps catch type-related bugs early in development .
QUESTION 8:
A language uses tags around text to indicate how that text should be formatted. Which
characteristic describes a language having such tags?
A) Objects
B) Compiler
C) Script
D) Markup
Answer: D
Explanation: Markup languages, like HTML or XML, use tags to surround text and indicate how
that text should be formatted or structured. Unlike programming languages, markup languages
don't typically include logic or computational features .
QUESTION 9:
What is a characteristic of a compiled language?
, A) Runs faster than interpreted languages
B) Outputs an interpreter to run the program
C) Runs easily on different kinds of machines
D) Converts to machine language before running
Answer: D
Explanation: Compiled languages use a compiler to translate the source code directly into
machine language (binary code) before execution. This creates an executable file that can run
independently, without needing the original source code or an interpreter .
QUESTION 10:
What is a characteristic of an interpreted language?
A) Runs faster than compiled languages
B) Outputs an interpreter to run the program
C) Runs easily on different kinds of machines
D) Needs to be converted to machine code first
Answer: C
Explanation: Interpreted languages run easily on different kinds of machines because they use
an interpreter that translates the source code line-by-line during execution. As long as the
appropriate interpreter is installed for that platform, the same source code can run on different
operating systems .
QUESTION 11:
What is an advantage of interpreted programs?
A) They generally run faster than compiled programs
B) They can be modified at run time
C) They use memory more efficiently
D) They create a separate file
Answer: B
Explanation: Interpreted programs can be modified at runtime because they're executed line by
line. This makes them more flexible for dynamic environments and allows for interactive
programming where code can be tested and modified on the fly .
QUESTION 12:
FOUNDATIONS FINAL EXAM PREPARATION
QUESTION 1:
What does a programmer do first to use an existing programming library?
A) Write the library's functions
B) Modify the library's functions
C) Include the library
D) Discard the library
Answer: C
Explanation: To use an existing programming library, the programmer must first include or import
the library in their code. This makes the library's functions and resources available for use. The
library already contains pre-written, tested code, so writing or modifying it isn't necessary .
QUESTION 2:
What relationship is common among a programming library's functions?
A) Functions all relate to the same purpose
B) Each function competes with other functions
C) Each function fixes bugs in other functions
D) Every function performs the identical computation
Answer: A
Explanation: Functions within a programming library typically relate to the same purpose or
domain. For example, a math library contains mathematical functions, while a graphics library
contains drawing functions. They are organized thematically to provide related functionality .
QUESTION 3:
What is an advantage of using a programming library?
A) The code has not been tested
B) The code has already been tested
C) The code is always faster
D) The code requires no documentation
Answer: B
,Explanation: One of the main advantages of using programming libraries is that the code has
already been tested and validated by the library developers. This saves time and reduces bugs
since you're using proven, reliable code rather than writing everything from scratch .
QUESTION 4:
Which language is dynamically typed?
A) C
B) Java
C) Python
D) C++
Answer: C
Explanation: Python is a dynamically typed language, meaning variable types are checked
during runtime rather than compile time. In dynamically typed languages, you don't need to
explicitly declare variable types - the interpreter infers them based on the assigned values .
QUESTION 5:
Which language is NOT built on object-oriented design principles?
A) Java
B) Python
C) C++
D) C
Answer: D
Explanation: C is a procedural programming language and is not built on object-oriented design
principles. While C can be used in ways that mimic object-oriented programming, it lacks built-in
support for classes, objects, inheritance, and polymorphism that are fundamental to OOP .
QUESTION 6:
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) Dynamically typed
B) Object-oriented
C) Markup
,D) Statically typed
Answer: B
Explanation: This describes an object-oriented language, where you can create classes (like
Person, Teacher, Student) that contain both data (attributes) and operations (methods).
Object-oriented programming organizes code around objects rather than functions and logic .
QUESTION 7:
A programmer wants a compiler to report an error if an integer variable is assigned with a string.
Which kind of language should the programmer use?
A) Dynamically typed
B) Object-oriented
C) Markup
D) Statically typed
Answer: D
Explanation: Statically typed languages check type compatibility at compile time. If you try to
assign a string to an integer variable, the compiler will report an error before the program even
runs. This helps catch type-related bugs early in development .
QUESTION 8:
A language uses tags around text to indicate how that text should be formatted. Which
characteristic describes a language having such tags?
A) Objects
B) Compiler
C) Script
D) Markup
Answer: D
Explanation: Markup languages, like HTML or XML, use tags to surround text and indicate how
that text should be formatted or structured. Unlike programming languages, markup languages
don't typically include logic or computational features .
QUESTION 9:
What is a characteristic of a compiled language?
, A) Runs faster than interpreted languages
B) Outputs an interpreter to run the program
C) Runs easily on different kinds of machines
D) Converts to machine language before running
Answer: D
Explanation: Compiled languages use a compiler to translate the source code directly into
machine language (binary code) before execution. This creates an executable file that can run
independently, without needing the original source code or an interpreter .
QUESTION 10:
What is a characteristic of an interpreted language?
A) Runs faster than compiled languages
B) Outputs an interpreter to run the program
C) Runs easily on different kinds of machines
D) Needs to be converted to machine code first
Answer: C
Explanation: Interpreted languages run easily on different kinds of machines because they use
an interpreter that translates the source code line-by-line during execution. As long as the
appropriate interpreter is installed for that platform, the same source code can run on different
operating systems .
QUESTION 11:
What is an advantage of interpreted programs?
A) They generally run faster than compiled programs
B) They can be modified at run time
C) They use memory more efficiently
D) They create a separate file
Answer: B
Explanation: Interpreted programs can be modified at runtime because they're executed line by
line. This makes them more flexible for dynamic environments and allows for interactive
programming where code can be tested and modified on the fly .
QUESTION 12: