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, thern 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 count

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_2

Step: 3

blur-text-image_3

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

Microsoft Visual Basic 2005 For Windows Mobile Web Office And Database Applications Comprehensive

Authors: Gary B. Shelly, Thomas J. Cashman, Corinne Hoisington

1st Edition

0619254823, 978-0619254827

More Books

Students also viewed these Databases questions