OA Exams

  • web.groovymark@gmail.com
  • December 17, 2024

Question 21

What is a parameter in a function?

a) A value that is returned by a function
b) A variable declared inside the function
c) An input specified in the function definition
d) A loop within a function

Correct Answer: c) An input specified in the function definition

Explanation: A parameter is an input passed into a function, which the function uses during execution.

Question 22

What is a function return value?

a) A variable that is assigned within the function
b) A value that is sent back to the caller after the function executes
c) A way to declare a loop
d) A constant in a program

Correct Answer: b) A value that is sent back to the caller after the function executes

Explanation: A return value is the result of a function that is passed back to the part of the program that called the function.

Question 23

What is modular development?

a) Writing a program in one go
b) Dividing a program into smaller, manageable modules
c) Rewriting code multiple times
d) Testing a program all at once

Correct Answer: b) Dividing a program into smaller, manageable modules

Explanation: Modular development involves splitting a program into separate parts, each focusing on a specific task, to simplify development and testing.

Question 24

What is incremental development?

a) Writing and testing large sections of code at once
b) Writing and testing small amounts of code in increments
c) Writing code without testing
d) Repeating the same code multiple times

Correct Answer: b) Writing and testing small amounts of code in increments

Explanation: Incremental development refers to gradually building and testing small parts of a program to ensure functionality before proceeding further.

Question 25

What is a function stub?

a) A complete function definition
b) A function definition that has not yet been fully implemented
c) A function with multiple return values
d) A function that only accepts one argument

Correct Answer: b) A function definition that has not yet been fully implemented

Explanation: A function stub is a placeholder function that allows a program to run without errors until the function is fully defined.

Question 26

What is a literal in programming?

a) A specific value written directly into the code
b) A loop condition
c) A type of function
d) A variable that can change

Correct Answer: a) A specific value written directly into the code

Explanation: A literal is a fixed value, like 10 or "Hello", used in the program code that doesn't change during execution.

Question 27

What is an operator in programming?

a) A variable that stores data
b) A symbol that performs a built-in calculation
c) A function declaration
d) A loop statement

Correct Answer: b) A symbol that performs a built-in calculation

Explanation: Operators like +, -, *, and / are symbols used to perform mathematical or logical operations on data.

Question 28

What is the modulo operator (%) used for?

a) To perform multiplication
b) To find the remainder of a division operation
c) To compare two numbers
d) To terminate a loop

Correct Answer: b) To find the remainder of a division operation

Explanation: The modulo operator (%) returns the remainder of the division of two integers

Question 29

What is a class diagram in UML?

a) A diagram representing the order of events in a program
b) A structural diagram that shows classes, their attributes, and methods
c) A flowchart for control structures
d) A decision-making diagram

Correct Answer: b) A structural diagram that shows classes, their attributes, and methods

Explanation: A class diagram in UML models the structure of a system by showing its classes, attributes, methods, and relationships.

Question 30

What is a use case diagram in UML?

a) A way to model loops
b) A diagram that shows how users interact with the program
c) A structural diagram for classes
d) A flowchart for decision-making

Correct Answer: b) A diagram that shows how users interact with the program

Explanation: A use case diagram visually models the different ways users interact with a software system, representing user actions and system responses.

Question 31

What is the difference between a while loop and a for loop?

a) A while loop runs for a set number of iterations, and a for loop runs indefinitely
b) A while loop executes while a condition is true, and a for loop runs for a specific number of iterations
c) A while loop is used for math operations, and a for loop is used for strings
d) Both loops are identical

Correct Answer: b) A while loop executes while a condition is true, and a for loop runs for a specific number of iterations

Explanation: A while loop continues executing as long as the condition remains true, while a for loop executes a set number of times.

Question 32

What is a function argument?

a) A function call
b) A value passed to a function when it is called
c) A variable inside the function
d) A loop condition

Correct Answer: b) A value passed to a function when it is called

Explanation: A function argument is a value provided to a function when it is called, which the function uses during execution.

Question 33

What does a ‘return’ statement do in a function?

a) Declares a new variable
b) Terminates the loop
c) Sends a value back to the calling part of the program
d) Defines a function

Correct Answer: c) Sends a value back to the calling part of the program

Explanation: The return statement exits the function and sends a value back to the part of the program that invoked the function.

Question 34

What is a floating-point number?

a) A number without a fractional part
b) A number that can hold decimals
c) A constant value
d) A type of string

Correct Answer: b) A number that can hold decimals

Explanation: A floating-point number can hold decimal values, such as 3.14 or -0.001.

Question 35

What is the purpose of the increment operator (++) in loops?

a) To subtract a value from a variable
b) To increase the value of a variable by one
c) To declare a new variable
d) To restart the loop

Correct Answer: b) To increase the value of a variable by one

Explanation: The increment operator (++) adds 1 to the value of a variable, commonly used in loops to control iteration.

Question 36

What is an array in programming?

a) A data structure that holds a single value
b) A data structure that holds a list of values of the same type
c) A data type that holds only integers
d) A variable that holds a single constant

Correct Answer: b) A data structure that holds a list of values of the same type

Explanation: An array is an ordered collection of elements, all of which are of the same data type.

Question 37

What is an index in an array?

a) The total size of the array
b) A function name
c) The location number of an element in the array
d) The data type of the array

Correct Answer: c) The location number of an element in the array

Explanation: An index refers to the position of an element in an array, typically starting from 0.

Question 38

What is a constant in programming?

a) A variable that changes during program execution
b) A named value that cannot be changed once assigned
c) A loop condition
d) A function return type

Correct Answer: b) A named value that cannot be changed once assigned

Explanation: A constant is a value that remains the same throughout the execution of a program, typically used for fixed values like Pi or conversion factors.

Question 39

What is a type cast in programming?

a) A way to convert a value from one data type to another
b) A loop structure
c) A function that calls another function
d) A variable declaration

Correct Answer: a) A way to convert a value from one data type to another

Explanation: Type casting is the process of converting a value from one data type to another, such as from integer to float or vice versa.

Question 40

What is a flowchart used for?

a) To graphically represent the flow of control in a program
b) To define functions
c) To declare variables
d) To perform calculations

Correct Answer: a) To graphically represent the flow of control in a program

Explanation: A flowchart visually represents the sequence of steps in a program, helping to understand the control flow.

Complete the Captcha to view next question set.

Tags

Prev Post
WGU D278 Practice Exam Questions – Set 2 – Part 1
Next Post
WGU D278 Practice Exam Questions – Set 2 – Part 3