CSP Unit 4 test Review

Pataasin ang iyong marka sa homework at exams ngayon gamit ang Quizwiz!

Select the two true statements about functions with parameters:

Parameters help generalize the solution of a specific problem. Functions with parameters can be used to prevent the creation of duplicated code.

What is a function parameter?

A way to give input to a function that controls how the function runs

Programming languages have some similarities and differences to the "natural" language you use in everyday speech. Select the TWO true statements about programming languages:

Ambiguities in natural language necessitate the creation of programming languages for controlling a computer; Compared to the number of words in a natural language, the number of defined words in a programming language is very small.

Which of the following best characterizes a high-level programming language?

It helps programmers identify errors as components are added to a working program.

A procedure named findSearchPhrase was developed last year by a programmer at your company and it has been used internally for several months with positive results. The procedure accepts two parameters: the domain of a website, and a search phrase. findSearchPhrase then returns a list of all the web pages associated with the domain that have a reference to the search phrase. The list is in descending order by creation date.You have been given a programming project to find all possible web pages on a domain named www.myAnimals.io that reference giraffe, and sort them in ascending order by the web page name. You will need to run this program on an ongoing basis.Of the following, what would be the best strategy for completing this project?

1. execute 2. execute

2,1 2,3 1,1 2,3 3,3

2,1 2,3 1,1 2,3 3,3

Function

A named group of programming instructions. Function must have a unique name; called the way to call the function; Can't change until the code is done.

Which of the following statements is most true concerning general programming languages?

Most general programming languages are comparable when it comes to being able to express an algorithm

A process named "Stepwise Refinement" is useful when programming. What is Stepwise Refinement?

Stepwise Refinement is a top-down design process in which the programmer starts with the overall goal of the program and continually breaks down the design into sub-functions.

What is benefit of having a parameter in Laura's procedure

The changeScore procedure can be generalized to any situation where the score needs to change

Laura is writing the code for a maze game. There are several different kinds of items hidden throughout the game and retrieving each item adds or subtracts a certain amount from the user's score. Laura writes a procedure called ***changeScore*** that takes one parameter: a number (either positive or negative).

The procedure is reusable and cuts down on the amount of duplicated code in her program

A program is expressed in a programming language. Which of the following is true of the program?

The program can also be expressed as binary code, but will be more easily understood by humans when expressed in a higher-level programming language

The Manhattan distance is often used when talking about how many city blocks two locations are from one another. If you are in a city with only north/south streets and east/west streets and trying to get to a location that is 10 miles east and 2 miles north, then which of the following paths will NOT get you to the destination?

Going 1 mile north, then 1 mile east twice, then 9 miles east

wendy is writing a program that will do some complicated calculations. one part of the calculation involves finding the result of a certain base raised to a certain exponent. this calculation needs to be done multiple times, and the base and exponent will be different each time. wendy decides to write a helper procedure for the exponent calculation.which of the following statements are true of the parameters in wendy's procedure?select two answers.

the parameter will probably be different each time she calls the names of parameters will affect how procedures run

wendy is writing a program that will do some complicated calculations. one part of the calculation involves finding the result of a certain base raised to a certain exponent. this calculation needs to be done multiple times, and the base and exponent will be different each time. wendy decides to write a helper procedure for the exponent calculation.which of the following statements are true of the parameters in wendy's procedure?select two answers.

the procedure will make her program less efficient


Kaugnay na mga set ng pag-aaral

exercise physiology chapter 5 hormones

View Set

Psyc 260 Test 1 Practice Questions

View Set

Sem 3 - Unit 6 - Nutrition - NCO

View Set

Economics Chapter 7-10 test review

View Set

Chapter 12: Gross Domestic Product and Growth

View Set

CMJN 2100 final Auburn University (I got a 100)

View Set

Chapter 5: Consumer Credit: Advantages , Disadvantages, Sources, and Costs

View Set

WGU C113 - Instructional Planning (Math)

View Set