Programming in C MCQ - Operators and Expressions

Correct AnswerOption D
Rate difficulty Rate difficulty:
Choose a difficulty.
The bitwise AND operator (&) produces a 1 bit only when the corresponding bits of both operands are 1. The mask 0x3F has its lowest six bits set to 1. Therefore, (ab & 0x3F) retains the lowest six bits of ab and clears the higher bits. For the result to equal 0x27, the lowest six bits of ab must equal 0x27. Among the listed options, only 0x27 satisfies this condition because 0x27 & 0x3F = 0x27. Other values with the same lowest six bits could also satisfy the expression, but they are not among the options. Therefore, option D is correct.
Cancel reply

Your email address will not be published. Required fields are marked *


Cancel reply

Your email address will not be published. Required fields are marked *

Correct AnswerOption A
Rate difficulty Rate difficulty:
Choose a difficulty.
Integer division in C discards the fractional part of the quotient, truncating the result toward zero. For example, 7 / 2 evaluates to 3, while -7 / 2 evaluates to -3. Therefore, option A is correct.
Cancel reply

Your email address will not be published. Required fields are marked *


Cancel reply

Your email address will not be published. Required fields are marked *

Correct AnswerOption B
Rate difficulty Rate difficulty:
Choose a difficulty.
The logical OR operator (||) uses short-circuit evaluation. If its first operand evaluates to true, the second operand is not evaluated because the overall result is already known to be true. Therefore, option B is correct.
Cancel reply

Your email address will not be published. Required fields are marked *


Cancel reply

Your email address will not be published. Required fields are marked *

Correct AnswerOption D
Rate difficulty Rate difficulty:
Choose a difficulty.
Found this useful?
Follow:
Among the listed operator categories, arithmetic operators have higher precedence than relational, equality, and logical operators. For example, addition is evaluated before a relational comparison when parentheses do not change the grouping. Therefore, option D is correct.
Cancel reply

Your email address will not be published. Required fields are marked *


Cancel reply

Your email address will not be published. Required fields are marked *

Correct AnswerOption A
Rate difficulty Rate difficulty:
Choose a difficulty.
Unary plus has higher precedence than the multiplication, relational, and equality operators listed in the other choices. Therefore, option A is correct.
Cancel reply

Your email address will not be published. Required fields are marked *


Cancel reply

Your email address will not be published. Required fields are marked *

Why Practice with Avatto?
High Quality MCQsExam-focused questions with accurate answers
Detailed ExplanationsStep-by-step explanations to enhance learning
Latest Exam PatternBased on updated syllabus and pattern
Performance AnalyticsTrack performance and improve weak areas
100% Free PracticePractice unlimited questions for free