WGU Scripting and Programming Foundations (D278) Exam Questions

Page: 1 / 14
Total 138 questions
Question 1

What is required for all function calls?



Answer : D

When calling a function in Python, you simply give the name of the function followed by parentheses. Even if the function doesn't take any arguments, you still need to include the parentheses. For example,print('Hello!')is a function call. The function name should describe what it's supposed to do. Function definitions begin with thedefkeyword, followed by the function name and parameters (if any).The statements within the function definition are indented and carry out the task the function is supposed to perform2.Reference:

Function Calls and Definitions -- Real Python

Function Calls | Microsoft Learn

Stack Overflow: Find all function calls by a function


Question 2

Which type of language requires variables to be declared ahead of time and prohibits their types from changing while the program runs?



Answer : C

The type of language that requires variables to be declared ahead of time and prohibits their types from changing while the program runs is known as a statically typed language. In statically typed languages, the type of a variable is determined at compile-time and cannot be changed during runtime. This means that the compiler must know the exact data types of all variables used in the program, and these types must remain consistent throughout the execution of the program. Statically typed languages require developers to declare the type of each variable before using it, which can help catch type errors during the compilation process, potentially preventing runtime errors and bugs.


https://www.remotely.works/blog/understanding-the-differences-static-vs-dynamic-typing-in-programming-languages

Question 3

A programmer receives requirements from customers and decides to build a first version of a program. Which phase of an Agile approach is being carried out when the programmer starts writing the first version?



Answer : A

Comprehensive and Detailed Explanation From Exact Extract:

In Agile software development, the process is iterative, and writing code to create a version of the program occurs during the implementation phase. According to foundational programming principles and Agile methodologies (e.g., Certiport Scripting and Programming Foundations Study Guide, Agile Manifesto), implementation involves coding the software based on requirements and design.

Agile Phases Overview:

Analysis: Gathers and refines requirements (e.g., customer needs as user stories).

Design: Plans the technical solution (e.g., defining functions, classes, or architecture).

Implementation: Writes and integrates code to create a working version.

Testing: Verifies the code meets requirements.

Option A: 'Implementation.' This is correct. Starting to write the first version of the program involves coding, which is the core activity of the implementation phase. For example, the programmer might write functions or classes to meet customer requirements.

Option B: 'Testing.' This is incorrect. Testing occurs after coding to verify the program's functionality, not during the writing of the first version.

Option C: 'Design.' This is incorrect. Design involves planning the program's structure (e.g., specifying functions or objects), not writing the code.

Option D: 'Analysis.' This is incorrect. Analysis involves receiving and refining requirements, which the programmer has already done before starting to code.

Certiport Scripting and Programming Foundations Study Guide (Section on Agile Implementation).

Agile Manifesto: ''Working Software'' (http://agilemanifesto.org/).

Sommerville, I., Software Engineering, 10th Edition (Chapter 4: Agile Software Development).


Question 4

Which three statements describe a characteristic of a programming library?



Answer : A, B, D

A programming library is a collection of pre-written code that developers can use to optimize tasks and improve productivity. Here's why the selected statements are correct:

A: Libraries must be included or imported into your program before you can use the functions or objects they contain.This is because the program needs to know where to find the code it's executing12.

B: A library typically includes multiple functions, objects, or classes that are related to a specific task or area of functionality.This allows developers to reuse code efficiently12.

D: By providing pre-written code, libraries save developers time and effort, which in turn improves their productivity.Instead of writing code from scratch, developers can focus on the unique aspects of their project12.

The other options are incorrect because:

C: While it's true that poorly designed libraries can affect performance, well-designed libraries can actually make programs more efficient by providing optimized code.

E: A single program can include multiple libraries as needed. There's no limit to the number of libraries a program can use.

F: Libraries often contain multiple functions and variables, not just one function.


CareerFoundry's guide on what a programming library is1.

Codingem's complete guide on libraries in programming2.

Question 5

Which two types of operators are found in the code snippet not (g != S)?



Answer : C

The code snippetnot (g != S)contains two types of operators:

Equality Operator (!=): The expressiong != Schecks whether the value ofgisnot equalto the value ofS. The!=operator is used for comparison and returnsTrueif the values are different, otherwiseFalse.

Logical Operator (not): Thenotoperator is alogical negationoperator. Itinvertsthe truth value of a Boolean expression. In this case,not (g != S)evaluates toTrueifgis equal toS, andFalseotherwise.

Therefore, the combination of these two operators results in the overall expressionnot (g != S).


The concept of equality and logical operators is covered in programming documentation and tutorials, such as GeeksforGeeks1and Real Python2.

The Python documentation provides details on logical operators and their usage2.

Question 6

What is put to output by the following flowchart, if the input is 3.5?



Answer : D

Input: gpa = 3.5

First Condition (gpa > 3.4):

is TRUE.

Output: Interview

The execution path continues downward into the second decision block.

Second Condition (gpa > 3.0):

is TRUE.

Output: Backlog

The path proceeds to End.

Because these are sequential if statements rather than an if-else structure, both branches execute, resulting in InterviewBacklog (rendered as interviewBacking in Option D due to an OCR/exam typo).


Question 7

One requirement for the language of a project is that it is based on a series of cells. Which type of language is characterized in this way?



Answer : C

Comprehensive and Detailed Explanation From Exact Extract:

The term ''based on a series of cells'' is commonly associated with markup languages, particularly in the context of web development, where content is structured in a hierarchical or cell-based layout (e.g., HTML tables or CSS grid systems). According to foundational programming principles, markup languages like HTML are characterized by their use of tags to define elements, which can be visualized as cells or containers for content.

Option A: 'Functional.' This is incorrect. Functional languages (e.g., Haskell, Lisp) focus on functions as first-class citizens and immutability, not on a cell-based structure.

Option B: 'Static.' This is incorrect. ''Static'' refers to typing (where types are fixed at compile time) or analysis, not a cell-based structure.

Option C: 'Markup.' This is correct. Markup languages like HTML use tags to create elements that can be arranged in a cell-like structure (e.g., <table> or

elements in a grid). In web design, tables and CSS layouts are often described as cell-based.

Option D: 'Compiled.' This is incorrect. Compiled languages (e.g., C, Java) are translated into machine code before execution, but they are not characterized by a cell-based structure.

Certiport Scripting and Programming Foundations Study Guide (Section on Markup Languages).

W3Schools: ''HTML Tables'' (https://www.w3schools.com/html/html_tables.asp).

Mozilla Developer Network: ''CSS Grid Layout'' (https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Grid_Layout).


Page:    1 / 14   
Total 138 questions