100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached
logo-home
WGU C949 Data Structures & Algorithms Chapters 1-4 Questions and Answers Fully Solved $17.99   Add to cart

Exam (elaborations)

WGU C949 Data Structures & Algorithms Chapters 1-4 Questions and Answers Fully Solved

 6 views  0 purchase
  • Course
  • WGU C949
  • Institution
  • WGU C949

WGU C949 Data Structures & Algorithms Chapters 1-4

Preview 3 out of 19  pages

  • August 10, 2024
  • 19
  • 2024/2025
  • Exam (elaborations)
  • Questions & answers
  • WGU C949
  • WGU C949
avatar-seller
Dreamer252
WGU C949 Data Structures & Algorithms
Chapters 1-4

In-line, Multiline, Documentation Strings (Docstrings) - answerIn Python, there are three
(3) different types of commenting styles. What are they?

In-line - answer"Comments used to add meaning to a program and explain logic in-line
with the code being discussed. These comments are good for quick explanations and
are indicated by using the # character and a space. if n % 2 == 1: # n is odd"

Multiline - answer"Comments, also known as block comments, are good for more in-
depth explanations or when you want to comment a complex section of code. In Python
we append together a section of lines all beginning with the # character to achieve this.
# This section of code # Requires a longer comment # So we can add as many lines as
needed"

Document Strings (Docstrings) - answer"These are used like the comments referenced
above but it allows you much more space to write a longer message and they can be
written out at runtime, which means the interpreter does see them, unlike other types of
comments. These should be used to describe what a piece of code is doing in detail.
You enclose these types of comments in three quote marks """""".

def odd_function(n) - answer""""""This function checks to see whether a number is odd
or even"""""""

Computer program - answerConsists of instructions that a computer executes (or runs),
like multiplying numbers or printing a number to a screen.

Task decomposition - answerMeans to reduce a complex task into simpler basic steps,
making the whole task easier to solve.

Algorithm - answerIs a methodical step-by-step procedure to perform a task.

Computational thinking - answerThe method of evaluating a problem's most basic parts
and then creating an algorithm to solve that problem.

Python interpreter - answerFor Python, an application that can be used on various
operating systems, including Microsoft Windows, Linux, and MacOS.

Interactive interpreter - answerA program that allows the user to execute one line of
code at a time.

,Code (Coding) - answerA common word for the textual representation of a program.

Line - answerA row of text.

The interactive interpreter displays a prompt(">>>") - answer(">>>") that indicates the
interpreter is ready to accept code.

Prompt - answerInforms the programmer that the interpreter is ready to accept
commands.

statement - answerA program instruction.

True - answerTrue or false. A program mostly consists of a series of statements, each
statement usually appears on its own line.

Expression - answerCode that returns a value when evaluated; for example, the code
wage * hours * weeks is an expression that computes a number. * is the symbol for
multiplication. The names wage, hours, weeks, and salary are variables, which are
named references to values stored by the interpreter.

assignment - answerA new variable is created by performing an ___________ using the
= symbol, such as salary = wage * hours * weeks, which creates a new variable called
salary.

print() - answerDisplays variables or expression values.

comments - answer#' characters denote ____________, which are optional but can be
used to explain portions of code to a human reader.

print() - answerThe primary way to print output is to us the built-in function _________.

string literal - answerText enclosed in quotes is known as a ...

False - answerTrue or False. Text in string literals may not have letters, numbers,
spaces, or symbols like "@" or "#".

print('Hello', end = ' ') - answerMultiple print statements will each print on a new output
line. How would you keep the next print's output on the same line separated by a single
space?

True - answerTrue or False. A string literal can be surrounded by matching single or
double quotes: 'Python rocks!' or "Python rocks!". Good practice is to use single quotes
for shorter strings, and double quotes for more complicated text or text that contains
single quotes (such as print("Don't eat that!")).

, "print('Halt!', end = ' ') print('No access!')" - answerWrite code that will print "Halt!" and
"No access!" on a single line.

print('Welcome!') - answerWrite code that will print: Welcome!

print(num_cars) - answerGiven the variable num_cars = 9, write a statement that prints
9.

"wage = 20 print('Wage:' , wage) #Comma separates multiple items print('Goodbye.')" -
answer"Write code that prints the following: Wage: 20 Goodbye."

You are 22 years old. - answer"Assume variable age = 22 What is the output of
print('You are' , age, 'years old.')"

newline character - answerA new line can also be output by inserting \n, known as a
______________ ___________, within a string literal.

input() - answerReading input is achieved using the ________ function.

num_cars = input() - answerWrite a statement that reads a user-entered string into
variable num_cars.

type - answerDetermines how a value can behave.

my_var = int('15') - answerType a statement that converts the string '15' to an integer,
and assigns the result to my_var.

my_var + 5 - answer"Complete the code so that new_var is equal to the entered
number plus 5. my_var = int(input()) new_var = _______"

syntax error - answerA type of error that violates a programming language's rules on
how symbols can be combined to create a program.

runtime error - answerA type of error wherein a program's syntax is correct but the
program attempts an impossible operation, such as dividing by zero or multiplying
strings together (like 'Hello' * 'ABC').

crash - answerAbrupt and unintended termination of a program.

SyntaxError - answerThe program contains invalid code that can not be understood.

IndentationError - answerThe lines of the program are not properly indented.

ValueError - answerAn invalid value is used - can occur if giving letters to int().

NameError - answerThe program tries to use a variable that does not exist.

The benefits of buying summaries with Stuvia:

Guaranteed quality through customer reviews

Guaranteed quality through customer reviews

Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.

Quick and easy check-out

Quick and easy check-out

You can quickly pay through credit card or Stuvia-credit for the summaries. There is no membership needed.

Focus on what matters

Focus on what matters

Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!

Frequently asked questions

What do I get when I buy this document?

You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.

Satisfaction guarantee: how does it work?

Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.

Who am I buying these notes from?

Stuvia is a marketplace, so you are not buying this document from us, but from seller Dreamer252. Stuvia facilitates payment to the seller.

Will I be stuck with a subscription?

No, you only buy these notes for $17.99. You're not tied to anything after your purchase.

Can Stuvia be trusted?

4.6 stars on Google & Trustpilot (+1000 reviews)

73773 documents were sold in the last 30 days

Founded in 2010, the go-to place to buy study notes for 14 years now

Start selling
$17.99
  • (0)
  Add to cart