2. The following function definition is not perfect. What two errors can you find? int search(int a[n], int numberUsed, int target) { int index = 0; bool found = false; while ((!found) && (index < numberUsed)) if (target = a[index]) found = true; else index++; if (found) return index; else return -1; }
Q: 2. Given the following NFA state diagram a,b a a 90 92 93 The input string to the above NFA is…
A: Given NFA state diagram contains, Set of states= {q0, q2, q3} Set of input alphabets= {a, b} Initial…
Q: How does the functioning of one kind of cryptography differ from that of another, and what precisely…
A: Asymmetric encryption makes use of a couple of the public key and a private key to encode and…
Q: From 4 to 1 Mux design 8 to 1 Mux, with other gate and without other gate.
A: According to the information given:- We have to define From 4 to 1 Mux design 8 to 1 Mux, with other…
Q: Many controls have characteristics that influence whether or not they are shown on a form during…
A: Controls in graphical user interface programming: Controls are fundamental elements of graphical…
Q: How exactly might Model-View-Controller help to organize web applications? What are the benefits of…
A: Model-View-Controller: The Model-View-Controller (MVC) architectural pattern divides an application…
Q: Please explain how to close a record in a database and provide a description of how to do it.
A: Data base: A database is an organised data structure that holds information. A company's database…
Q: Suppose that we instead use an asymmetric cryptographic scheme. How many keys are required in
A: The answer is
Q: Businesses should be able to identify a range of data preservation techniques.
A: Preservation Techniques: Drying, chilling, and fermentation are some of the earliest ways of…
Q: What kinds of safety concerns will have to be resolved in a Parking management System (software),…
A: The following are the security challenges addressed for a Parking Management System (software), from…
Q: What are some of the characteristics that set a computer apart from othe devices?
A: Computers will work with high speed and accuracy when we compare them with calculation devices.…
Q: How may regions and availability zones be used to improve the cloud application's resilience,…
A: Cloud application's: Cloud computing is a technology that is used to offer computer services and…
Q: Make sure you know the difference between an appliance and a gadget. Provide illustrative instances…
A: Given: The equipment employed has a very precise purpose, according to the inquiry. You'll be titled…
Q: discuss the various techniques you can use to gather relevant information for the development of the…
A: In this question we have to discuss about various techniques which can be used for development of…
Q: When shifting from on-premise servers to an IaaS architecture, what are some of the governance…
A: IaaS architecture: Charity management employs IaaS to maintain the information infrastructure.…
Q: What is the return type of the read() method of the Buffered Reader Class used to read a single…
A: Given two multiple choice questions. So we provide detailed solution.
Q: More than 90% of the microprocessors/micro-controllers manufactured is used in emb
A: The answer is
Q: Different techniques to express patterns exist. Mention and explain five different approaches to…
A: The pattern is everything in the digital universe. A design may be either physical or…
Q: The CISO contacts the interns who seem to be in violation of many security rules, and they express…
A: The answer is
Q: Please enumerate and quickly describe the following four critical qualities that differentiate…
A: Given: The usage of a plan is not prohibited by an agile approach. At least in scrum, cadence takes…
Q: rganizations have a vital need for quality information. Discuss how the following database roles…
A: Lets see the solution.
Q: at is faster method than systolic array when dealing with matrix mul
A: Lets see the solution.
Q: When it was initially formed, what kind of issues did researchers hope to resolve with their work on…
A: It's been called the "Information Revolution" by some. Technological advancements provided Americans…
Q: In the process of building an LMS portal, what sort of system development life cycle should we
A: Step 1 An LMS portal may be used by administrators: and content providers to create, distribute,…
Q: What are some instances of P2P being used in a legal and suitable manner? Torrent-based P2P file…
A: The process of sharing, disseminating, and distributing digital material is known as peer-to-peer…
Q: When designing databases, why is it necessary to go through the normalisation step, and why is it…
A: A well-designed database gives you access to accurate, up-to-date information. Investing the time…
Q: Q2|| A|| Write a program in C++ language to find maximam number among three numbers.
A: Algorithm first you need to declare the three variables. now, ask the user to enter the three…
Q: Q5\| Write a program in C++ language to read the value of angles in degrees and calculates the value…
A: The code is given in the below step
Q: In the Open Systems Interconnection Model, what precisely is peer-to-peer communication?
A: Each computer in a peer-to-peer network is given the same amount of respect, and each workstation in…
Q: Answer the following using Polya's Four step in Problem Solving. 4. If i add 10 to my age and…
A: HI THEREI AM ADDING ANSWER BELOWPLEASE GO THROUGH ITTHANK YOU
Q: What is the effect of technology on human lives in terms of functionality?
A: The answer of this question is as follows:
Q: Discuss the difference between the two-tier and three-tier client/server architectures?
A: difference between the two-tier and three-tier client/server architectures?
Q: Q Write a c++ program for swapping two integer numbers
A: Introduction: The process of swapping two variables in computer programming refers to the exchange…
Q: Let 2B7E151628AED2A6ABF7158809CF4F3C be a 128-bit AES key (given in hexadecimal notation). (a)…
A: Given: 128 bit AES key= 2B7E151628AED2A6ABF7158809CF4F3C SOLUTION IN STEP 2
Q: Explain why conditional statements are used in your coding solution and how they will help you…
A: Conditional statements are the statement which contains some condition and a block. Inside the block…
Q: Code in C 1. Implement a Stack using a linked-list.
A: As per guidelines I can answer only first question. I hope you will understand. Thank You. Code:…
Q: When it comes to computing, what are the advantages of utilizing CUDA and GPUs?
A: CUDA: CUDA is a computing platform and API that allows programmers to employ individual GPUs for…
Q: What precisely are virtual machines (VMs) for individuals who are unfamiliar with them? What good is…
A: Institution: If you're unsure what virtual machine is, the solution is simple. Virtual machines'…
Q: . WAP to reverse string in Java by using while loop without reverse function.
A: The answer of this question is as follows:
Q: Why is it critical for schools to deploy Software-Defined Networking (SDN)? Describe yourself in…
A: Software Defined Networks: Software-defined networks are abbreviated as SDN. As its name indicates,…
Q: Is it possible to define Agile software development processes in a standard way?
A: Agile Software Development: Agile software development is flexible. Adaptive development techniques…
Q: Provide an explanation as to the significance of specifying controls in a software system.
A: Introduction: A software system is a collection of interconnected components based on software that…
Q: create_numbers_dictionary(numbers) which takes a list of integers as a Define a function called…
A:
Q: Is it possible to demonstrate how file permissions in the Unix operating system give an additional…
A: Unix operating system: UNIX and UNIX-LIKE file system security is based on 9 authorization names,…
Q: What is the proof that technology and computer science have had an impact on our society? Give…
A: The following are few examples of the impact that technology has had on our society and the…
Q: Compilation of Machine Exercises [1] PRELIM PERIOD [2] MIDTERM PERIOD [3] FINAL PERIOD ENTER YOUR…
A: //C++ program #include <iostream.h> #include<conio.h> void main() { int ch,i;…
Q: Maximum Subsequence Sum Problem:Given a sequence of 10 integers: -10 1 2 3…
A: The Algorithm: First we will Initialize: if max_till_now = INT_MIN max_closing = 0 Now we…
Q: 8. Use K-Maps to find the minimal expansion as the Boolean sum of the product of the following…
A: HI THEREI AM ADDING ANSWER BELOWPLEASE GO THROUGH ITTHANK YOU
Q: State the objective of a group support system gss and identify three characteristics that…
A: Comprises the majority of the elements in a DSS, as well as software, to give effective support in…
Q: QIB Assume a=5, b-4, c=6 find the result of the following expressions? 1) Tl= (a c) || (b> a) &&(ac)…
A: answer along with output screenshot is given below
Q: THE FUTURE OF WIRELESS NETWORKING Describe the advantages of wireless communication technologies in…
A: Communications System: A communications system, often known as a communications network, is a…
C++ QUESTION
2. The following function definition is not perfect. What two errors can you find?
int search(int a[n], int numberUsed, int target)
{
int index = 0;
bool found = false;
while ((!found) && (index < numberUsed))
if (target = a[index])
found = true;
else
index++;
if (found)
return index;
else
return -1;
}
Step by step
Solved in 4 steps with 2 images
- C PROGRAM Reverse + Random Formula In the code editor, there's already an initial code that contains the function declaration of the function, computeReverseNumber(int n) and an empty main() function. For this problem, you are task to implement the computeReverseNumber function. This function will take in an integer n as its parameter. This will get the reverse of the passed integer and will then compute and return the value: result = (original_number + reverse_of_the_number) / 3 In the main() function, ask the user to input the value of n, call the function computeReverseNumber and pass the inputted value of n, and print the result in the main() with two (2) decimal places. SAMPLE: Input n: 20 Output: 7.33 Input n: 123 Output: 148.00Problem: Write a C++ program that would implement the function called filterString which accepts a string s that contains numbers and letters mixed up. The function must return an integer corresponding to the numbers in s in the order that they appear. If there are no numbers in s, the function should return 0. TEST CASES: filterString(‘123’) = 123 filterString(‘abc’’) = 0 filterString(‘aa 112 3dd’) = 1123 ASSUMPTIONS Assume that all the inputs are strings (no need for try-catch method)In C++, please write a program according to the instructions and all the criteria. Thank you. Instruction Write and test a function that returns a copy of its string parameter with no repeated characters. The functions ignore case when they compare letters. The functions return strings whose letters are upper case. Write 2 versions of the function: string remDups(const string& original); void remDups(const string& original, string& nodups); Suppose the original string is “Myrtle has big feet” The function returns MYRTLE HASBIGF Test the functions thoroughly. Criteria compile, run, test the test program compiles, runs, and calls both versions of the function without crashingthe test program tests the functions thoroughly function parameters and returns one function has one constant string reference parameter and returns a stringone function has one constant string reference parameter, one string reference parameter and returns void. function operations the function removes…
- c program, The greatest common divisor (GCD) of two integers (of which at least one is nonzero) is the largest positive integer that divides the numbers. Write a C function gcd that accepts two integers and returns -1 if both integers are zero, otherwise it returns their GCD. Write a C program (that includes the function gcd) which accepts two integers and prints their GCD. Do not use a recursive functionImplement in C Programming 6.6.3: Function with loop: Shampoo. Write a function PrintShampooInstructions(), with int parameter numCycles, and void return type. If numCycles is less than 1, print "Too few.". If more than 4, print "Too many.". Else, print "N: Lather and rinse." numCycles times, where N is the cycle number, followed by "Done.". End with a newline. Example output with input 2:1: Lather and rinse. 2: Lather and rinse. Done. Hint: Declare and use a loop variable. #include <stdio.h> /* Your solution goes here */ int main(void) { int userCycles; scanf("%d", &userCycles); PrintShampooInstructions(userCycles); return 0;}Consider the following recursive function. What does it calculate in terms of x, y, and z? 01: Private Function CalcRecurse(ByVal x As Integer, ByVal y As Integer, ByVal z As Integer) As Integer 02: If x <= 1 Then 'Assume that CalcRecurse always starts with x > 1 03: Return y 04: Else 05: Return z + CalcRecurse(x - 1, y, z) 06: End If 07: End Function
- C++ Programming problem: Write a program, using a void function, that takes as input an integer and outputs two times the number if it is even; otherwise it outputs five times the number. Then, using a void function, write a program that takes as input two integer values, say n and m. The function returns the sum and average of all the numbers between n and m (inclusive).(Numerical) Write a program that tests the effectiveness of the rand() library function. Start by initializing 10 counters to 0, and then generate a large number of pseudorandom integers between 0 and 9. Each time a 0 occurs, increment the variable you have designated as the zero counter; when a 1 occurs, increment the counter variable that’s keeping count of the 1s that occur; and so on. Finally, display the number of 0s, 1s, 2s, and so on that occurred and the percentage of the time they occurred.(Exponentiation) Write a function integerPower(base, exponent) that returns the value ofbaseexponentFor example, integerPower(3, 4) = 3 * 3 * 3 * 3. Assume that exponent is a positive, nonzero integer, and base is an integer. Function integerPower should use for to control the calculation. Donot use any math library functions.
- (Perfect Numbers) An integer is said to be a perfect number if the sum of its divisors, including 1 (but not the number itself), is equal to the number. For example, 6 is a perfect number, because 6=1+2+3. Write a functionisPerfect that determines whether parameter number is a perfect number. Use this function in a program that determines and prints all the perfect numbers between 1 and 1000. Print the divisors of each perfect number to confirm that the number is indeed perfect. Challenge the power of your computer by testing numbers much larger than 1000.C Program: An integer number is said to be a perfect number if its factors, including 1 (but not the number itself), sum to the number. For example, 6 is a perfect number because 6 = 1 + 2 + 3. I have written a function called isPerfect (see below), that determines whether parameter passed to the function is a perfect number. Use this function in a C program that determines and prints all the perfect numbers between 1 and 1000. Print the factors of each perfect number to confirm that the number is indeed perfect. // isPerfect returns true if value is perfect integer, // i.e., if value is equal to sum of its factors int isPerfect(int value) { int factorSum = 1; // current sum of factors // loop through possible factor values for (int i = 2; i <= value / 2; ++i) { // if i is factor if (value % i == 0) { factorSum += i; // add to sum } } // return true if value is equal to sum of factors if (factorSum == value) { return…C++ program Write a function named "reduce" that takes two positive integer arguments (as reference), call them "num" and "denom", treats them as the numerator and denominator of a fraction, and reduces the fraction.The function should return the value 0 (to indicate failure to reduce: if either of the two arguments is zero) and should return the value 1 otherwise.Function Prototype: bool reduce(int & num,int & denom);