1. For this assignment you will print the steps for 8-bit by 8-bit multiplication.
2. Your program should read in two unsigned numbers from stdin, the first being the multiplicand and the second being the multiplier. Your program should verify that both values are within the range 0 to 255. If not, the program should print an appropriate error message and exit.
3. Your program should then initialize the simulated registers and echo the input values in decimal and also in binary.
4. Then your program should illustrate the eight steps required for multiplication using the same type of step diagrams as given in the lecture notes.
5. Finally, your program should print a check section that shows a summary of the multiplication in binary as well as in decimal. See the example below.
6. You may write your program in C, C++, or Java. If you choose to work in C, here is an example function that will allow you to represent an n-bit value within an int data type and print out the binary value in "length" bits. It uses the shift right operator and the bitwise and. (You can also choose to use unsigned int as the data type; since you are using only the lower 8 of the 32 bits in an int, there will be no apparent difference between using int and using unsigned int. However, if you choose to use char as the data type, you should use unsigned char to ensure that the compiler generates logical rather than arithmetic shifts.)
void prt_bin( int value, int length ){
int i;
for( i=(length-1); i>=0; i--){
if((value>>i)&1)
putchar('1');
else
putchar('0');
}
}
For example, if you declare acc as an int, then you could call prt_bin(acc,8) to print the 8-bit value in the accumulator.
You should format your output to exactly match the output below. 10% of the grade will be awarded for following the same format.
Sample Run is given below:
multiplicand: 33
multiplier: 55
c and acc set to 0
mq set to multiplier = 55 decimal and 00110111 binary
mdr set to multiplicand = 33 decimal and 00100001 binary
---------------------------------------------------
step 1: 0 00000000 00110111
+ 00100001 ^ add based on lsb=1
----------
0 00100001 00110111
>> shift right
0 00010000 10011011
---------------------------------------------------
step 2: 0 00010000 10011011
+ 00100001 ^ add based on lsb=1
----------
0 00110001 10011011
>> shift right
0 00011000 11001101
---------------------------------------------------
step 3: 0 00011000 11001101
+ 00100001 ^ add based on lsb=1
----------
0 00111001 11001101
>> shift right
0 00011100 11100110
---------------------------------------------------
step 4: 0 00011100 11100110
+ 00000000 ^ no add based on lsb=0
----------
0 00011100 11100110
>> shift right
0 00001110 01110011
---------------------------------------------------
step 5: 0 00001110 01110011
+ 00100001 ^ add based on lsb=1
----------
0 00101111 01110011
>> shift right
0 00010111 10111001
---------------------------------------------------
step 6: 0 00010111 10111001
+ 00100001 ^ add based on lsb=1
----------
0 00111000 10111001
>> shift right
0 00011100 01011100
---------------------------------------------------
step 7: 0 00011100 01011100
+ 00000000 ^ no add based on lsb=0
----------
0 00011100 01011100
>> shift right
0 00001110 00101110
---------------------------------------------------
step 8: 0 00001110 00101110
+ 00000000 ^ no add based on lsb=0
----------
0 00001110 00101110
>> shift right
0 00000111 00010111
---------------------------------------------------
check: binary decimal
00100001 33
x 00110111 x 55
---------------- ------
0000011100010111 1815
Answer:
Code:
#include<bits/stdc++.h>
using namespace std;
char* prt_bin( int value, int length, char s[]){
for(int i=(length-1); i>=0; i--){
if((value>>i)&1) {
s[length-1-i] = '1';
// putchar('1');
}
else {
s[length-1-i] = '0';
// putchar('0');
}
}
s[length] = '\0';
return s;
}
int main(){
int nbits = 8, c, acc;
char s[nbits+1];
int multiplicand, multiplier, mq, mdr;
cout<<"Multiplicand: ";
cin>>multiplicand;
cout<<"Multiplier: ";
cin>>multiplier;
if(multiplier<0 || multiplier>255 ||multiplicand<0 || multiplicand>255){
cout<<"Given Multiplicand or multiplier is incorrect. Exiting the program.\n";
return 0;
}
c = 0; acc = 0;
cout<<"c and acc set to 0\n";
mq = multiplier;
mdr = multiplicand;
cout<<"mq set to multiplier = "<<multiplier<<" decimal and "<<prt_bin(multiplier, nbits, s)<<" binary\n";
cout<<"mdr set to multiplicand = "<<multiplicand<<" decimal and "<<prt_bin(multiplicand, nbits, s)<<" binary\n";
printf("---------------------------------------------------\n");
for(int i=1;i<=nbits;i++){
printf("step %d: %d %s ",i, c, prt_bin(acc, nbits, s));
printf("%s\n",prt_bin(mq, nbits, s));
char lsb = s[nbits-1];
if(lsb=='1'){
printf(" + %c %s ^add based on lsb=%c\n", c, prt_bin(mdr, nbits, s), lsb);
printf(" ----------\n");
acc = acc + multiplicand;
}
else{
printf(" + %c %s ^no add based on lsb=%c\n", c, prt_bin(0, nbits, s), lsb);
printf(" ----------\n");
}
printf(" %d %s ", c, prt_bin(acc, nbits, s));
printf("%s\n",prt_bin(mq, nbits, s));
printf(" >> shift right\n");
mq = mq>>1;
if(acc%2==1){
mq = mq+128;
}
acc = acc>>1;
printf(" %d %s ", c, prt_bin(acc, nbits, s));
printf("%s\n",prt_bin(mq, nbits, s));
printf("---------------------------------------------------\n");
}
char sr[nbits*2+1];
printf("check: binary decimal\n");
printf(" %s %d\n", prt_bin(multiplicand, nbits, s), multiplicand);
printf(" x %s x %d\n", prt_bin(multiplier, nbits, s), multiplier);
printf(" ---------------- ------\n");
printf(" %s %d\n", prt_bin(multiplier*multiplicand, nbits*2, sr), multiplier*multiplicand);
return 0;
}
What are the differences between sequential and random files? Which one do you think is better and why?
Answer:
Sequential is better
Explanation:
Sequential is more organized while the more easier to make but less dependable one is random.
sequential is used for things such as date of birth, or where someone was born.
you can't do that with a random file.
Skunkworks appeared to have ________ task interdependence, while the Levittown builder seemed to have ________ task interdependence. Multiple Choice comprehensive; sequential pooled; comprehensive reciprocal; pooled sequential; reciprocal pooled; reciprocal
The article upon which the question is based on:
The Skunk Works home page describes this team best: "What do the world’s first stealth aircraft, the world’s most advanced fighters, and the world’s fastest manned aircraft have in common? They were all imagined by ‘Skunks’—some of the most innovative, strategic, and visionary thinkers around." Kelly Johnson was permitted to build an experimental engineering department in 1943, and the rest is history. The small-staffed unit was organized by integrating designers with builders, working together so that ideas were buildable, with limited visitors allowed from the outside. The impressive results are many, including the U-2, the world’s first spy plane, and the SR-71 Blackbird, the world’s fastest, highest-flying aircraft.
Answer:
1. comprehensive
2. sequential
Explanation:
Skunkworks appeared to have COMPREHENSIVE task interdependence, while the Levittown builder seemed to have SEQUENTIAL task interdependence.
This is based on the idea that Skunkworks acknowledges the powers of interaction and coordination of team members and while Levittown builders work on gradual working arrangement as one input of part A becomes the input of part B, and it goes on.
The trackpad/touchpad on my laptop is acting unusual. When I click on something or move to an area, it jumps or moves to another area. What would be a good troubleshooting step to try and resolve this issue?
a. Use a mouse instead
b. Remove all possible contact points, and test again while ensuring only a single contact point
c. Refer caller to user guides
d. increase the brightness of the display
Answer:
My best answer would be, "b. Remove all possible contact points, and test again while ensuring only a single contact point"
This is because usually when the cursor jumps around without reason, it's caused by the user accidentally hitting the mouse touchpad on his or her laptop while typing. ... Similarly, know that just because you have an external mouse attached to your laptop, the built-in mousepad is not automatically disabled.
Brainliest?
If you lose yellow from your printer, what would happen to the picture?
Answer:
The picture would be green.
, , and angle x and angle y are both in the first quadrant.
Answer:
[tex]\tan(x+y) = 3.73[/tex]
Explanation:
The missing part of the question are:
[tex]\sin(x) = \frac{1}{2}[/tex]
[tex]\cos(y) = \frac{\sqrt 2}{2}[/tex]
Required
[tex]\tan(x + y)[/tex]
First, we calculate [tex]\sin(y)[/tex] and [tex]\cos(x)[/tex]
We have:
[tex]\sin^2(x) + \cos^2(x) = 1[/tex]
So:
[tex](1/2)^2 + \cos^2(x) = 1[/tex]
Collect like terms
[tex]\cos^2(x) = 1 - (1/2)^2[/tex]
[tex]\cos^2(x) = 1 - \frac{1}{4}[/tex]
Take LCM
[tex]\cos^2(x) = \frac{4-1}{4}[/tex]
[tex]\cos^2(x) = \frac{3}{4}[/tex]
Square roots of both sides
[tex]\cos(x) = \frac{\sqrt 3}{2}[/tex]
Similarly,
[tex]\sin^2(y) + \cos^2(y) = 1[/tex]
So:
[tex]\sin^2(y)+(\sqrt 2/2)^2 = 1[/tex]
[tex]\sin^2(y)+ (2/4) = 1[/tex]
[tex]\sin^2(y)+1/2 = 1[/tex]
Collect like terms
[tex]\sin^2(y) = 1 - 1/2[/tex]
Take LCM
[tex]\sin^2(y) = \frac{2 -1}{2}[/tex]
[tex]\sin^2(y) = \frac{1}{2}[/tex]
Square roots of both sides
[tex]\sin(y) = \frac{1}{\sqrt2}[/tex]
Rationalize
[tex]\sin(y) = \frac{\sqrt2}{2}[/tex]
So, we have:
[tex]\sin(x) = \frac{1}{2}[/tex] [tex]\cos(x) = \frac{\sqrt 3}{2}[/tex]
[tex]\cos(y) = \frac{\sqrt 2}{2}[/tex] [tex]\sin(y) = \frac{\sqrt2}{2}[/tex]
[tex]\tan(x) = \sin(x) \div \cos(x)[/tex]
[tex]\tan(x) = \frac{1}{2} \div \frac{\sqrt 3}{2}[/tex]
Rewrite as:
[tex]\tan(x) = \frac{1}{2} * \frac{2}{\sqrt 3}[/tex]
[tex]\tan(x) = \frac{1}{\sqrt 3}[/tex]
Rationalize
[tex]\tan(x) = \frac{\sqrt 3}{3}[/tex]
Similarly
[tex]\tan(y) = \sin(y) \div \cos(y)[/tex]
[tex]\tan(y) = \frac{\sqrt 2}{2} \div \frac{\sqrt 2}{2}[/tex]
[tex]\tan(y) = 1[/tex]
Lastly,
[tex]\tan(x + y)= \frac{\tan(x) + \tan(y)}{1 - \tan(x) \cdot \tan(y)}[/tex]
[tex]\tan(x + y)= \frac{\frac{\sqrt3}{3} + 1}{1 - \frac{\sqrt3}{3} \cdot 1}[/tex]
[tex]\tan(x + y)= \frac{\frac{\sqrt3}{3} + 1}{1 - \frac{\sqrt3}{3}}[/tex]
Combine fractions
[tex]\tan(x + y)= \frac{\frac{\sqrt3+3}{3}}{\frac{3 - \sqrt3}{3}}[/tex]
Cancel out 3
[tex]\tan(x + y)= \frac{\sqrt3+3}{3 - \sqrt3}[/tex]
Using a calculator
[tex]\tan(x+y) = 3.73[/tex]
Imagine that you wanted to write a program that asks the user to enter in 5 grade values. The user may or may not enter valid grades, and you want to ensure that you obtain 5 valid values from the user. Which nested loop structure would you use?
A. A "for" loop inside of a "while" loop
B. A "while" loop inside of a "for" loop
C. None of the above
D. Either a or b would work
The type of nested loop which I would use to write the program is:
B. A "while" loop inside of a "for" loopWhat is a Loop?This refers to the control flow statement which is used to iterate and lets a particular line(s) of code execute repeatedly
With this in mind, we can see that the type of nested loop which I would use to write the program is a "while" loop inside of a "for" loop because it is a conditional statement that continues to ask for the certain valid grades until it gets the right one.
Therefore, the correct answer is option B
Read more about loops here:
https://brainly.com/question/26098908
Is" Python programming Language" really
worth studying? If yes? Give at least 10 reasons.
1. Python is a particularly lucrative programming language
2. Python is used in machine learning & artificial intelligence, fields at the cutting-edge of tech
3. Python is simply structured and easy to learn
4. Python has a really cool best friend: data science dilemma.
5. Python is versatile in terms of platform and purpose
6. Python is growing in job market demand
7. Python dives into deep learning
8. Python creates amazing graphics
9. Python supports testing in tech and has a pretty sweet library
10. There are countless free resources available to Python newbies
I have a variable and set it equal to 5. 1 then send it as an argument to a function that adds 5 to the variable passed in. Outside the function print the variable (after the function executes).
What will it print?
A. 5+1
B. 4
C. 6
D. 5
Answer:
D. 5
Explanation:
If the variables original value was 5 then the value that will be printed is 5. This is because the variable is being passed as a parameter into the function and 5 is being added to the parameter value, not the actual global variable outside. Therefore, in order for the adjusted value to be printed then that new value that is returned by the function needs to be saved in a new variable. This can be seen in the example code below.
Mario is giving an informative presentation about methods for analyzing big datasets. He starts with the very basics, like what a big dataset is and why researchers would want to analyze them. The problem is that his audience consists primarily of researchers who have worked with big data before, so this information isn’t useful to them. Which key issue mentioned in the textbook did Mario fail to consider?
Answer:
Audience knowledge level
Explanation:
The Key issue that Mario failed to consider when preparing for her presentation is known as Audience knowledge level.
Because Audience knowledge level comprises educating your audience with extensive information about the topic been presented. she actually tried in doing this but she was educating/presenting to the wrong audience ( People who are more knowledgeable than her on the topic ). she should have considered presenting a topic slightly different in order to motivate the audience.
#Write a function called find_median. find_median #should take as input a string representing a filename. #The file corresponding to that filename will be a list #of integers, one integer per line. find_median should #return the medi
Answer:
Explanation:
The following is written in Python. It takes in a file, it then reads all of the elements in the file and adds them to a list called myList. Then it sorts the list and uses the elements in that list to calculate the median. Once the median is calculated it returns it to the user. The code has been tested and the output can be seen in the image below.
def find_median(file):
file = open(file, 'r')
mylist = []
for number in file:
mylist.append(int(number))
numOfElements = len(mylist)
mylist.sort()
print(mylist)
if numOfElements % 2 == 0:
m1 = numOfElements / 2
m2 = (numOfElements / 2) + 1
m1 = int(m1) - 1
m2 = int(m2) - 1
median = (mylist[m1] + mylist[m2]) / 2
else:
m = (numOfElements + 1) / 2
m = int(m) - 1
median = mylist[m]
return median
print("Median: " + str(find_median('file1.txt')))
A life insurance salesperson who takes advantage of the foot-in-the-door phenomenon would be most likely to:________
a. emphasize that his company is one of the largest in the insurance industry.
b. promise a free gift to those who agree to purchase an insurance policy.
c. address customers by their first names.
d. ask customers to respond to a brief survey of their attitudes regarding life insurance.
Answer:
d. ask customers to respond to a brief survey of their attitudes regarding life insurance.
Explanation:
A life insurance policy can be defined as a contract between a policyholder and an insurer, in which the insurer agrees to pay an amount of money to a specific beneficiary either upon the death of the insured person (decedent) or after a set period of time.
A salesperson (sales representative) refers to an individual or employee who is saddled with the responsibility of taking orders from customers, as well as selling finished goods and services to consumers or end users.
A foot-in-the-door phenomenon can be defined as a compliance (persuasive) technique or tactics that assumes a person agreeing to perform a small request increases the likelihood of he or she agreeing to a subsequent larger request. Thus, it posits that when a person agrees to a small, it makes it difficult for him or her to decline a second, larger (bigger) request.
In this context, a life insurance salesperson who takes advantage of the foot-in-the-door phenomenon would most likely ask his or her customers to respond to a brief survey of their attitudes regarding life insurance.
Write an algorithm to solve general formula?
Answer:
2+2=4
Explanation:
simple math cause of that bubye
Write a class of complex numbers consisting of:
-Properties:
• Real part of type double;
• Virtual part of type double.
- Method:
• default constructor, 2-parameter constructor;
• Full setter, getter for each variable;
• the print() function prints SoPhuc as a string in the format a + bi, where a is the real part, b is the imaginary part
-Write main() function:
• Create 2 SoPhuc objects
• Use class methods to enter information for 2 objects
• Use print() method to print information of 2 objects that have been created
Answer:
hi sorry for not knowing the answer
but please follow have a great day,night, or afternoon
What hardware architectures are not supported by Red Hat?
Analyzing the role of elements in audio editing and Video
+ analyzing the role of the visual element in Video + analyzing the role of text factor
+ analyzing the role of the audio factor
+ analyzing the role of the transfer scene
+ analysing the role of the audio visual effects
Answer:
Analyzing the role of elements in audio editing and Video
+ analyzing the role of the visual element in Video + analyzing the role of text factor
+ analyzing the role of the audio factor
+ analyzing the role of the transfer scene
+ analysing the role of the audio visual effect
What type of program allows a user to copy or back up selected files or an entire hard disk to another storage medium?
Answer:
backup utility
Explanation:
Describe the system unit
Answer:
A system unit is the part of a computer that houses the primary devices that perform operations and produce results for complex calculations
what is the difference between system software and application software
Explanation:
System software is meant to manage the system resources. It serves as the platform to run application software. Application software helps perform a specific set of functions for which they have been designed. Application software is developed in a high-level language such as Java, C++, .
Explanation:
Hope it's the write answer
5 Write full forms of the following: CPU b. MHz с. СВТ d. CAI e. ICU f. POS a. Write suitable technical term for the following statements. The continuously working capacity of computer without loos its speed and accuracy. b. The computer terminology, in which output is determined accord to the input The computer device used in hospitals that helps to main heartbeat of the patient. Opiemak The collection of eight bits or two Nibbles. C. I byte d. ng School Level Computer Science - 6
Answer:
CPU = Central prossing Unit
what is incremental development and its importance in a project
Answer:
Incremental development in software engineering is a process methodology that emphasizes the virtue of taking small steps toward the goal.
Explanation:
Rather than delaying feedback until final delivery when time and resources have already been spent, incremental development ensures that teams can use feedback to make changes early and often.
The main importance of the Incremental model is that it divides the software development into submodules and each submodule is developed by following the software development life cycle process SDLC like Analysis, Design, Code, and Test.
Answer:
incremental development is any combination of both iterative design or iterative method and incremental build model for development
Explanation:
importance
Incremental development ensures that developers can make changes early on in the process rather than waiting until the end when the allotted time has run out and the money has been spent.
An incremental approach breaks the software development process down into small, manageable portions known as increments. Each increment builds on the previous version so that improvements are made step by step
Compute the acceleration of gravity for a given distance from the earth's center, distCenter, assigning the result to accelGravity. The expression for the acceleration of gravity is: (G * M) / (d2), where G is the gravitational constant 6.673 x 10-11, M is the mass of the earth 5.98 x 1024 (in kg) and d is the distance in meters from the earth's center (stored in variable distCenter).
#include
using namespace std;
int main() {
double G = 6.673e-11;
double M = 5.98e24;
double accelGravity;
double distCenter;
cin >> distCenter;
/* Your solution goes here */
cout << accelGravity << endl;
return 0;
}
Answer:
Replace /* Your solution goes here */ with the following expression
accelGravity = (G * M) / (distCenter *distCenter );
Explanation:
Required
Complete the code
The equivalent expression of (G * M) / (d^2) is:
(G * M) / (distCenter *distCenter );
The expression must be stored in accelGravity.
So, we have:
accelGravity = (G * M) / (distCenter *distCenter );
Does the estimate of a tolerance level of 68.26% of all patient waiting times provide evidence that at least two-thirds of all patients will have to wait less than 8 minutes?
Answer:
Yes, because the upper limit is less Than 8 minutes
Explanation:
According to the empirical formula :
68.26% of data lies within 1 standard deviation from the mean;
Hence,
Mean ± 1(standard deviation)
The sample mean and sample standard deviation of the given data is :
Sample mean, xbar = Σx / n = 546 / 100 = 5.46
Sample standard deviation, s = 2.475 (Calculator)
The interval which lies within 68.26% (1 standard deviation is) ;
Lower = (5.460 - 2.475) = 2.985
Upper = (5.460 + 2.475) = 7.935
(2.985 ; 7.935)
Since the interval falls within ; (2.985 ; 7.935) whose upper level is less than 8 means patients will have to wait less Than 8 minutes.
A new PKI is being built at a company, but the network administrator has concerns about spikes of traffic occurring twice a day due to clients checking the status of the certificates. Which of the following should be implemented to reduce the spikes in traffic?
A. CRL
B. OCSP
C. SAN
D. OID
Answer:
Option A (CRL) is the right answer.
Explanation:
Certificates with respective expiration date canceled mostly by CA generating or providing them, then it would no longer be tolerated, is considered as CRL.CRL verification could be more profitable for a platform that routinely manages several clients, all having pronouncements from a certain CA, because its CRL could be retrieved once per day.Other given choices are not connected to the given scenario. So Option A is the right one.
Shawn's supervisor has tasked him with determining how the company can increase the security of its Wi-Fi. Shawn plans to present several options to his supervisor and ask her to check his work. Which of the following is not a strong security method? (Select TWO.)
a. Disabling SSID
b. WPS
c. MAC filtering
d. Setting encryption
Answer:
The not strong security methods are:
a. Disabling SSID
b. WPS
Explanation:
When you disable SSID, you only make your Wi-Fi secure for the less determined attackers. By disabling the SSID (network name), those who are less technically inclined are prevented from connecting to the network but, this will not deter a more determined and technically savvy adversary. The best two options are MAC filtering and setting encryption. WPS (Wi-Fi Protected Setup) enables the process of connecting to a secure wireless network from a computer or other device easier instead of making it harder.
You are the network administrator for the ABC Company. Your network consists of two DNS servers named DNS1 and DNS2. The users who are configured to use DNS2 complain because they are unable to connect to internet websites. The following shows the configuration of both servers:
Server Configurations:
DNS1: _msdcs.abc.comabc.com
DNS2: .(root)_msdcs.abc.comabc.com
The users connected to DNS2 need to be able to access the internet. What should be done?
Answer:
ABC Company
The action to take is to:
Delete the .(root) zone from the DNS2. Then configure conditional forwarding on the DNS2 server. If this is not done, the users will be unable to access the internet.
Explanation:
DNS forwarding enables DNS queries to be forwarded to a designated server, say DNS2, for resolution according to the DNS domain name. This stops the initial server, DNS1, that was contacted by the client from handling the query, thereby improving the network's performance and resilience and enabling the users to be connected to the DNS2 in order to access the internet.
Write a program to print all odd numbers between 20 and 50(Qbasic)
Using simplified language and numbers, using large font type with more spacing between questions, and having students record answers directly on their tests are all examples of _____. Group of answer choices universal design analytic scoring cheating deterrents guidelines to assemble tests
Answer:
universal design
Explanation:
Using simplified language and numbers, using large font type with more spacing between questions, and having students record answers directly on their tests are all examples of universal design.
Universal Design can be regarded as design that allows the a system, set up , program or lab and others to be
accessible by many users, this design allows broad range of abilities, reading levels as well as learning styles and ages and others to have access to particular set up or program.
it gives encouragment to the development of ICTS which can be
usable as well as accessible to the widest range of people.
various gabs in the digital divide
Answer:
factors such as low literacy and income level Geographical restriction lack of motivation motivation of the technology lack of motivation to use technology and digital illiteracy and contribute to the digital device
Which of the following acronyms refers to a network or host based monitoring system designed to automatically alert administrators of known or suspected unauthorized activity?
A. IDS
B. AES
C. TPM
D. EFS
Answer:
Option A (IDS) is the correct choice.
Explanation:
Whenever questionable or unusual behavior seems to be detected, another alarm is sent out by network security equipment, which would be considered as Intrusion Detection System.SOC analysts as well as occurrence responders can address the nature but instead, develop a plan or take steps that are necessary to resolve it predicated on such notifications.All other three alternatives are not related to the given query. So the above option is correct.