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 {}.

    1. Both A and R are true and R is the correct explanation of A.
    2. Both A and R are true but R is not the correct explanation of A.
    3. A is true but R is false.
    4. A is false but R is true.


  • 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.

    1. Both A and R are true and R is the correct explanation of A.
    2. Both A and R are true but R is not the correct explanation of A.
    3. A is true but R is false.
    4. A is false but R is true.


  • 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.


  • Python Functions

    Assertion. A function is a subprogram.

    Reason. A function exists within a program and works within it when called.


  • Python Functions

    Assertion. Non-default arguments cannot follow default arguments in a function call.

    Reason. A function call can have different types of arguments.


  • 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.


  • 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.


  • 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.


  • 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.


  • 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.


Showing 21 - 30 of 201 Questions