Compute the following and give the result in the space provided below: Consider the following variable declaration
Q: Please fill in the blanks for the following statements: To input a string variable that contains…
A: Actually, we can use string with white spaces by using "scanf %s" function... Which reads the string…
Q: Write two different techniques to declare and initialize a variable with an example
A: In many programming languages such as C, C++, or Java, it is mandatory to declare a variable before…
Q: What are the memory sections for variables in the following code: int *x=new int;…
A: The question is: finding the memory sections for variables in the given code.
Q: 3. Convert the following NFA to a regular expression using the procedure described in class.
A:
Q: Q2: b- write a program using a function to calculate and return the volume and surface area of a…
A: In C++ language the question is solved given below: we provide a source code, code screenshot, and…
Q: Analyze the following code and choose the correct statement(s) about the following code (Choose all…
A: The this keyword refers to the current object in a method constructor. The most common use of the…
Q: Rewrite the following statements using combined assignment operators: count = count + 1;
A: The given statement is count = count + 1; In this statement, The addition of the 1 and the…
Q: What are the values of the following expressions? In each line, assume that
A: A program that contains all the given expressions is as follows, class Sample{ public static…
Q: Declaration of this function int myfunction(int x,y){ return(x*y);} ● False O True
A: Answer is given below .
Q: ) Declare the integer variable z with value 10 without using assignment('=) operator.
A: = is called as assignment operator as it assigns value present at right side to variable at left…
Q: Show the printout of the following statements:print(format("Programming is fun",…
A: Given: Show the printout of the following statements:print(format("Programming is fun",…
Q: Take a float input from the user and type cast it to int and print it on the screen
A: This problem is solved by the C programming language where it is required to take a decimal point…
Q: (b) Given a and b are int variables and c is a double variable. The initial value for a, b, and c…
A: Postfix Operator: value of the variable is first used the expression and its incremented by 1. Since…
Q: Complete the function given below which takes an integer parameter which is the age of a person and…
A: Start Input age Call function Print result Stop
Q: Indicate whether the following statement is true or false. * -
A: Lets see the solution.
Q: Evaluate the following expressions and determine the value of all variables, based on the above…
A: The given expressions and the value of allvariables
Q: (i) val --h % k++ * 2;
A: value of h=2 k =4 public class Main{ public static void main(String[] args) { int h =2; int…
Q: Swap the contents of the int variables x and y.
A: Since you have not specified the programming language in the question, so we have solved this…
Q: Given the following functions: void increment(int x, int y) { X+=y; } int main() { int n=10, amount…
A: Given:
Q: What does the following declaration mean? int (*ptr)[10];
A: Required: programming
Q: What will be the output of the below program:
A: Output of the above code is in step2.
Q: Swap two numbers using functions.(no return value, with arguments passed)
A: Given: Swap two numbers using functions. (no return value, with arguments passed)
Q: 3. Write definitions for these functions: sphereArea (radius) Returns the surface area of a sphere…
A: The volume of the sphere of radius r : 43πr3 The surface area of the sphere of radius r : 4πr2
Q: Where is the void function for circumference
A: We need to write the void function for circumference. In Python, all functions return value whether…
Q: Suppose that x and y are of type int, z is of type double, and ch is of type char. Consider the…
A: Since x and y are integer type, ch is of type char and z is of type double. Sequence of reading the…
Q: Compute the following and give the result in the space provided below: Consider the following…
A: Please find the answer below :
Q: What is the value stored at variable "x" after executing the following code segment
A: Please find the answer below :
Q: Consider the quadratic equation: . Given a, b and c as input, determine whether the roots of this…
A: NOTE - I have used the Python programming language. Here I have taken input from the user and then…
Q: ase write the following Co
A: Approach: The total number of ways to choose 3 balls will be that for every ball we have a total of…
Q: Write two different techniques to declare and initialize a variable with an example.
A: Variables are used to store information to be referenced and manipulated in a computer program. x,y…
Q: Q2: Write an Algorithm to evaluate the following equations:
A: In the algorithm, one is main function and the other two functions are sumOfSeries and fact.…
Q: Fill in each blank with the negation of each statement on the left. [(x)b ^ (x)d] xE Vx [p(x)^¬q(x)]…
A:
Q: Find the errors in the following program: void sum(int x1, x2, x3)
A: subject : C++ Programming Find the error in the following program void sum(int x1,x2,x3) {…
Q: Q4. Write a python function that takes diameter and returns area and length of circle.
A: Q4. Area of a Circle Formula A = ((1/4) * pi * d2 ) Length of Circle C = pi * d
Q: Print the odd numbers between (100,200) using function void odd (int).
A: Here, Code instruction is given to print odd numbers between 100 and 200.
Q: Explain what the regular expression parses for in the following code: float(re.sub(r'[^\w\s.]', '',…
A: Regular expressions are patterns used to match character combinations in strings. In JavaScript,…
Q: Q16: Rewrite the equivalent statements for the following examples, and find it results. Assume: X=2,…
A: x+=5 ========== x=x+5 ================== x=2+5 => x=7 y-=8 ========== y=y-8…
Q: 2. Create a program that will display the area of the following using functions: a. triangle b.…
A: #include<iostream>using namespace std;//function prototypefloat getSquarearea(float…
Q: Compute the following and give the result in the space provided below: Consider the following…
A: Given int m=8, n, r=4, p;double q;n= r * (r / m) < m;p= r < m/2 && r / r >= m || (q…
Q: Compute the following and give the result in the space provided below: Consider the following…
A: DES is a block cipher, and encrypts data in blocks of size of 64 bit each, means 64 bits of plain…
Q: Rewrite Listing 2.9, ComputeDistance.py, using the following function for computing the distance…
A: Given: Rewrite Listing 2.9, ComputeDistance.py, using the following function for computing the…
Q: Declaration of this function int myfunction(int x,y){ return(x*y);} O True O False
A: A function is set of instructions or statements to be executed that aims at performing a specific…
Q: Which of the following statements is correct to compute the following mathematical equation? *
A: Required: What is the solution of this problem?
Step by step
Solved in 3 steps with 1 images
- When you use a mortgage to purchase a home, the lending institution effectively owns the home. You buy back part ownership in the home with each monthly payment. The part you have bought back is your equity in the home. If the mortgage amount is P dollars, the monthly interest rate is r as a decimal, and the term of the mortgage is t months, then your equity after k payments is E(k) = P((1 + r)k − 1) (1 + r)t − 1 dollars. In this exercise, assume that the mortgage amount is $200,000, the APR is 6% so r = .06/12 and the term of the loan is 30 years (360 months). (a) Find a formula for the equity. (b) Make a graph of the equity over 360 months, the term of the loan. (c) Does the graph show that you have half-ownership in the home halfway through the term of the mortgage? Halfway through the term of the mortgage corresponds to k1 = _______ payments. From the graph, we see that E(k1) is ________ half of the mortgage amount, so we _______ have half-ownership in the home…What is the best statement about the following function, f1? void f1 (int i) { int j; for (j = 0; j < i; ++j); cout << ‘*’; cout << endl; } Group of answer choices The f1 function prints a star. The f1 function prints a start on the ith line. The f1 function prints a line of i-1 stars. The f1 function prints a start on each of the i lines. The f1 function prints a start on each of the i-1 lines.Consider the following declarations. int sum1, sum2; float number; double total; Initially the values of the variables are as follows: sum1 = 10 number = 2.5f sum2 = 20 total = 10.25d consider only the effect of each statement on the initial values specified above. By state which is invalid and not valid? a) number = sum1; ............ b) sum2 = (int) total; ............ c) number = sum1 / sum2; ............ d) sum1 = number * 4; ............ e) total = number; ............ f) number = sum2 % 2; ............ g) sum1 = (int) (sum2 / 3.0f); ............ h) number = (float) sum1 + 2.0; ............
- Assume that a, b, c are numbers.Return 'increasing' if they are in increasing order, 'decreasing' if they are in decreasing order, 'both' if they are both increasing and decreasing, and 'neither' otherwise.Here, 'increasing' means that each value is at least as largeas its predecessor. Similarly for decreasing.The sequence 3, 4, 4 is increasing. whereasthe sequence 4, 4, 4 is both increasing and decreasing.For example,lenient(3, 4, 5) returns 'increasing'lenient(3, 4, 4) returns 'increasing'lenient(4, 4, 4) returns 'both'lenient(4, 3, 2) returns 'decreasing'lenient(4, 3, 3) returns 'decreasing'lenient(4, 2, 3) returns 'neither'Write a program that calculates the Euclidean distance and the Manhattan or taxicabdistance between two two-dimensional points. Make sure you 1) use a point structureto store the points (see above), 2) use functions to calculate the two distances and3) ask the user for the point data. The Euclidean distance is calculated using thePythagorean Theorem for (points (x1,y1),and (x2, y2):euclidean = ( x1-x2)^2 + ( y1-y2)^2And the Manhattan distance is calculated as:manhattan = | x1-x2 | + | y1-y2 |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.
- Write a program in python that prints a pyramid made of letters in the middle of the screen. Use functions with parameters for this assignment. The base width of the pyramid is determined by a character the user enters. If the user enters the letter o, the following pyramid will be printed. It can be assumed that the screen width is 80 characters. a aba abcba abcdcba abcdedcba abcdefedcba abcdefgfedcba abcdefghgfedcba…def parrot(voltage, state="a stiff", action="voom", p_type="Norwegian Blue"): print("-- This parrot wouldn't", action, end=" ") print("if you put", voltage, "volts through it.") print("-- Lovely plumage, the", p_type) print("-- It's", state, "!") parrot(100, action="vroom") #6 Q4.1 Default Values Which of the parameters use their default values in the function call on line 6. parrot(100, action="vroom") #6 Choice 1 of 4:state Choice 2 of 4:voltage Choice 3 of 4:p_type Choice 4 of 4:action Select all of the ways that the parameter action can be assigned a value. Choice 1 of 3:positional argument Choice 2 of 3:keyword argument Choice 3 of 3:default value Q4.3 Call the Function Call the function such that voltage is a positional argument, state is a keyword argument, p_type is a keyword argument, and action is a default argument. (voltage, state="a stiff", action="voom", p_type="Norwegian Blue")Write assignment statements for the following: Assign a value of 1 to between if n is in the range -k through +k, inclusive; otherwise assign a value of 0 Assign a value of 1 to uppercase if ch is an uppercase letter; otherwise, assign a value of 0. Assign a value of 1 to divisor if m is a divisor of n; otherwise, assign a value of 0.
- Consider the following function: int mystery(int x, int y, int z) { if (x <= y && x <= z && x != 0) return (y + z) / x; else if (y <= z && y <= x && y != 0) return (z + x) / y; else if (z <= x && z <= y && z != 0) return (x + y) / z; else return x + y + z; } What is the output of the following C++ statements? i.cout << mystery(1, 0, 0) << endl; ii.cout << mystery(10, 10, 10) << endl;int const MULTIPLIER = 5; is a valid way to declare a constant integer variable. Group of answer choices True False ------- Given the following code segment, what is output to the screen? int num1 = 6; int num2 = 4 * num1++; cout << "num1=" << num1 << " num2=" << num2; Group of answer choices num1=7 num2=24 num1=6 num2=24 num1=6 num2=28 Nothing, because the code does not compile.solve all the program in java 1. Write a Java program to print 'Hello' on screen and then print your name on a separateline.Expected Output:HelloDonald Trump2. A school has following rules for grading system:a. Below 25 - Fb. 25 to 45 - Ec. 45 to 50 - Dd. 50 to 60 - Ce. 60 to 80 - Bf. Above 80 - AAsk user to enter marks and print the corresponding grade.3. Create a function that takes two numbers as arguments and returns the GCD of the twonumbers.Examplesgcd(3, 5) ➞ 1gcd(14, 28) ➞ 14gcd(4, 18) ➞ 24. Given an integer, create a function that returns the next prime. If the number is prime,return the number itself.ExamplesnextPrime(12) ➞ 13nextPrime(24) ➞ 29nextPrime(11) ➞ 11// 11 is a prime, so we return the number itself.5. Write a Java program that takes two numbers as input and display the product of twonumbers.Test Data:Input first number: 25Input second number: 5Expected Output:25 x 5 = 125 6. Write a Java program to print the sum (addition), multiply, subtract, divide and…