Filters
Question type

The function header of a function definition indicates how the function is to be called.

A) True
B) False

Correct Answer

verifed

verified

Variables defined outside of any function have ___________ scope.

Correct Answer

verifed

verified

Which of the following is not a valid use of function avg?


A) average = avg(num1, num2, num3)
B) result = factor * avg(num1, num2, num3)
C) avg(num1, num2, num3) = (num1 + num2 + num3) / 3
D) print('The average of num1, num2 and num3 is', avg(num1, num2, num3) )
E) if avg(num1, num2, num3) > 100:
Print('Average above 100 found')

F) A) and B)
G) A) and C)

Correct Answer

verifed

verified

The period of time for which a variable exists is called its ___________.

Correct Answer

verifed

verified

Examine the following Python code: Examine the following Python code:   What will Line 9 print out? A)  0 B)  80 C)  85 D)  5 E)  40 What will Line 9 print out?


A) 0
B) 80
C) 85
D) 5
E) 40

F) A) and B)
G) B) and E)

Correct Answer

verifed

verified

Which of the following is not true about the scope and lifetime of variables in Python:


A) local variables have local scope
B) global variables have global scope
C) local variables have a longer lifetime than global variables
D) the same identifier name can be used for different local variables of other functions
E) The use of global variables is not good programming practice

F) None of the above
G) D) and E)

Correct Answer

verifed

verified

It is generally considered good practice to use global variables whenever possible.

A) True
B) False

Correct Answer

verifed

verified

Examine the following Python code: Examine the following Python code:   Which line/lines of code make up the suite (body)  of the function? A)  Line 1 B)  Line 2 C)  Line 3 D)  Lines 1 and 2 E)  Lines 2 and 3 Which line/lines of code make up the suite (body) of the function?


A) Line 1
B) Line 2
C) Line 3
D) Lines 1 and 2
E) Lines 2 and 3

F) A) and B)
G) D) and E)

Correct Answer

verifed

verified

________________ arguments correspond with the associated parameters in a function call by their position in the arguments passed.

Correct Answer

verifed

verified

Value-returning functions can return more than one value by returning a single tuple containing multiple values.

A) True
B) False

Correct Answer

verifed

verified

Any function in Python that does not contain a return statement returns special value None.

A) True
B) False

Correct Answer

verifed

verified

Match the following: -A named group of instructions performing some task


A) routine
B) function
C) formal parameter
D) actual argument
E) function invocation

F) B) and E)
G) C) and D)

Correct Answer

verifed

verified

There is a fundamental difference in the way value-returning and non-value-returning functions are called.

A) True
B) False

Correct Answer

verifed

verified

Functions can be designed are useful in more than one program.

A) True
B) False

Correct Answer

verifed

verified

Function calls may not be used within a print instruction in Python.

A) True
B) False

Correct Answer

verifed

verified

The correspondence of actual and formal parameters is determined by the names of the actual arguments passed.

A) True
B) False

Correct Answer

verifed

verified

Non-value-returning functions are called for their side effect.

A) True
B) False

Correct Answer

verifed

verified

Calls to value-returning functions in Python are expressions.

A) True
B) False

Correct Answer

verifed

verified

Match the following: -contains the function name and parameter list


A) function header
B) function body (suite)
C) value-returning function
D) non-value-returning function
E) return statement

F) C) and D)
G) B) and E)

Correct Answer

verifed

verified

Examine the following code: Examine the following code:   What will the output of this code be? What will the output of this code be?

Correct Answer

verifed

verified

Showing 41 - 60 of 83

Related Exams

Show Answer