- Home
- Studylists
Class - 12 CBSE Computer Science — Assertion Reason Type Questions
Class - 12 CBSE Computer Science — Assertion Reason Type Questions
Python Dictionaries
Assertion (A): Dictionaries in Python are mutable.
Reasoning (R): The data inside a dictionary is stored as the key:value pairs enclosed within the curly braces {}.
- Both A and R are true and R is the correct explanation of A.
- Both A and R are true but R is not the correct explanation of A.
- A is true but R is false.
- A is false but R is true.
View Answer2 Likes
Python Dictionaries
Assertion (A): You can add an element in a dictionary using key:value pair.
Reasoning (R): A new (key:value) pair is added only when the same key doesn't exist in the dictionary. If the key is already present, then the existing key gets updated and the new entry will be made in the dictionary.
- Both A and R are true and R is the correct explanation of A.
- Both A and R are true but R is not the correct explanation of A.
- A is true but R is false.
- A is false but R is true.
View Answer2 Likes
Python Data Handling
Assertion. In Insertion Sort, a part of the array is always sorted.
Reason. In Insertion sort, each successive element is picked and inserted at an appropriate position in the sorted part of the array.
View Answer1 Likes
Python Functions
Assertion. A function is a subprogram.
Reason. A function exists within a program and works within it when called.
View Answer1 Likes
Python Functions
Assertion. Non-default arguments cannot follow default arguments in a function call.
Reason. A function call can have different types of arguments.
View Answer2 Likes
Python Functions
Assertion. A parameter having a default in function header becomes optional in function call.
Reason. A function call may or may not have values for default arguments.
View Answer1 Likes
Python Functions
Assertion. A variable declared inside a function cannot be used outside it.
Reason. A variable created inside a function has a function scope.
View Answer1 Likes
Python Functions
Assertion. A variable not declared inside a function can still be used inside the function if it is declared at a higher scope level.
Reason. Python resolves a name using LEGB rule where it checks in Local (L), Enclosing (E), Global (G) and Built-in scopes (B), in the given order.
View Answer1 Likes
Python Functions
Assertion. A parameter having a default value in the function header is known as a default parameter.
Reason. The default values for parameters are considered only if no value is provided for that parameter in the function call statement.
View Answer3 Likes
Python Functions
Assertion. A function declaring a variable having the same name as a global variable, cannot use that global variable.
Reason. A local variable having the same name as a global variable hides the global variable in its function.
View Answer1 Likes