0% found this document useful (0 votes)
20 views3 pages

Function A&R

The document outlines assertions and reasoning related to functions in Python, providing examples of true/false statements regarding variable scope, argument types, and function definitions. Each assertion is paired with reasoning to clarify the concepts of global variables, positional and keyword arguments, and the structure of function calls. The content serves as a study guide for understanding Python functions and their characteristics.

Uploaded by

A.S.Vishwaa
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views3 pages

Function A&R

The document outlines assertions and reasoning related to functions in Python, providing examples of true/false statements regarding variable scope, argument types, and function definitions. Each assertion is paired with reasoning to clarify the concepts of global variables, positional and keyword arguments, and the structure of function calls. The content serves as a study guide for understanding Python functions and their characteristics.

Uploaded by

A.S.Vishwaa
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

VELAMMAL VIDYALAYA – SHOLINGANALLUR.

XII – COMPUTER SCIENCE (083) - FUNCTIONS


ASSERTION AND REASONING
(A) Both A and R are true and R is the correct explanation for A
(B) Both A and R are true and R is not the correct explanation for A
(C) A is True but R is False
(D) A is false but R is True
1. Assertion (A): A variable declared as global inside a function is visible with changes
made to it outside the function.
Reasoning (A): All variables declared outside are not visible inside a function till they are
redeclared with global keyword.
Ans:
2. Assertion (A): - If the arguments in a function call statement match the number and
order of arguments as defined in the function definition, such arguments are called
positional arguments.
Reasoning (R): - During a function call, the argument list first contains default
argument(s) followed by positional argument(s).
Ans:
3. Assertion (A):- In Python, statement return [expression] exits a function.
Reasoning (R):- Return statement passes back an expression to the caller. A return
statement with no arguments is the same as return None.
Ans:
4. Assertion (A): - keyword arguments are related to the function calls.
Reasoning (R): - when you use keyword arguments in a function call, the caller identifies
the arguments by parameter name.
Ans:
5. Assertion(A): Function is defined as a set of statements written under a specific name
in the python code.
Reason(R): The complete block (set of statements) is used at different instances in the
program as and when required, referring the function name. It is a common code to
execute for different values(arguments), provided to a function.
Ans:

1
6. Assertion (A): - print(f1()) is a valid statement even if the function f1() has no return
statement.
Reasoning (R): - A function always returns a value even if it has no return statement.
Ans:
7. Assertion: The default value of an argument will be used inside a function if we do not
pass a value to that argument at the time of the function call.
Reason: The default arguments are optional during the function call. It overrides the
default value if we provide a value to the default arguments during function calls.
Ans:
8. Assertion (A): -Built in functions are predefined in the language that are used directly.
Reasoning(R): -print () and input () are built in functions.
Ans:
9. Assertion (A): - The default arguments can be skipped in the function call.
Reasoning (R): - The function argument will take the default values even if the values are
supplied in the function call.
Ans:
10. Assertion (A): The function definition calculate (a, b, c=1, d) will give error.
Reason (R): All the non-default arguments must precede the default arguments.
Ans:
11. Assertion (A): - To use a function from a particular module, we need to import the
module.
Reason (R): - import statement can be written anywhere in the program, before using a
function from that module.
Ans:
12. Assertion (A): Python standard library consists of number of modules.
Reason (R): A function in a module is used to simplify the code and avoids repetition.
Ans:
13. Assertion (A): For changes made to a variable defined within a function to be visible
outside the function, it should be declared as global.
Reason (R): Variables defined within a function are local to that function by default,
unless explicitly specified with the global keyword. Ans:

2
14. Assertion (A): A variable defined outside any function or any block is known as a
global variable.
Reason (R): A variable defined inside any function or a block is known as a local variable.
Ans:
15. Assertion (A): A function definition can have zero parameters/formal arguments.
Reason (R): Parenthesis are not mandatory to call a function with zero arguments.
Ans:
16. Assertion (A): Number of arguments passed to a function may not match the number
of parameters in the function definition.
Reason (R): Function parameters can have default values.
Ans:
17. Assertion (A): If the arguments in function call statement are provided in the format
parameter=argument, it is called keyword arguments.
Reason (R): During a function call, the argument list first contain keyword arguments(s)
followed by positional argument(s).
Ans:
18. Assertion (A): A function is block of organized and reusable code that is used to
perform a single, related action.
Reason (R): Function provides better modularity for your application and a high degree
of code reusability.
Ans:
19. Assertion (A): Functions in a program increases the modularity and readability of the
program.
Reason (R): Usage of functions increases the execution speed of the program.
Ans:
20. Assertion (A): Arguments are also called as actual arguments or actual parameters.
Reason (R): Parameters are also called as formal parameter or formal arguments.
Ans:

You might also like