I am having a time with these problems:
X=1100110000110011
Y=0000111100001010
1) what would I get in binary representation for X<<5?
2) what is the two's complement of negative Y (-Y)?
3) If X is an int variable, what do we know about the value of X&X?
a. It is always equal to X.
b. It is always greater than 1.
c. It is always equal to zero.
d. It is always equal to 1.
4 1277 sicarie 4,677
Recognized Expert Moderator Specialist
What are you having trouble with? Did you try them? What did you get?
HI.,..
i cant understand Q1 fully, but if you wanna all binary values for x < 5 then
Q1: x=000 , 001 , 010 , 011 , 100
Q2: to get the 2's complementer first u reverse all bits 0s to 1s and all 1s to 0s and then additional the result by 1
Y=0000111100001010
1's Complementer =1111000011110101
2's Complementer =0000000000000001
and then add each 2 bits ------------------------------
= xxxxxxxxxxxxxxxx
the result is the 2's complementer for Y or -Y by 2's complementer
Q3: answer is choice A
try to check behind me i cant exactly rememmber all things, but i think it will right answer..
by the way is that home work? :D
GOOD LUCK..
Ganon11 3,652
Recognized Expert Specialist
Q1 isn't asking about the < operator, but the bitshift operator <<, which I believe moves the entire set of bits to the left, creating 0s at the end. For instance, - X = 0100 1101
-
X << 2
-
(X is now 0001 0011 0100)
Of course, I could be wrong.
Q1 isn't asking about the < operator, but the bitshift operator <<, which I believe moves the entire set of bits to the left, creating 0s at the end. For instance, - X = 0100 1101
-
X << 2
-
(X is now 0001 0011 0100)
Of course, I could be wrong.
hey..no man i think that you fully right, its SHL operator
Many Thanx
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Dan Stromberg |
last post by:
I've written up a page about how to convert native binary data to
another platform's native binary data, as I did some fortran data
conversions for a client.
The programs and documentation are...
|
by: Steven T. Hatton |
last post by:
§27.4.2.1.4 Type ios_base::openmode
Says this about the std::ios::binary openmode flag:
*binary*: perform input and output in binary mode (as opposed to text mode)
And that is basically _all_ it...
|
by: Tanuki |
last post by:
Hi All:
I encounter a programming problem recently. I need to read a binary
file. I need to translate the binary data into useful information. I
have the format at hand, like 1st byte = ID,...
|
by: vim |
last post by:
hello everybody
Plz tell the differance between binary file and ascii
file...............
Thanks
in advance
vim
|
by: Daz |
last post by:
Hi everyone!
I am very new to casting and converting, so much in fact then when I
think I have it figured out, something proves me wrong. I was wondering
if there is any logic in 'what types can...
| |
by: Harlin Seritt |
last post by:
Hi...
I would like to take a string like 'supercalifragilisticexpialidocius'
and write it to a file in binary forms -- this way a user cannot read
the string in case they were try to open in...
|
by: masood.iqbal |
last post by:
Hi,
Kindly excuse my novice question. In all the literature on ifstream
that I have seen, nowhere have I read what happens if you try to read
a binary file using the ">>" operator. I ran into...
|
by: raphfrk |
last post by:
This program should copy one file onto the other. It works if I
compile it with gcc to a cygwin program. However, if I compile it
with the -mno-cygwin option, it doesn't work (this targets native...
|
by: Bill Cunningham |
last post by:
I was wondering if someone could look this file over for me. It compiles
correctly and prints the number 2 so I know fscanf is working. I am reading
a text file and converting the text data...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
| |