WGU C173: Scripting and Programming Foundations |OA | Objective Assessment, Exams of Computer Science

WGU C173: Scripting and Programming Foundations |OA | Objective Assessment

Typology: Exams

2025/2026

Available from 03/25/2026

Examproff
Examproff ๐Ÿ‡บ๐Ÿ‡ธ

3

(2)

8.2K documents

1 / 10

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
WGU C173: Scripting and Programming
Foundations |OA | Objective Assessment
- - ANS-subtract
* - ANS-multiply
/ - ANS-divide
% - ANS-Modulos, does division and returns the remainder
+ - ANS-concatenate or add
< - ANS-less than
<= - ANS-less than or equal to
= - ANS-assignment
== - ANS-comparisons equality
> - ANS-greater than
>= - ANS-greater than or equal to
Boolean is a true or false value - ANS-example: myVar = True
How are buckets used in a hash table? What effect do they have on lookup speed? -
ANS-Entries in a hash table are mapped to a number, which is the position in the index
where you should look for the entry. A hash table has numbered bucket slots that hold
entries. The entries are organized in the buckets based on their assigned keyword
number. When you run a search using a hash table the keyword assigned will be used
to determine which bucket the entry should be located in and begin the search there.
Because the search knows where to begin looking it is much quicker to look up items.
How are compound mathematical expressions evaluated in Python? - ANS-First
perform calculations within parentheses.
Next work left to right and perform all multiplication and division.
Finally, work left to right and perform all addition and subtraction
How are elements in a list indexed? - ANS-List elements are assigned an index number
starting with 0.
pf3
pf4
pf5
pf8
pf9
pfa

Partial preview of the text

Download WGU C173: Scripting and Programming Foundations |OA | Objective Assessment and more Exams Computer Science in PDF only on Docsity!

WGU C173: Scripting and Programming

Foundations |OA | Objective Assessment

    • ANS-subtract
    • ANS-multiply / - ANS-divide % - ANS-Modulos, does division and returns the remainder
    • ANS-concatenate or add < - ANS-less than <= - ANS-less than or equal to = - ANS-assignment == - ANS-comparisons equality > - ANS-greater than >= - ANS-greater than or equal to Boolean is a true or false value - ANS-example: myVar = True How are buckets used in a hash table? What effect do they have on lookup speed? - ANS-Entries in a hash table are mapped to a number, which is the position in the index where you should look for the entry. A hash table has numbered bucket slots that hold entries. The entries are organized in the buckets based on their assigned keyword number. When you run a search using a hash table the keyword assigned will be used to determine which bucket the entry should be located in and begin the search there. Because the search knows where to begin looking it is much quicker to look up items. How are compound mathematical expressions evaluated in Python? - ANS-First perform calculations within parentheses. Next work left to right and perform all multiplication and division. Finally, work left to right and perform all addition and subtraction How are elements in a list indexed? - ANS-List elements are assigned an index number starting with 0.

How do you change the value of a variable with Python? - ANS-Using the = character to assign a new value x = 6 x = 9 print x # would print out 9 How do you define outputs for a function? - ANS-Using the return keyword you can define what data will be returned or output when the procedure or function runs. You can only access data from within a function if you return that specific data to be used outside of the function. How do you prioritize case (best case, worst case, average case) when analyzing algorithms? - ANS-You would look at them in this order: Worst case, average case, best case. The worst case is the most important because this will give you a better understanding of why the time scales as it does. How do you select a sub-sequence of a list with Python? - ANS-You specify the index position to begin the selection and the index position by which to stop the selection. For example, the following code would print red and yellow because they are at position 0 and 1.The value of 2 tells us to stop the selection at position 2, but not to include it. myColors = ["red","yellow","blue","orange","green"] print myColors[0:2] How do you update a list item with Python? - ANS-By specifying the element that you want to update and then assigning a new value. For example, the following code would change the second element in list, from yellow to purple. myColors = ["red","yellow","blue","orange","green"] myColors[1] = "purple" print myColors How do you use dot notation to access an attribute of a class? - ANS-You list the individual object's name that is an instance of the class, a dot, and then the attribute name. For example myClass.color would access the color associated with the object myClass. How does the AND operator evaluate two operands? - ANS-If has a False value, the result is False and is not evaluated (so even if it would produce an error it does not matter). If has a True value, the result of the and is the value of . How does the OR operator evaluate two operands? - ANS-If has a True value, the result is True and is not evaluated (so even if it would produce an error it does not matter). If has a False value, the result of the or is the value of .

What are each of these programming languages best used for: C - ANS-games, utilities, embedded systems, operating systems What are each of these programming languages best used for: Java - ANS-cross- platform language, used for desktop applications and android mobile applications What are each of these programming languages best used for: Objective-C - ANS-apple development What are each of these programming languages best used for: Python - ANS-cross- platform language, used for web apps, embedded scripting language inside other applications What are each of these programming languages best used for: Ruby - ANS-cross- platform language, used for small utilities and web apps What are the 5 steps in the UML design process? In which steps do use case, use case diagrams, and class diagrams take place? - ANS-1.Gather Requirements

  1. Describe the Application (use case and use case diagram)
  2. Identify the main objects
  3. Describe the interactions between objects
  4. Create a class diagram (class diagram) What are the advantages of using a function? - ANS-Functions can be used multiple times. They provide a modular piece of code that only has to be written once and then can be called upon multiple times within the program. What are the differences in a hashed search and a linear search? - ANS-A linear search goes through each entry one at a time to see if the search word matches the word you are looking for. With a large index and lots of queries this will be a very slow process. A hashed search maps those entries to a number, or keyword, and places those into buckets. This way you know which bucket to start looking at for a particular entry instead of looking through all of the entries. A hashed search is much like looking at the index in the back of a book; if you are looking for "pineapples" you don't have to start at the beginning and read each entry A- P, you can jump to the words that begin with P and start looking there. In this example the letter P would be the bucket that the entry pineapple is placed in. What are the three main types of data covered? How do you declare each one? - ANS- string is a sequence of characters surrounded by quotes, either single or double example: myVar = "string data"

What are the two most important factors that affect the cost of an algorithm? - ANS- Time and memory. Time is the more important factor. What do we mean when we talk about the cost of an algorithm? - ANS-An algorithm's cost is related to the resources that it requires to execute. The primary way cost is discussed is related to the size of the input. Larger inputs usually mean more resources, so this is the main factor that determines the speed. Ultimately this determines the amount of time it takes the algorithm to execute and the amount of memory required to run it. The process of calculating this is called algorithm analysis. What does a class diagram provide? What is the purpose of creating a class diagram? - ANS-A class diagram is a visual representation of classes needed. Its most basic structure defines the class name, attributes that it will have, and operations, or methods. This is also where you define inheritance and polymorphism. It allows you to plan out the classes that you will create and their basic structure so that when you translate this to code you know what is needed. What does a procedure do? - ANS-takes in inputs, does some processing, and produces outputs What does a use case diagram provide? What is the purpose of creating a case diagram? - ANS-The use case diagram allows you to look more broadly at the requirements of an application by visualizing several use cases and multiple actors at the same time. What does a use case provide? - ANS-A simple narrative for how people use the application. It is written text and there is no coding at this point. This is created after gathering the requirements. What does it mean if a programming language is object oriented? - ANS-An object oriented programming language that is organized around objects or classes, rather than "actions". Object-oriented programming takes the view that what we really care about are the objects we want to manipulate rather than the logic required to manipulate them. What does it mean to index a string? How do you do that with Python code? - ANS-This is what we call selecting a sub-sequence of a string. You do this in Python by specifying the character you want to access by its index position. Index position begins at 0. For example, this code would print out the letter J: name = 'John' print name[0] What does it mean to slice a string? How do you do that with Python code? - ANS- Slicing is simply obtaining a subset of data from a string. You may have also heard this called string extraction. You do this in Python by specifying the index position where you

What is a programming library? Why are libraries useful? - ANS-A programming library is simply code that is already written, already tested, and ready for you to link to and use. These can greatly reduce the amount of time to write code. What is a recursive definition? - ANS-When a function calls itself, it is recursion. If a function is calling itself, it would be stuck in a loop forever unless we have a condition that would allow the recursion to stop. A recursive definition needs to have two parts: the recursive case and the base case. The base case must be something that you already know the answer for and not need to do anything to work it out. This is what allows us to eventually stop running the definition. The recursive case is when the function is calling itself to run again. The recursive case is defined in terms of itself, but in terms of a smaller version of itself, as progress must be made towards the base case. What is a scenario in a use case? - ANS-This is how the actor accomplishes the activity or goal. What is a title in a use case? - ANS-This is a short phrase with an active verb that describes the goal. For example, "register new members". What is a variable? - ANS-a name that refers to a value What is abstraction? - ANS-Focus on the essential qualities of something rather than one specific example. For example, if I say a table you have an idea of what I mean even though I didn't say if it was wood/glass or big/small. This is the essential idea behind creating classes. What is an actor in a use case? - ANS-This is the person or entity who needs to accomplish something. What is an algorithm? - ANS-A well-defined sequence of steps (known as a procedure) that will always finish and produce the right results. The algorithm must finish in order for us to analyze efficiency. What is an editor? - ANS-A program that allows you to write code What is an expression? - ANS-something that has a value. What is an interpreted programming language? - ANS-An interpreted language does the conversion from source code to machine code on-the-fly. There is no separate machine code file. The computer executes each line when it is needed. This means that all of the code is saved in a format that is editable programming language. What is an interpreter? - ANS-A program that runs code one line at a time. Instead of converting all of the code at once it runs each line as it's needed. It interprets that specific line from your code to computer code.

What is an object? - ANS-Something that has its own identity and characteristics, separate from other objects. What is an operator and what does it do? - ANS-An operator takes two operands (values) and does something with them. It is an object capable of manipulating a value. If it is a comparison or logical operator it would compare to see if they are similar or dissimilar. If it is a mathematical operator it would perform mathematical calculations. What is encapsulation? - ANS-Surrounding something, not just to keep the contents together, but also to protect those contents. Restricts access to the inner workings of a class or any objects based on that class; this is referred to as information hiding or data hiding. What is grammar used for in programming? - ANS-In a programming language like Python, the code must match the language grammar exactly. When programming language grammar is not followed the interpreter will return a Syntax Error message. This means that the structure of the code is inconsistent with the rules of the programming language. What is inheritance? How does inheritance apply to working with classes? - ANS-A form of code reuse. We can create a new class, but instead of writing it from scratch, we can base it on an existing class. It would inherit some of the characteristics of the base class but could also have its own unique properties and methods that are not shared with the base class. What is instantiation? - ANS-Creating instances of a class What is mutation? Do lists support mutation? - ANS-This is the ability to change the value of something. Lists support mutation, allowing you to change the overall length as well as individual elements within the list. What is polymorphism? How does polymorphism apply to working with classes? - ANS- Means many forms. It lets us automatically do the correct behavior even if what we're working with could take one of many different forms. The + is a great example. If we're adding two variables together with the plus sign, and these variables are integers, it will numerically add them. But if they are two strings it will concatenate them. With classes this allows us to work with objects created from different classes. What is proper Python grammar for making an expression? - ANS-Expression โ†’ Expression Operator Expression The Expression non-terminal that appears on the left side can be replaced by an Expression, followed by an Operator, followed by another Expression. For example, 1 + 1 is an Expression Operator Expression.

In this case the entity can accomplish something within the system and is considered an actor. What three rules must a recursive algorithm obey? - ANS-It must have a base case which allows it to eventually end. It must change its state and move towards the base case. It must call itself recursively. What three things describe an object in object-oriented programming languages? - ANS-identity, attributes, and behavior When does a function execute? - ANS-When you explicitly ask it to execute by calling the function and passing in any parameters. We refer to this as invoking or calling the function. When would you use recursion? - ANS-To allow us to define infinitely many things using a few simple rules. A simple definition can be used to expand on something much more complex. This involves breaking a problem down into smaller and smaller subproblems until you get to a small enough problem that it can be solved trivially. For example, you could define ancestory = person 1 + ancestors. If you are person 1, your ancestors would be your parents, but they are not your only ancestors. Your parents have parents, but those are still your ancestors. Your grandparents had parents, and so on. A very simple definition can execute with multiple layers and a much more complex value. Which of these programs is object-oriented: - ANS-Java, .NET & C#, Ruby, Python, Objective-C C is not object-oriented. It is a procedural language. Which storage method covered in this course ensures the fastest access to data? - ANS-A hash table, or dictionary Why would we create a class? - ANS-To create a blueprint upon which to build multiple objects that share attributes and behaviors