What does the following expression do?
x = (x<<1) + x + (x>>1);
Bit_Masking
Quiz
•
Computers
•
University
•
Hard
Kirti Aggarwal
Used 5+ times
FREE Resource
10 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What does the following expression do?
x = (x<<1) + x + (x>>1);
multiplies an integer with 7
multiplies an integer with 3.5
multiplies an integer with 3
multiplies an integer with 8
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Suppose we have a set {1, 2, 3}. Find the XOR of all the subsets of the set.
1
2
3
0
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Right shift(>>) and Left shift(<<) are equivalent to _____ by 2.
multiply and divide
divide and multiply
addition and subtraction
subtraction and addition
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
If we want to invert all the bits of a number, then which bitwise operator should be used?
~
&
|
^
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the result of the following expression? (num ^ 0)
it will print 0
it will print num
it will print 1
none
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of these is not a bitwise operator?
&
&=
|=
<=
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
public static void main(String[] args) {
byte z = 16;
int x;
x = z << 3;
System.out.println("Value of z= " + z);
System.out.println("Value of x= " + x);
}
Value of z= 16
Value of x= 128
Value of z= 16
Value of x= 2
Value of z= 1
Value of x= 128
Value of z= 1
Value of x= 2
10 questions
Weekly Contest #3 - TechXNinjas
Quiz
•
University
12 questions
Operators in C
Quiz
•
University
15 questions
Basic Java Quiz
Quiz
•
University
15 questions
Soal Java
Quiz
•
11th Grade - University
10 questions
Basics Of C Programming
Quiz
•
University
15 questions
II CSM A & B
Quiz
•
University
10 questions
Java Arrays
Quiz
•
University
15 questions
Java
Quiz
•
University
15 questions
Character Analysis
Quiz
•
4th Grade
17 questions
Chapter 12 - Doing the Right Thing
Quiz
•
9th - 12th Grade
10 questions
American Flag
Quiz
•
1st - 2nd Grade
20 questions
Reading Comprehension
Quiz
•
5th Grade
30 questions
Linear Inequalities
Quiz
•
9th - 12th Grade
20 questions
Types of Credit
Quiz
•
9th - 12th Grade
18 questions
Full S.T.E.A.M. Ahead Summer Academy Pre-Test 24-25
Quiz
•
5th Grade
14 questions
Misplaced and Dangling Modifiers
Quiz
•
6th - 8th Grade