Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

10) Why do we write functions in our programs? What does the use of functions offer over just putting the code into the main function,

image text in transcribed
image text in transcribed
10) Why do we write functions in our programs? What does the use of functions offer over just putting the code into the main function, or just skip the main function and put all of the code into the program? 11) What is a class? What is an object? How is a class related to an object? 12) How are parameters and arguments related? How are they different? 13) (MC) If a function returns a value but the part of the program that called the function does not store the returned value, then a) the function will have an error the next time that it is called b) the program will crash because of this c) the user will be prompted to enter the return value d) the return value will not be available for use in the part of the program that called the function e) the program will crash the next time that the function is called 14) (MC) A loop in a program allows a programmer to a) repeatedly execute one or more instructions b) write fewer instructions c) write programs that run faster d) both choices a) and b) are correct e) all of choices a), b), and c) are correct Chapter 4, Sections 4.1 through 4.3, pp. 113-144 15) Write a Python function named addEvens. It takes a positive whole number as a parameter and it calculates and returns the sum of the positive even numbers up to the value of the parameter. It prints nothing. For example, if the value of the parameter is 20, then the function returns 110 16) (MC) Using functions in the design of a program a) allows a programmer to write code once but use it many times b) allows a programmer to re-use a function in another program c) makes the program easier to understand and to change if needed d) both choices a) and b) are correct e) all of choices a), b), and c) are correct 17) How is a for loop similar to a while loop? In what way or ways are for and while loops different? 18) What is the value in sum at the end of the execution of the code at the right? count 10 while count0: sumsum count count-count-1

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Big Data Fundamentals Concepts, Drivers & Techniques

Authors: Thomas Erl, Wajid Khattak, Paul Buhler

1st Edition

0134291204, 9780134291208

More Books

Students also viewed these Databases questions

Question

5. Do you have any foreign language proficiency?

Answered: 1 week ago