python chapter 8 test

Réussis tes devoirs et examens dès maintenant avec Quizwiz!

Consider the following code: def sample (val): val = val + 5 #MAIN n = 19 sample(n) print(n)

19

What is output by the following code? def test(): print("Inside the sub") #MAIN print("In main") test() print("done.")

In main Inside the sub done.

Functions go _____________ the main program in the source code file.

above

Consider the following code: sample (a, b, c = 7, d)

c

We ____________ a functions when we type its name.

call

The __________ keyword creates the function.

def

Which of the following is NOT an example of a Python built-in function?

for

To create the body of a function, we ____________ the code.

indent

We call the central part of the program

main

A variable used to send information to a subprogram is called a _______________.

parameter

The _____________ keyword tells the subprogram what value to return.

return

which of the following is NOT true about functions

they go below the main program in the source code file

What is the primary use of functions?

to organize longer programs

Consider the following Python function definition: def mult(a, b = 1, c = 1): print(a * b * c)

print (mult(9, 15, 6, 7))


Ensembles d'études connexes

appendicular skeleton and joints lab quiz

View Set

Ch. 2 Basic Financial Statements

View Set

Ch. 9: Routine Business Messages

View Set

Test Review- Division, Separation, Layering, Grafting, Budding, Tissue Culture

View Set

Gravitational force questions and answers

View Set