Computer Science Unit 3
select the two true statements about functions with parameters: -parameters can only be used once within the body of a function -functions with parameters can be used to prevent the creation of duplicated code -parameters hep generalize the solution of a specific problem -values do not need to be provided to a function with parameters in any particular order
-functions with parameters can be used to prevent the creation of duplicated code -parameters hep generalize the solution of a specific problem
Choose the two (2) statements that are true about functions -meaningful function names help people better understand programs -meaningful function names help computers better understand programs -functions in programming are useful mathematical tools for doing complex computations -functions in programming are named groupings of programming instructions
-meaningful function names help people better understand programs -functions in programming are named groupings of programming instructions
Hexadecimal
A base-16 number system that uses sixteen distinct symbols 0-9 and A-F to represent numbers from 0 to 15.
algorithm
A precise sequence of instructions for processes that can be executed by a compute
Low level programming language
A programming language that captures only the most primitive operations available to a machine. Anything that a computer can do can be represented with combinations of low level commands.
High level programming language
A programming language with many commands and features designed to make common tasks easier to program. Any high level functionality is encapsulated as combinations of low level commands.
What kinds of circumstances would lead you to writing a function versus using a loop?
Functions are used when you want to change something in the code, or create a new feature, which cannot be done by using a loop. Therefore, you would use a function instead of a loop when you want to change something within the function you are re-calling.
What does "efficiency" in programming mean?
In programming the term "efficiency" referred to using the least amount of turtle directions needed to complete the correct image that needed to be coded.
"Abstraction" is often used to focus on a general case and ignore a specific instance of a problem. Given this meaning of the word, how are functions with parameters an example of abstraction?
Parameters make the function more general when writing its code, so you are not being specific until you call the function in the coding of your overall image.
explain at least one reason why programming languages have functions, include an example
Programming languages have functions to make coding less complex and faster because of its reusability. For instance, we programmed a function to turn right rather than having to type in turnLeft three times every time.
Turtle Programming
a classic method for learning programming with commands to control movement and drawing of an on-screen robot called a "turtle". The turtle hearkens back to early implementations in which children programmed a physical robot whose dome-like shape was reminiscent of a turtle.
Library
a collection of commands / functions, typically with a shared purpose
Documentation
a description of the behavior of a command, function, library, API, etc.
function
a named group of programming instructions. Functions are reusable abstractions that reduce the complexity of writing and maintaining programs
top-down design
a problem solving approach (also known as stepwise design) in which you break down a system to gain insight into the sub-systems that make it up
loop
a programming construct that repeats a group of commands
abstraction
a simplified representation of something more complex. Abstractions allow you to hide details to help you manage complexity, focus on relevant concepts, and reason about problems at a higher level.
what is a function parameter?
a way to give input to a function that controls how the function runs
application program interface (API)
a well-documented library of functions provided in a programming language that helps to simplify complex programming tasks
parameter
an extra piece of information that you pass to the function to customize it for a specific need
Which of the following is NOT a true statement about functions? -functions are reusable programming abstractions -functions help reduce the complexity of writing and maintaining programs -functions help break a problem into logical chunks -once defined, a function can be called many times from different parts of a program -functions cannot make calls to other functions written by the same programmer
functions cannot make calls to other functions written by the same programmer
which of the following is NOT part of defining a function?
giving the parameter a value
Which of the following statements about writing functions and Top-Down Design is NOT true? -writing functions helps manage complexity in a program -top-down design leads to programs which feature multiple layers of abstraction -two programmers solving the same problem using top-down design should arrive at identical programs -top-down design relies upon identifying sub-problems of a larger problem -top-down design assists in identifying the layers of functions that will be used to solve a programming problem
two programmers solving the same problem using top-down design should arrive at identical programs