Sail E0 Webinar

MCQs

Total Questions : 24 | Page 1 of 3 pages
Question 1. On applying Left shift operator,
  1.    1
  2.    32
  3.    33
  4.    31
 Discuss Question
Answer: Option D. -> 31


The left shift operator shifts all of the bite in a value to the left specified number of times. For each shift left, the high order bit is shifted out and lost, zero is brought in from right. When a left shift is applied to an integer operand, bits are lost once they are shifted past the bit position 31.


Question 2. Which operator is used to invert all the digits in binary representation of a number?
  1.    ~
  2.    >>>
  3.    ^
 Discuss Question
Answer: Option A. -> ~


Unary not operator, ~, inverts all of the bits of its operand in binary representation.


Question 3. Which of these statements are incorrect?
  1.    The left shift operator,
  2.    The right shift operator, >>, shifts all of the bite in a value to the right specified number of times.
  3.    The left shift operator can be used as an alternative to multiplying by 2.
  4.    The right shift operator automatically fills the higher order bits with 0.
 Discuss Question
Answer: Option D. -> The right shift operator automatically fills the higher order bits with 0.


The right shift operator automatically fills the higher order bit with its previous contents each time a shift occurs. This also preserves the sign of the value.


Question 4. Which right shift operator preserves the sign of the value?
  1.    >>
  2.    >>=
 Discuss Question
Answer: Option A. -> >>


>>


Question 5. What is the output of relational operators?
  1.    Integer
  2.    Boolean
  3.    Characters
  4.    Double
 Discuss Question
Answer: Option B. -> Boolean


Boolean


Question 6. What should be expression1 evaluate to in using ternary operator as in this line?
expression1 ? expression2 : expression3
  1.    Integer
  2.    Floating "“ point numbers
  3.    Boolean
  4.    None of the mentioned
 Discuss Question
Answer: Option C. -> Boolean


The controlling condition of ternary operator must evaluate to boolean.


Question 7. Which of these statements are incorrect?
  1.    Equal to operator has least precedence.
  2.    Brackets () have highest precedence.
  3.    Division operator, /, has higher precedence than multiplication operator.
  4.    Addition operator, +, and subtraction operator have equal precedence.
 Discuss Question
Answer: Option C. -> Division operator, /, has higher precedence than multiplication operator.


Division operator, /, has equal precedence as of multiplication operator. In expression involving multiplication and division evaluation of expression will begin from right side when no brackets are used.


Question 8.

What is the order of precedence (highest to lowest) of following operators?

 1. &

 2. ^

 3. ?:

  1.    1 -> 2 -> 3
  2.    2 -> 1 -> 3
  3.    3 -> 2 -> 1
  4.    2 -> 3 -> 1
 Discuss Question
Answer: Option A. -> 1 -> 2 -> 3


1 -> 2 -> 3


Question 9. What is the value stored in x in following lines of code?
int x, y, z; x = 0; y = 1; x = y = z = 8;
  1.    0
  2.    1
  3.    9
  4.    8
 Discuss Question
Answer: Option D. -> 8


9


Question 10. Which of the following can be operands of arithmetic operators?
  1.    Numeric
  2.    Boolean
  3.    Characters
  4.    Both Boolean & Characters
 Discuss Question
Answer: Option D. -> Both Boolean & Characters


The operand of arithmetic operators can be any of numeric or character type, But not boolean.


Latest Videos

Latest Test Papers