Answer:-
Text Code :
#include <iostream>
#include <string>
#Include <sstream>
using namespace std;
//Function Declaration
string UnsignedPartialSum(string para1,string para2,int num);
//Main driver function
int main() {
//Inputs
string para1=''1101101'';
string para2=''10111'';
int num = 3;
//Output
count << UnsignedPartialSum(para1,para2,num)<<endl;
return 0;
}
//Fumction Definition
string UnsignedPartialSum(string para1,string para2,int num) {
//Necessary Variables
int maxLen = 0, ansMul = 0, numVal,temPara1;
char charVal;
string zero = ''0'' ansFinal ='''';
//Check to see if integer argument passed is positive
if(num < 0) {
return ''Error! Integer Parameter is negative'';
}
//Check to see if parameter 1 is binary or not
for (int i =0; i < para1.Length();i++) {
charVal = para1.at(i);
numVal = charVal-'0';
if (numVal > 1 || numVal < 0) {
return ''Error! para1 is not binary'';
}
}
//check to see if parameter 2 is binary or not
for (int i =0; i < para2.length();i++) {
charVal = para2at(i);
numVal = charVal - ''0'';
if (numVal > 1 || numVal < 0) {
return ''Error! para2 is not a binary'';
}
}
//Calculating maximum length
if (para1.size() > para2.size()) {
maxLen = para1.size();
}else {
maxLen = para2.size();
}
//Calculating final string with answer
stringstream templnt(para1);
templnt >> tempPara1;
charVal = para2.at(num);
numVal = charVal - ''0'' ;
ansMul = numVal * tempPara1;
if (num > 0) {
for (int i = 0; i < (maxLen +1); i++) {
if (i <(maxLen -(num -1))) {
ansFinal + = zero;
} else if (i ==(maxLen -(num -1))) {
ansFinal += to_string(ansMul);
} else {
ansFinal +=Zero;
}
}
if (ansMul ==0) {
for (int i =0;i <(maxLen -1);i++) {
ansFinal + = zero;
}
}
} else {
for (int i =0; i < maxLen; i++) {
ansFinal +=zero;
}
if (ansMul > 0) {
ansFinal +=to_string(ansMul);
}
if (ansMul ==0) {
for (int i = 0; i < (maxLen -1); i++) {
ansFinal +=zero;
}
}
}
return ansFinal;
}
CODE :


INPUT :
Input 1 :
Input 2 :
Input 3 :
Input 4 :
OUTPUT :
Output 1 :![<terminated> (exit value: 0) BinaryTestChegg Debug [C/C++ Application] p0000110110100](http://img.homeworklib.com/questions/358530c0-3611-11ec-9006-cd2a71d81dd0.png?x-oss-process=image/resize,w_560)
Output 2 :
Output 3 :![<terminated> (exit value: 0) BinaryTestChegg Debug [C/C++ Application] Error! Para2 is not a binary](http://img.homeworklib.com/questions/36673620-3611-11ec-a09b-cfe8f9f5ce6d.png?x-oss-process=image/resize,w_560)
Output 4 :
help ASAP 3. Write a string C++ function named UnsignedPartialSum() that takes two string parameters and...
Create a JavaScript function named display_data that has two parameters. The first parameter will be a String containing a JSON blob like the function in part 1 returns. The second parameter will be a boolean. Start by using the JSON library to convert the first parameter into a usable JavaScript Object. Next get the HTML element whose id is "data". This HTML element is a div. If the second parameter is equal to true , write the value associated with...
Java arrays Create method named repeatedN that takes two integer parameters named range and n and returns an integer array Method should return an integer array that has numbers 0 - range repeated in order n times If range is less than or equal to 0; return an array that has 0 repeated n times Create a second method named printArray that takes an integer array as a parameter. The method should print out every element on the same line...
Python 3.6
Question 12 (20 points) Write a function named wordLengths. The function wordLengths takes two parameters: 1. inFile, a string that is the name of an input file 2. outFile, a string that is the name of an output file The input file exists when wordLengths is called; wordLengths must create the file outFile. The input file contains only letters and white space For each line of the input file, wordLengths should identify the length of the longest word...
/* Write a recursive function named editDistance that accepts two string * parameters and returns the "edit distance" between the two strings as an * integer. Edit distance (also called Levenshtein distance) is the minimum * number of "changes" required to get from s1 to s2 or vice versa. A "change" * is a) inserting a character, * b) deleting a character, or * c) changing a character to a different character. *...
c++ Write a function Count_m_z that takes a string as an input parameter argument and counts the number of m, n, o, ... z characters in it. The function returns an integer value for the number of times those 14 lowercase letters appear in the input string. Your function should be named Count_m_z Your function should take one string parameter Your function should return the number of m, n, o, ... z characters as an integer Your function should not...
Write a function named insertBeforeKey that takes the parameters as follows list as an char array, capacity for the capacity of the array, numItems has the number of items in the array, key is an element of the array before which newVal is to inserted. Assume key is always present in the array. and newVal has the new value to be inserted into the array. If the array is at capacity then the function should return -1, otherwise return 0...
Code written in NASM Function called findLargest Write a function called findLargest that receives two parameters: an unsigned doubleword array and the length of the array. The function must return the value of the largest array member in eax. Preserve all registers (except eax) that are modified by the function. Write a test program in main that calls findLargest three times, each call using a different array with different lengths. Function called countHits Write a function called named countHits that...
Must be C++ 11
Write a function named insertinArray that takes the following parameters: list: an integer array index: index at which to insert the new item numitems: number of items currently in the array arrayCapacity: capacity of the array newVal: value to insert into the array If the array is at capacity then the function should return-1. Otherwise, insert newVal at index and return O for success int insertInArray(int listl 1, int index, int numItems, int arrayCapacity, int newVal)...
Write a function template named summarray, with two parameters: and array called are and an int holding the number of elements in arr. The function should return the sum of the elements in arr. this template must work for double or int arrays. Show a sample function call to the template function you wrote. What would you have to do to use the templates sumArray function with an array of objects of a custom class?
Python: Write a function named "filter_rows" that takes a string as a parameter representing the name of a CSV file with 5 columns in the format "<string>,<int>,<int>,<int>,<int>" and writes a file named "invite.csv" containing the rows from the input file where the value in the fifth column is greater than 101