Menu
Topics Index
...
`

BitSet With XOR Operation


If you need explanation Read this topic

If you need Answer Take test on this topic

BitSet With XOR Operation
What will the output of the following program?
import java.util.*;
class MainClass {
    public static void main (String args[]) {
        BitSet bites = new BitSet();
        bites.set(0);
        bites.set(1);
        bites.set(2);
        bites.set(3);
        bites.and(bites);
        System.out.println(bites);
        bites.xor(bites);
        System.out.println(bites);
    }
}

A. {}
{0, 1, 2, 3}
B. {0, 1, 2, 3}
{}
C. {0, 1, 2, 3}
{0, 1, 2, 3}
D. {}
{}
E. Compilation Error or Runtime Error
Topic: Java BitSet

If you need explanation Read this topic

If you need Answer Take test on this topic

User comments below. All of them might not be correct.

Ans is B.. bites & bites operation becomes  bites only where as bites xor bites operation becomes null..

Posted by Om Prakash Om    2014-04-17 03:39:06


ans is E there is no class with Bitset

Posted by Adithya Aleti    2014-04-17 09:50:21


Ans is B as Logically AND this bit set with the specified set of bits results the given values .Logically XORs this bit set with the specified set of bits and results empty

Posted by Naga Sinst    2014-04-18 04:09:05


Congratulations Om Prakash Om. You are this dose winner. We will send you the link using which you can claim your recharge.

Posted by Merit Campus    2014-04-18 04:20:10


© meritcampus 2019

All Rights Reserved.

Open In App