MCQ IN COMPUTER SCIENCE & ENGINEERING

COMPUTER SCIENCE AND ENGINEERING

DIGITAL LOGIC

Question [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
If an expression contains both AND and OR operations, which is performed first, unless there is parentheses in the expression?
A
AND
B
OR
C
Both operate
D
None of the above
Explanation: 

Detailed explanation-1: -If an expression contains two or more operators with the same precedence, the operator to the left is evaluated first. For example, 10 / 2 * 5 will be evaluated as (10 / 2) and the result multiplied by 5. When a lower precedence operation should be processed first, it should be enclosed within parentheses.

Detailed explanation-2: -If all arithmetic operators in an expression have the same level of precedence, the order of execution is left to right. Expressions in parentheses take precedence over all other operations.

Detailed explanation-3: -You can use parentheses to force some parts of an expression to be evaluated before others. This can override both the order of precedence and the left associativity.

Detailed explanation-4: -An expression is a combination of one or more operands, zero or more operators, and zero or more pairs of parentheses. There are three kinds of expressions: An arithmetic expression evaluates to a single arithmetic value. A character expression evaluates to a single value of type character.

There is 1 question to complete.