• Shuffle
    Toggle On
    Toggle Off
  • Alphabetize
    Toggle On
    Toggle Off
  • Front First
    Toggle On
    Toggle Off
  • Both Sides
    Toggle On
    Toggle Off
  • Read
    Toggle On
    Toggle Off
Reading...
Front

Card Range To Study

through

image

Play button

image

Play button

image

Progress

1/30

Click to flip

Use LEFT and RIGHT arrow keys to navigate between flashcards;

Use UP and DOWN arrow keys to flip the card;

H to show hint;

A reads text to speech;

30 Cards in this Set

  • Front
  • Back
What is the range of short?
-32,768 to +32,767
Given a bit called A, what is the effect of A ^ 0
The result is A
How do you toggle a bit in a bitfield
bitfield ^ bit
How many bytes in a long?
4
How do you change the sign of a signed integer using bitwise operations?
bitwise-not the value and add 1
What is the range of unsigned short?
0 to 65,535
How do you express the value of a bit b in exponential notation
2^(b-1)
What's an easy way to compute the maximum positive value of an int with bitwise operators?
(unsigned int)~0 >> 1
Given an integer x, how can you tell if it is a power of 2 using bitwise operators?
!((x-1) & x)
How many bytes in a short?
2
How many bytes in an int?
4
What is the range of char?
-128 to +127
What is the range of unsigned char?
0 to 255
What is the range of int? (approx ok)
-2,147,483,648 to +2,147,483,647
What is the range of unsigned int? (approx ok)
0 to 4,294,967,295
What is unsigned short max expressed as hex?
0xFFFF
What is unsigned int max expressed as hex?
0xFFFFFFFF
How is the most significant bit of a int expressed in exponential notation?
2^31
How many bytes is a bool?
1
What is the character for bitwise NOT
~
What is the character for bitwise OR
|
What is the character for bitwise XOR
^
What is the bitwise operator for bitwise AND
&
What arithmetic operation is the equivalent of the left-shift operator (i.e. <<)
Multiplying by two to the power of
What arithmetic operation is the equivalent of the right-shift operator (i.e. >>)
Dividing by two to the power of
How to you clear a bit in a bitfield
bitfield & ~bit
Given a bit called A, what is the effect of A ^ 1
The result is the A flipped
Given an ingeger x, how to you find it's twos-complement using bitwise operators?
~x + 1
Implement the bitarray getter function given the following function signature:

bool getbit(char bitarray[], int bit)
bool getbit(char bitarray[], int bit)
{
bitarray += bit / 8;
return *bitarray & (1 << bit % 8);
}
Implement a bitarray setter function given the following signature:

void setbit(char bitarray[], int bit, bool value)
void setbit(char bitarray[], int bit, bool value)
{
bitarray += bit / 8;
if(value)
{
*bitarray |= (1 << bit % 8);
}
else
{
*bitarray &= ~(1 << bit % 8);
}
}