I am trying to get the range of bits from a number. For example , if I call bitRange(0x00001234, 0 , 4). I will get 0x00000004; 0x00001234 is the number i want to the range of bits from. 0 is the starting position. 4 is the number of bits to get from the number.

Want to see the full answer?
Check out a sample Q&A here


Related Computer Science Q&A
Find answers to questions asked by students like you.
Q: Write a Python program to calculate and print the number of positive and negative changes in a…
A: pos=0 neg=0 #read string from user s=input() #find nof negitives and positives for i in…
Q: A bit (meaning binary digit) is 0 or 1. An ordered array of eight bits (such as01101001) is a byte.…
A: A byte will have eight bits. to find number of different bytes we have to find the number of…
Q: Write a program that asks the user to enter and integer number and read it. Then ask him to enter a…
A: GIVEN: Write a program that asks the user to enter and integer number and read it. Then ask him to…
Q: A random positive integer between 0 and 35767 is generated by the computer. Write a program which…
A: 1. To set 3rd bit use bitwise or operator with 23 2. To set 5th bit use bitwise or operator with 25…
Q: Write a program that asks the user to enter an unsigned number and read it. Then swap the bits at…
A: Purpose: The main purpose of the program is that when the user will enter a particular number that…
Q: This question is about the Hadamard code corresponding to the 16 × 16 Hadamard matrix created by…
A: Here our number is 55536, after converting even numbers to zero and odd numbers to 1, our message…
Q: Write a Python program to calculate and print the number of positive and negative changes in a…
A: pos=0 neg=0 #read string from user s=input() #find nof negitives and positives for i in…
Q: Give regular expressions for: a) All binary strings with exactly two 1’s b) All binary strings…
A: a) All binary strings with exactly two 1’s: two 1s are their number of zeroes that can be before the…
Q: In B-bit unsigned Binary format, write down the exponent value of the number represented in IEEE 754…
A: Here in this question we have given a floating point number in IEEE format..and we have asked to…
Q: A truck is trying to enter the military cantonment area. The security guard knows that every truck…
A: I have provided PYTHON CODE along with CODE SCREENSHOT and 2 OUTPUT SCREENSHOTS…
Q: Convert pseudocode to c++ code PO: T1 = Time(); for (i = 0; i < 1000; i++) send(x[i],P1); T2 =…
A: Pseudocode is an informal way of describing what your program does without any strict programming…
Q: Let L={ w in(0 + 1)* 1 | w has even number of 1s}, i.e. L is the set of all bit strings with even…
A: Given , Language L={ w in(0 + 1)* 1 | w has even number of 1s},We have asked to choose the correct…
Q: Write a program that having as an input a positive integer n, lists all the bit sequences of length…
A: PROGRAM CODE: import java.util.Scanner; public class Main { public static void…
Q: A string is called a palindrome if it reads the same when reversed. That is, the string x1 x2 ... xn…
A: The solution for the above given question is given below:
Q: Below is a text written entirely in binary. Your goal is to convert this to English using the…
A: Since no programming language is mentioned, I am using python. I am storing the given data in a text…
Q: One way to electrically or optically represent a binary 1 or 0 is to use the transition between a…
A: GIVEN: One way to electrically or optically represent a binary 1 or 0 is to use the transition…
Q: What is the exact number of bytes in a system that contains (a) 32K bytes, (b) 64M bytes, and (c)…
A: In computer works, 210 is referees as K (kilo) , 220 as M (Mega),and 230as G (Giga)a) Find the exact…
Q: 1 8 23 EXPONENT FRACTION N = (-1)5 × 1.fraction x 2@xponent– 127 Here the exponent has the limits: 1…
A: We usually represents floating point numbers in IEEE 754 standard. According to this standard while…
Q: Print " Hello! Peter" line 15 times in different lines
A: The Answer in Below Steps
Q: Your data file ending in "Dat935" contains 4096 discrete values for x(t)=A*sin(2*pi*f1*t) +…
A: In electronics , the signal is the electric current or the electromagnetic field used to convey the…
Q: Given that a computer uses 4-bit ones’s complement numbers, what value will be stored in the…
A: A computer uses 4-bit one’s complement numbers. The initial value of “j” is given as “1”, and the…
Q: Given arbitrary 8-bit number, check whether it is bigger than signed decimal - 10, if it is bigger…
A: ORG 00H ;Assembly Starts from 0000H.
Q: Write a general program to multiply two 8.bit numbers by repeated addition method. For example, to…
A: As per the given problem, we need to perform addition of two numbers by repeated addition method.…
Q: Let's say we want to add two 4-bit numbers: 0 1 1 1 + 10 1 0 C S3 S2 S, So What answer should you…
A: 1+0 or 0+1= 1 1+1= 0 carry 1 1+1+1 = 1 carry 1 Note this three addition rule.
Q: If we wanted to find the value (1 or 0) of the third bit from the right (bitNum = 2) of variable x,…
A: Your answer is given below.
Q: An engineer is writing a program that transfers non-negative real numbers to integer format. What is…
A: - The question wants to know the maximum non-negative integer that can be represented by a 5-bit…
Q: Expand the decimal number 939 into sum of values. Decimal number 21 to binary. Until what decimal…
A: We will solve the first three questions for you. If you want any specific question to be solved then…
Q: WRITE A PYTHON PROGRAM TO TAKE INPUT OF Z NUMBERS AND THEN PRINT THE SUM BITWISE XOR AND BITWISE OR…
A: The solution to the given problem is below.
Q: Write a regular expression that matches a normalized 32-bit binary IEEE 754 FP number and has no…
A: Given: The expression has total 32 bits. Only 1 digit is allowed before decimal point. * says 0…
Q: Write a program to add 32-bit number in memory locations staring at [0000] to 32-bit number in…
A: Add the 32-bit number in memory locations 0000H and 0002H to the 32-bit number in memory…
Q: Suppose you want to send the following 2 16-bits numbers: 11010010 01111010 and 10011010 01011001.…
A: Click to see the answer
Q: Given a binary string S of size N. You had been given the task to convert the given string into Fair…
A: The problem can be solved using Greedy technique. The idea is to traverse the given string from left…
Q: A calculator uses 9 bit binary numbers with one bit for the sign of the number, followed by 5 bits…
A: We need to show a number on a table where one Bit for sign, 5 bit for mantissa and 3 bits for…
Q: Write a program that asks the user to enter an unsigned number and read it. Then swap the bits at…
A: ANSWER:-
Q: Let Code C be C = {01011010, 11000001, 01010101} a.) Up to how many errors can the code C detect?…
A: The given code is C = {01011010, 11000001, 01010101} First of all, we need to compute the hamming…
Q: The binary string 11001111101001 is a floating-point number expressed using the 14-bit simple model…
A: Answer: Given Binary string 11001111101001 is floating point number and first left most bit is sign…
Q: Convert the decimal number (1249)10 to its equivalent binary, hexadecimal, and octal (base 8). What…
A: To convert the decimal number to its equivalent binary, hexadecimal, and octal number. The base of…
Q: Calculate the total number of bits per character. Record your answers in the chart. Character Code…
A: The question as been solved, kindly refer from step2
Q: Write a program that asks the user to enter and integer number and read it. Then ask him to enter a…
A: Given: We are given a problem in which the user is asked to enter an integer as input. Goal: We have…
Q: A computer stores real numbers in floating point format in 8-bit words. The first bit is used for…
A: Click to see the answer
Q: What are the hexadecimal values for the following values by using the little endian byte order? Ox…
A: Answer: The hexadecimal values for the following values by using the little endian byte order Ox 00…
Q: Below is a text written entirely in binary. Your goal is to convert this to English using the…
A: 1011001 1101111 1110101 1110010 - Y o u r 1110111 1100101 1100100 1100100 1101001 1101110 1100111 -…
Q: Write a program in java to swap two values using Bitwise operator and you have to take these values…
A: Required:- Write a program in java to swap two values using the Bitwise operator and you have to…
Q: Consider an 8-bit variable that we want to use for storing real numbers. We decided to use 3 bits…
A: Given Representation Format 00000.000 As the numbers are real so they can also store negative…
Q: Let's say that an AES-128 key was 00 00 00 01 00 00 00 02 00 00 00 03 00 00 00 04. (It's a bad key…
A: AES-128 key 00 00 00 01 00 00 00 02 00 00 00 03 00 00 00 04 w0 = 00 00 00 01 w1 = 00 00 00 02 w2 =…
Q: Convert the decimal (base 10) number 63 to a binary (base 2) number that has only the digits '0' and…
A: To convert decimal to binary , simply divide the number by 2, keep the remainder every time and…
Q: Below is a text written entirely in binary. Your goal is to convert this to English using the…
A: Convert the binary numbers to decimal and then display respective ASCII values 1000010 1100101…
Q: In Booth’s multiplication method we add one bit on the left of a binary number. a.True in case of…
A: In Booth’s multiplication method an extra bit is added when we multiply 2 binary numbers So, the…











