Computer Science
Assertion (A): The conditional flow of control can be defined with the help of if statement.
Reasoning (R): if statement executes one or more statements based on the given condition. If the condition evaluates to true, the statement block following the indentation gets executed, otherwise nothing gets executed.
- 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.
Answer
Both A and R are true and R is the correct explanation of A.
Explanation
The if statement in Python allows conditional flow of control. It evaluates a condition and executes one or more statements based on whether the condition is true or false. If the condition evaluates to true, the statement block following the if statement (indented code) gets executed, otherwise, if the condition is false, that block is skipped, and the program continues with the next statement after the if block.
Related Questions
Assertion (A): In Python, strings, lists and tuples are called Sequences.
Reasoning (R): Sequence is referred to as an ordered collection of values having similar or different data types.
- 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.
Assertion (A): break and continue are termed as Jump statements.
Reasoning (R): Jump statements can only be used with looping constructs but not with conditional constructs.
- 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.
Assertion (A): Indexing refers to accessing elements of a sequence. Python offers two types of indexing, viz. positive or forward and negative or backward indexing.
Reasoning (R): Both forward and backward indexing are implemented in all the sequences, which start with first (1st) index.
- 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.
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.