17. Consider the following "C" code segment. At least how many test cases are needed for achieving decision coverage for the given C code? int main (){ inta,b=0; scanf("%d",&a); if( a < 10 || a>100) b=b+10; if( a == 20 ) b=b+20; else b++; if( a == 30 )
Q: Design the test case for boundary value analysis of the following consider a program that prompts…
A: /****************************************************************************** Welcome to GDB…
Q: Suppose you designed a TAXI FARE SYSTEM and you want to evaluate the fare in according to the…
A: Code: #include <iostream> using namespace std; int main(){int distance;float…
Q: Write C++ program that accepts coefficients of a quadratic equation from the user and displays the…
A: #include <iostream>#include <cmath>using namespace std;int main() { float a, b, c,…
Q: write a c++ program that has the following function output (): A void computes and prints the…
A: I have provided solution in step2
Q: Write an assignment statement that might be used to implement the equation below: (use the pow(a,b)…
A: y = 4x⁴+ 2x² + 1 Here we need to function like pow(a, b) which means ab
Q: From the function x > 0 and y > 0) x + y x + y x2 0 and y < 0 x² + y x<0 and y 2 0 x² + y? x< 0 and…
A: Algorithm : Step 1 : ask for the value of x from user. Step 2 : ask for the value of y from user.…
Q: Define function print_popcorn_time() with parameter bag_ounces. If bag_ounces is less than 3, print…
A: Given A test program and we have to complete the print_popcorn_time() function. """............""""…
Q: Create a C+ Program that will identify the Discount Rate of a shopper based on issued loyalty card,…
A: /* Program that will identify the Discount Rate of a shopper based on issued loyalty card */…
Q: A company measures employees efficiency to complete a particular job as follows: Time taken by…
A: Here I written C program as per problem, I hope you like it.
Q: Write a C program that includes the definitions of the following functions: a) area_rectangle(.) :…
A: The Above Conditions are implemented in C Program: SOURCE CODE #include <stdio.h> int…
Q: 2. Write a C program to find the eligibility of admission for a professional course based on the…
A: C Program for above : #include <stdio.h> #include <stdbool.h> int main() { //get…
Q: Define function print_popcorn_time() with parameter bag_ounces. If bag_ounces is less than 3, print…
A: Herecour task is to write a python program for the task mentioned in the question. Let's prepare the…
Q: In c++ A driver needs help finding the shortest path travelling between a number of points. There…
A: Below is the code: apply krushkal algo on graph of each point to each point
Q: use short-circuit evaluation to determine whether the following two compound conditions are TRUE or…
A: Formula used: a == b, if both a and b are equal, then “Yes” otherwise “No” a != b, if a and b are…
Q: Write a program (using c++ language) that has a class triangle with an overloaded function Area().…
A: Triangle.cs class Triangle:Shape public double S3 set }public override double…
Q: Write a C++ program that computes and returns: • the smallest positive integer (n) for which…
A: The instructions are provided by the programmer according to the requirement using the programming…
Q: Write a complete C++ program that can accept the name, quiz1, quiz2, assignment, test and final exam…
A: #include<bits/stdc++.h> using namespace std; int main(){ int quiz1[10]; int quiz2[10]; int…
Q: 39. Write a program for the following problem. An instructor needs a program that accepts a student…
A: Given : semester average grade 90 -100 A 80-89 B 70-79…
Q: Write an OOP in C++ that awards students grades based on the following guidelines; A=70-100;…
A: #include <iostream> using namespace std; int main(){ float marks; cout<<"Enter the…
Q: Problem 5, Learn by Example. Write one program that correctly solves all of the problem instances.…
A: - We need to solve the problem using 5 variables and print in the order shown. - The order in which…
Q: Define a function calc_pyramid_volume with parameters base_length, base_width, and pyramid_height,…
A: given formulas to implement in program, define function base_area=base_length*base_width…
Q: CHALLENGE 2.1.1: Reading multiple data types. ACTIVITY Type two statements. The first reads user…
A: 1) Take input into variable using input() function 2)default input() function takes input as string…
Q: Example 1: Write a C++ program to read student's mark and print "passed" if it is greater than 50.…
A: #include<iostream>using namespace std;int main(){ int mark; cout<<"Enter student's mark:…
Q: Use C++: Develop a Tic Tac Toe game that will match a player against the computer. Do’s: Use a…
A: As per question we use only Program must use: functions loops branching string functions
Q: rite a C program that shows the function of an atm machine. First ask user to select language, enter…
A: the code is given below : //header file #include <stdio.h> #include <conio.h> #include…
Q: Admission requirements BSIT Track STEM, TECHVOC SHSAve at least 85 BSP…
A: Solution of Question A: Programming language used: C++ Program code: (Note: all necessary comments…
Q: A person X wants to distribute the property share to his children and the wife. Write a C+ program…
A: We need to take input from a user of the below things - total property worth in PKR number of sons…
Q: Complete code and output screenshot have to give. Else i will downvote. In this problem…
A: Here have to determine about c++ programming language code for Hidden Fortress problem statement.
Q: An application takes two inputs x and y where x<=y and -5<=y<=4. Write the test cases for…
A: An application takes two inputs x and y where x<=y and -5<=y<=4. 1.) Write the test cases…
Q: Problem Statement Consider two locations, an origin and a destination, on the globe identified by…
A: #include<stdio.h>#include<math.h> //main methodint main(){double…
Q: write program in c language Write a function qualityPoints that inputs a student’s average and…
A: PROGRAM CODE: #include <stdio.h>int qualityPoints(int avg){if(avg>=90 &&…
Q: INSTRUCTIONS: Write a C++ script/code to do the given problems. MOVIE PROBLEM: Write a function that…
A: Below is the C++ program: - Approach: - Import the header file and using the namespace. Define the…
Q: Problem 4 Implement a small C program for the Omani Tesla cars customers. The program will be based…
A: Algorithm: Start Display the given menu to the user Ask the user to choose the tesla model Based on…
Q: Submission • Your program in C++. • Paste three test cases at the end of your program (put them in…
A: let us see the answer:- Introduction:- To create all balanced bracket subsequence sequences with n…
Q: Write a function qualityPoints that inputs a student’s average and returns 4 if a student's average…
A: #include <stdio.h>//function to take student average//and returns qualityPoints based on…
Q: Translate the following function definition into clause form: z w = if null w then 1.0 else if head…
A: Clausal form is a subset of first order logic.
Q: CHALLENGE ACTIVITY 6.7.2: Function with branch: Popcorn. Define function print_popcorn_time() with…
A: 1)declare function using def keyword 2)use if else ladder to print the output based on user input…
Q: A business law class of 25 students takes a midterm exam that has 100 true- or-false questions. The…
A: We need four arrays in this problem. The array KOUNT stores the number of times a grade is achieved…
Q: A departmental store request to you to automate their cash counter. According to his requirements,…
A: Read the amount that need to paid and then the amount that is given to the cashier. Then subtract…
Q: Write a C# program that accept a student biodata; names, age, sex and address And also 1.…
A: /******************************************************************************…
Q: Develop a Tic Tac Toe game that will match a player against the computer.
A: #include <iostream>#include <string>#include <time.h>#include <random>using…
Q: An Auto Insurance Program Example - Write a C++ program to determine the cost of an…
A: PROGRAM: //Header File #include <iostream> using namespace std; //Defining main int main() {…
Q: Write a C++ program that would solve the problem below (you must use variable declaration and…
A: The area of upper part is l*w The remaining area is l*w+2*w*h+2*h*l
Q: Write a program that simulates a coin-tossing game. At the beginning of the game, each of N players…
A: please cheek next steps for code and output
Q: A person X wants to distribute the property share to his children and the wife. Write a C++ program…
A: #include <iostream>using namespace std; int main() { float…
Q: 3. Write a C program to accept a discount percentage on mobile prices between 0 to 100 from the user…
A: Introduction: In this question, we are asked to write a C program to calculate the average discount…
Q: Use DEV-C++ to develop a well-documented C++ program that: 1) Prompts the user to enter from the…
A: Code: #include <iostream>using namespace std;int main() { int n; //Iterating through the…
Q: Consider a 2D grid of size 4 x 5, where each cell contains a cost. A game character has to get from…
A: Here we need to develop a code for the above program where we will have the function called…
Q: Using C#, write a program that takes a decimal value between 1 and 10 and displays its equivalent…
A: This can be done using basic condition check and here we provided solution using switch statements
Q: Write a program that will calculate and print bills for the city power company. The rates vary…
A: The C++ program with the given description will be created as follows: Declare int variables for ID…
Step by step
Solved in 2 steps
- Q2/ Write c# function of this following int min ; x = 4; float z = 1; long y = 1; int a = {1,3,9, 10, 12, -9,83 ; - MinMax (a, out m, outh); Sum = (x₁n, ref zi double P-89r (x, a) m=minimum value n = maximum value Z=1+ X ²4 + 2! 4! + 6 X² X + 61 2nt return the sum of square of a's element fact (ref y,x); int d = abs(x)? x = -X d = |x| Console.Write ("{0}: {1}: {2}={3}: {4}", py, d, m, n); y=x! using recursion principlec++ PLEASE TRACE THE FUNCTION Given the code:void d(int n) { if(n<2) { cout << n << " "; return; } cout << n << " "; d(n/3);} 1. Trace the function when n is 12.1. void Foo(int A[]) { 2. let c = A.size(); 3. for (i = 1 to c^2) { 4. Boo(i); 5. 6. j = c; 7. while (j> 1) { 8. } //end for print "hello"; 9. j=j/y; 10. }//end while 11.} If we are given that is a function whose asymptotic runtime is cubic in the input i.e. . What is the asymptotic run time of Воо Boo(n) = O(n³) Foo
- 2.a Σ : {c,A,G,T}, L = { w : w = CAG™T™C, m = j + n }. For example, CAGTTC E L; CTAGTC ¢ L because the symbols are not in the order specified by the characteristic function; CAGTT ¢ L because it does not end with c; and CAGGTTC € L because the number of T's do not equal the number of A's plus the number of G's. Prove that L¢ RLs using the RL pumping theorem.In C++: Examine the code segment. What will be printed? If there are any errors indicate the nature of each error. int a[7] = {31, 12, 32, 14, 25, 16, 27}; int *ptr; ptr = & a[2]; for ( i=1; i<=5; i=i+2) cout << *(ptr +i); cout << a[0] << *ptr << *ptr - 2 << *(ptr -1)) << endl;1- What is the ouput of the following C code segment? void * T( void* me) { int s=03; for (int k=1; k<=me; k++) S = s +k; printf("%d",s); main() { pthread_t tids[4]; for ( int i=1; i<=4;i++) pthread_create(&tids[i],NULL,T,void* i ); a) 11 11 b) 23 4 5 in any order 13 6 10 in any order d) O 1 2 3 4 in any order Boş bırak
- [Unbalanced Rod] Given a set of n weights {w₁,..., wn} and a rod of length n - 1 inches, we can attach the weights to the rod at hooks placed at one inch distances apart as shown in the figure below. -1". /10 2 3 12 2 4 We can attach a weight to any hook but no two weights can be attached to the same hook and we have to attach all the weights. For any given assignment of weights to hooks, we can compute the location of the center of mass of the rod and the weights according to the following equation (neglecting the weights of the rod and the hooks). where 0 ≤ Pi≤n-1 is the position of weight along the rod. For example, in the figure shown above, the center of mass is computed as C= C = i Wi Pi Σi Wi 10 0+2 1+3·2+4·3+12.4 +2.5 10+2+3+4+12+2 78 33 The problem is to find an assignment of weights to hooks that makes the center of mass as far as possible to the left, i.e., minimize the value of c. Answer the following questions. 1. Describe a greedy algorithm that finds the assignments that…int p =5 , q =6; void foo ( int b , int c ) { b = 2 * c ; p = p + c ; c = 1 + p ; q = q * 2; print ( b + c ); } main () { foo (p , q ); print p , q ; } Explain and print the output of the above code when the parameters to the foo function are passed by value. Explain and print the output of the above code when the parameters to the foo function are passed by reference. Explain and print the output of the above code when the parameters to the foo function are passed by value result. Explain and print the output of the above code when the parameters to the foo function are passed by name.Consider the following segment of code:procedure Mvar x: integer;procedure A (c: integer)var a, b: integer;procedure Bvar b, c, d: integer;begin {B}….a := c – d;….end B;begin {A}….x := b + c;….B()….end A;begin {M}….A(3)….end M;Assuming the definition of M is at static nesting level 0. Draw the runtime stack that will be ineffect at the execution of “a := c – d;”. Show the static and dynamic links, and the currentpositions of the EP and SP pointers.What is the static distance to x’s environment of definition and the offset within the environmentwhen “a := c – d;” is executed?
- Consider the following function main:Int main(){int inStock[10][4];int alpha [20];int beta[20];int gamma[4]= {11,13,15,17};int delta [10] = {3,5,2,6,10,9,7,11,1,8};} a) Write the definition of the function setZero that initializes any one-dimentional array of type int to 0.b) Write the definition of the function inputArray that prompts the user to input 20 numbers and stores the numbers into alpha.c) Write the definition of the function doubleArray that initializes the elements of beta to two times the corresponding elements of alpha. Make sure that you prevent the function from modifying the elements of alpha.d) Write the definition of the function copyGamma that sets the elements of the first row of inStock to gamma and the remaining rows of inStock to three times the previous row of inStock. Make sure that you prevent the function from modifying the elements of gamma.e) Write the definitions of the function copyAlphaBeta that stores alpha into the first five rows of inStock and beta…computer science | c++ code | it's not graded. Correct answer will upvoted else downvoted. It is given a non-negative integer x, the decimal portrayal of which contains n digits. You need to shading every its digit in red or dark, so the number shaped by the red digits is separable by A, and the number framed by the dark digits is detachable by B. No less than one digit should be shaded in every one of two tones. Consider, the include of digits hued in red is r and the include of digits hued in dark is b. Among all potential colorings of the given number x, you need to output any to such an extent that the worth of |r−b| is the base conceivable. Note that the number x and the numbers shaped by digits of each tone, may contain driving zeros. Input :The principal line contains one integer t (1≤t≤10) — the number of experiments. Then, at that point, t experiments follow. Each experiment comprises of two lines. The main line contains three integers n, A, B (2≤n≤40, 1≤A,B≤40).…Consider the following code (with line numbers): 1 typedef struct_lock_t (int flag; } lock_t; 2 4 6 7 30 11 15 void init (lock_t *mutex) { } // 0-> lock is available, 1 -> held mutex->flag = 0; void lock (lock_t *mutex) ( while (mutex->flag == 1) // TEST the flag ; // spin-wait (do nothing) mutex-> flag = 1; } void unlock (lock_t *mutex) { mutex->flag = 0; // now SET it! This code is defective in that it allows two threads to enter a critical section at the same time. Please give me a sequence of operations where this might occur.