C Programming :: Bitwise Operators - Discussion - IndiaBIX

  • Home
  • Arithmetic Aptitude
  • Data Interpretation
  • Verbal Ability
  • Logical Reasoning
  • Verbal Reasoning
  • Nonverbal Reasoning
  • Online Tests
  • Current Affairs
  • General Knowledge
  • HR Interview
  • Group Discussion
  • Placement Papers
  • Technical Interview
  • Mechanical Engineering
  • Civil Engineering
  • ECE
  • EEE
  • CSE
  • Read more…
  • C Programming
  • C++
  • C#
  • Java
  • Database
  • Networking
  • Microbiology
  • Biochemistry
  • Biotechnology
  • Biochemical
  • Puzzles Quiz
  • Sudoku
  • Contact Us
C Programming - Bitwise Operators - Discussion
  1. Home
  2. C Programming
  3. Bitwise Operators
  4. Find Output of Program
  5. Discussion Forum
  6. Page 1 of 7
Discussion Forum : Bitwise Operators - Find Output of Program (Q.No. 5) Bitwise Operators 5.What will be the output of the program? #include<stdio.h> int main() { unsigned char i = 0x80; printf("%d\n", i<<1); return 0; } 0 256 100 80 Answer: Option Explanation: No answer description is available. Let's discuss. Discussion:65 comments Page 1 of 7. Newest
  • Newest
  • Oldest
  • Most Loved
  • Most Detailed
Mladen Saldanha said: 9 months ago if were a larger type (e.g., int), 0x80 << 1 would be 256 (binary 100000000).But the unsigned char is 8-bit, so the overflow bit is discarded, leaving 00000000 (0).So, I think answer is 0 Namu said: 6 years ago How 0x80 is converted into binary? (4) Jasber said: 6 years ago i=0x80 means( 0000 0000 1000 0000).i<<1means (0000 0001 0000 0000)= 256. (6) Keziahtabraham said: 7 years ago 0*80 means 0000 0000 1000 0000.Then, one time left shift(i<<1):0000 0001 0000 0000According to position 1 is at 8th position, then to convert binary to decimal, 2^8=256. (3) Rajani R said: 7 years ago Please someone explain this solution. ANUPA A said: 8 years ago Please, someone clearly explain to me what does the bitwise operator<< actually does. Vaishnavi said: 9 years ago Kindly explain this program clearly. Sandeep Kumar said: 9 years ago #include<stdio.h>int main(){unsigned char i = 0x80;i=i<<1;printf("%d\n", i);return 0;}In this case, also typecast operation is performed but final data is stored in 8 bit so the output is 0. (8) Nagendra said: 9 years ago // 1#include<stdio.h>int main(){ unsigned char i = 0x80; printf("%d\n", i<<1); return 0;}Here output 256.// 2#include<stdio.h>int main(){ unsigned char i = 0x80; i=i<<1; printf("%d\n", i); return 0;}Here output 0.* The diff is assignment of variable i. (4) Gopi.v said: 9 years ago if char i=0,if we use %c than it should print 0 on stdout. But if we use %d it should print the equal ASCII value of that char.if it is 0 than 48 should print.memory will take on datatype but on formatspecifier provided.any way char should take 1byte to store,for signed char the range from -128 to +127.1 bit used for sign representation. For unsign char no loss of bit ranges from 0 to 255.256 not valid in char type.in microcontroller suppouse 8051 all registers 8-bit othar dptr(16bit) if accumulator a regester value exceeds 8 bit then it will generate the carry. (1)
  • Prev
  • Enter a page number between 1 and 7: Go
  • 1
  • 2
  • ...
  • 7
  • Next
Post your comments here:

Your comments will be displayed after verification.

Post as Anonymous
Current Affairs
Check out the latest current affairs questions and answers.
Interview Questions
Check out the latest interview questions and answers.
Group Discussions
Check out the latest group discussions. Quick links Quantitative Aptitude
  • Arithmetic
  • Data Interpretation
Verbal (English)
  • Verbal Ability
  • Verbal Test
Reasoning
  • Logical
  • Verbal
  • Nonverbal
Programming
  • Python Programming
  • C Programming
  • C++, C#
  • Java
Interview
  • GD
  • HR
  • Technical Interview
Placement Papers
  • Placement Papers
  • Submit Paper

Từ khóa » C 0x80