d. Given that an int variable s has been initialized, write a statement(s) that declares a new variable and assign it the remainder of 9 times 8 less than s divided by 4. e. Write a statement(s) that initializes the variables named a, b, c and d to false, ''one'', 'y' and 87.9 respectively
Q: 4. Assume X and Y are initialized variables of type double. Write the lines necessary to print…
A: 1) initialize two values x and y with double values. 2)check whether they two agree with seven…
Q: If you have the following statements: int a=2, b=3, c=4; double z=4.5, w=6.7; const float f=8.9; The…
A: Here variable a and b are of integer datatype whose initial value are 2 and 3. Datatype of variable…
Q: Q3: The volume of a circular cylinder V=rtr?h, write a program to compute the volume if r=8m and…
A: Objective: This program designs a class to create cylinders for a given height and radius. The…
Q: 2. For Questions 2 (a-c), refer to the declarations and initializations below. Indicate whether each…
A: Answer: As the given code snippet is in C language. In the given code snippet a double array is…
Q: (b) Evaluate the following expressions and determine the value of all variables, based on the above…
A: Given, int val, h=90, i=8, j=25, j=7; should find values of, i) val = --h % k++ * 2; ii) val = (93+…
Q: Q1: (A) State if each of the following statements is true or false. Give explanations for
A: Given:
Q: For each of the following variable definitions, determine whether the statement is valid or invalid.…
A: int ivar; // It will declares an integer variable ivar.int *iptr = &ivar; //This step will…
Q: For each of the following variable definitions, determine whether the statementis valid or invalid.…
A: Given: For each of the following variable definitions, determine whether the statementis valid or…
Q: Suppose a, b, and sum are int variables and c is a float variable. What value is assigned to each…
A: b+=c*a ; b = b + c*a = 4 + 3.8*9 = 4 + 34.2 = 38.2 So value of b= 38 Thus a = 9, b= 38, c=3.8 sum=17…
Q: 1.Given the following declarations, evaluate the expression below and assign true or false value for…
A: In step 2 I am giving the Source code in C language, as there is no particular language mentioned…
Q: The following statement should determine if x is not greater than 20. What is wrong with it?
A: Answer: Given statement error is highlighted with red font if (!x>20)
Q: Given the following function prototype: int test (float, char); which of the following statements is…
A: C. int u = test(5.0 , ' * ')
Q: Find the values of a and b after the following C++ statements: int a = x; a += 5; a += 6; int b =…
A: Given statements: int a = x;a += 5;a += 6;int b = y;b -= 6;b -= 5;
Q: 1. Ifu= 4, v = 5, w = 6, x = 8, and y = 12, what is the value of each of the following expressions,…
A: a) u / y % v + w * x --> 4/12 % 5 + 6*8 --> 0%5 + 48 --> 0+48 --> 48 So the value of…
Q: After following statements have executed, find the value of the variable a. int a=5; while (a<=12)…
A: Please find the answer below :
Q: Q2/ If money is left in a particular bank for more than 5 years, the bank pays interest at a rate of…
A: CODE:- #include <iostream>using namespace std;void check(int numYears){ if (numYears >…
Q: Suppose that x, y, z, and w are int variables and x= 3, y = 4, z = 7, and w = 1. What is the output…
A: == operator returns true if both operands are same != operator returns true if both operands are not…
Q: Assume you have three int variables: x = 2, y = 6, and z. Choose the value of z in the following…
A: x=2, y=6 The given is a ternary operator. (Condition)? Case1 : case2 If condition is evaluated to…
Q: 10. What is the output of the following statement? int x=3; cout<<(++x* 2) <<"\"; cout<<(x--);
A: I will show output of this program.
Q: Suppose that x, y, z, and w are int variables and x = 25, y = 3, z = 12, and w = 4. What is the…
A: Given x = 25,y = 3, z = 12 and w = 4 because option a is not given in question let we start solving…
Q: After following statements have executed, find the value of the variable a. int a=2 while (a<=25)…
A: Execution:initially a=2iteration:1a<=25 : 2<=25 //condition satisfieda=a*a = 2*2 = 4now, a is…
Q: Q3/ Choose True or False 1. The output of this program is 20? a) True int main(){ b) False int a; a…
A: Note - As per the guidelines we are only allowed to answer 1 question with 3 sub-parts at a time.…
Q: QUESTION 18 To assign a double variable d to an int variable x, you write X = d; X = (int)d; x =…
A: The downgradation of a datatype to it's lower datatype is done automatically by the compiler.
Q: e) In the statement cin >> y; y can only be an int or a double variable. O True False
A: False.
Q: If you have the following statements: int a=2, b=3, c=4; double z=4.5, w=6.7; const float f=8.9;…
A: correct coding with Statement #include <iostream>using namespace std;int main(){ int a =…
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: After following statements have executed, find the value of the variable a. int a=2, i=0; while…
A: Here we are given with a = 2 and i = 0 Now we have a while loop whose condition is true till the…
Q: * What will be the contents of the variable x after the following statement is executed? x =…
A: Answer in step 2
Q: (b) Evaluate the following expressions and determine the value of all variables, based on the above…
A: #SOLUTION: ( i ) expression -> --h % k++ * 2 initially h=90 and k=7 . Now solving the…
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: Q1. Write a program in which the output of the program should be the performance result of a student…
A: Program description: n is the user input integer variable that is used to take from the user the…
Q: Compute the following and give the result in the space provided below: Consider the following…
A: Please find the answer below :
Q: Suppose x, y and z are int variables and x = 18, y = 5, and z =4. What is the output of each other…
A: Here, I have to provide a solution to the above question.
Q: a) Suppose a = 5. After the statement ++a; executes, the value of a is?
A: a) if a=5 then after execution of ++a value of a will be 6. ++a is called pre- incrementation, and…
Q: Suppose n1 and n2 are two int variables that have been given values. Write anif-else statement that…
A: here in this question we have two variable and we have asked to write if else statement it outputs…
Q: 2. Write the statements to sum the odd integers between 1 and 99 by using a for statement. Assume…
A: Here we have written a c program to print the sum of the odd integers between 1 and 99 using for…
Q: Suppose x, y, and z are int variables and x=2, y=5, and z=6. What is the output of each of the…
A: The problem is based on arithmetic calculations and basic input operations in C++.
Q: After following statements have executed, find the value of the variable a. int a=5; while (a<20)…
A: Code With Explanation: #include <iostream>using namespace std; int main() { int…
Q: Assume that a bool variable workedOvertime has been declared, and that an int variable hoursWorked…
A: 1. Take the variable WorkedOvertime as bool. bool means it return either 0 or 1, it return 1 if it…
Q: Evaluate the following expressions, assume the following declaration: int x = 4; What is displayed…
A: The programming languages C, C++, Java supports increment(++) and decrement(--) operators. These…
Q: Suppose a = 5. After the statement ++a; executes, the value of a is?
A: The answer is given in step 2.
Q: Write C++ statements that accomplish the following. (6, 7)a. Declare int variables x and y.…
A: Required : C++ statements for given
Q: Write C++ statement(s) that accomplish the following: Declare int variables x and y. Initialize x to…
A: Given:
Q: Suppose x, y, and z are int variables and x = 18, y = 5, and z = 4. What is the output of each of…
A: Given, cout << "x = " << x << ", y = " << y << ", z = " << z…
Q: If you have the following statements: int i=12, j=4; while (i>=1)
A: Lets see the solution.
Q: After following statements have executed, find the value of the variable a. int a=15; while (a>0)…
A: Answer: 0 Explanation: While loop: It is an entry control loop that checks the condition while…
Q: 3. (5 points) Suppose P(x,y) means "x * y = y * x", where x and y are real numbers. Determine the…
A: A truth value for a statement is used to show truth or falsity of a statement. The truth value of a…
d. Given that an int variable s has been initialized, write a statement(s) that declares a new variable and
assign it the remainder of 9 times 8 less than s divided by 4.
e. Write a statement(s) that initializes the variables named a, b, c and d to false, ''one'', 'y' and 87.9
respectively
Step by step
Solved in 2 steps with 1 images
- 1: If the variable divisor is not zero, divide the variable dividend by the divisor, and store theresult in quotient. If divisor is zero, assign it to quotient. Then print all the variables. [ Assumethat divisor and dividend are integers and quotient is a double ]4. During each summer, John and Jessica grow vegetables in their backyard and buy seeds and fertilizer from a local nursery. The nursery carries different types of vegetable fertilizers in various bag sizes. When buying a particular fertilizer, they want to know the price of the fertilizer per pound and the cost of fertilizing per square foot. The following program prompts the user to enter the size of the fertilizer bag, in pounds, the cost of the bag, and the area, in square feet, that can be covered by the bag. The program should output the desired result. However, the program contains logic errors. Find and correct the logic errors so that the program works properly. // Logic errors. #include #include using namespace std; int main() { double costs double area; double bagsize; cout > bagsize; cout > cost; cout > area; cout << endl; cout << "The cost of the fertilizer per pound is: $" << bagsize / cost << endl; cout << "The cost of fertilizing per square foot is: $" << area / cost << endl; return 0; }Question # 5: Senior salesperson and junior salesperson are paid per a week. Write a program that accepts as input a salesperson’s position in the character variable and no. of week he did hard work. If value is ‘S’ or ‘s’, the senior person’s salary should be computed and displayed, if value is ‘J’ or ‘j’, the junior person’s salary should be calculated and displayed, otherwise display an error message. (Marks = 10) No. of Weeks Junior Salesperson;s Salary per week Senior Sales Person;s Salary per week < = 4 1500 2000 < = 8 1750 2500 > 8 2000 2750
- x = 9 ; y = x++ What are the values of x and y after the two statements execute? X = y =Declare int variables x and y. Initialize x to 25 and y to 18.Given the following code. int v = 7; void func0 static int w = 3; int main0 int k = 0; func): Which of the following statement is correct? Select one: O a. v is a static local variable, w is a global variable, k is a local variable. O b. v is a global variable, w is a static local variable, k is a local variable. O c.v is a local variable, w is a local variable, k is a O d. v is a global variable, w is a local variable, k is a static local variable. global variable.
- 27. If originally x=4, what is the value of x after the evaluation of the expression: x*=2Let s1 be " Welcome " and s2 be " welcome ". Write the code for the following statements:a. Check whether s1 is equal to s2 and assign the result to a Boolean variable isEqual.b. Check whether s1 is equal to s2, ignoring case, and assign the result to a Boolean variable isEqual.c. Compare s1 with s2 and assign the result to an int variable x.d. Compare s1 with s2, ignoring case, and assign the result to an int variable x.e. Check whether s1 has the prefix AAA and assign the result to a Boolean variable b.f. Check whether s1 has the suffix AAA and assign the result to a Boolean variable b.g. Assign the length of s1 to an int variable x.h. Assign the first character of s1 to a char variable x.i. Create a new string s3 that combines s1 with s2.j. Create a substring of s1 starting from index 1.k. Create a substring of s1 from index 1 to index 4.l. Create a new string s3 that converts s1 to lowercase.m. Create a new string s3 that converts s1 to uppercase.n. Create a new string s3 that…1. Write a program that prompts the user to enter an integer between 0 and 6 and prints thie day name of the week (Sunday is 0, Monday is 1,..., and Saturday is 6). 2. Write a program that prompts the user to enter an integer and tests if it is divisible by 5 and 3, or if its divisible by 5 or 3 or if its divisible by 5 or 3 but not both.
- Which of the following statements is true about the use of Boolean expressions? Select one: a. They cannot contain two not operators because they cancel each other out. b. The must contain at least one and operator. c. They can help simplify selection structures. d. The can only be used in single selection statements.Assume a and b are int variables. Give the logical opposites of each of the following expressions; that is, give an expression that is False exactly when the given expression is True and vice versa. You may NOT use the not operator - but you can use or and/or and. 1. a!= b 2. a > b 3. a >= 47 and day != 3 4. a == 47 or day == 3IZVO @ ۲:۱۰ م 50 EETE2102-Electronics-... :puäillu | E هل تريد الانضمام إلى هذا الجهاز؟ الانضمام Moodle Write a program in C that accepts: 1. the radius of a sphere in a variable say radius, 2. The choice (in a character variable choice) .If the choice is a, area of sphere should be found else the volume of the sphere should be found. area of a sphere is given by the formula: area=4 x TT x radius? and the volume of the sphere is given by the formula: volume=4/3 x radius3 Note: Create/Use appropriate header files, constants and functions Sample Output 1: Enter the radius of the sphere :1 Enter choice: a for area of sphere an Volume of sphere is 4.186667