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; Which of the following statement is correct?
Q: Given the following statements:int num;int *numPtr;write C++ statements that use the variable numPtr…
A: Statement The statement that uses the variable numPtr to increment the value of variable num is…
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: void sierpinski (float x1, float yl, float x2, float y2, float x3, float y3, int iterations // The…
A: It is defined as an interpreted, object-oriented, high-level programming language with dynamic…
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: Write the output of the code given below?…
A: Answer: In the above given program the output will be null it will print nothing. It will print…
Q: What will be assigned to x in each of the following statements? x = 8 + 3; x = 8 - 3; x = 8 * 3; x =…
A: GIVEN: What will be assigned to x in each of the following statements? x = 8 + 3; x = 8 - 3; x = 8 *…
Q: Suppose n1 and n2 are two int variables that have been given values. Write aBoolean expression that…
A: We have to use boolean algebra and create one boolean expression which returns true if the value of…
Q: Assume integers x = 4, y = 7, and z = 2. What value will be stored in integervariab le resul t by…
A: Given: Assume integers x = 4, y = 7, and z = 2. What value will be stored in integervariab le resul…
Q: Write a program for calculating the simple interest on a loan when the initial prin- cipal amount…
A: PROGRAM CODE: public class Main{ public static void main(String[] args) {…
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: A- Given the declaration: int main () int x; int p; int q; return 0; mark the following statements…
A: Answer: Valid Invalid Valid Valid Invalid
Q: #include int main(void) { printf("welcome!\n You are able to test your skill of writing C…
A: As per our guidelines we are supposed to answer only one question but here i am doing three question…
Q: How many times the statement "Statement" is printed in the following code? void fun(int R)…
A: the answer is as follows
Q: Identify the correct statement for variable initialization from the following? O a. heat=heat+10 O…
A: variable can initialized and declared at the same time, syntax: data type variable_name expression…
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 we have variable a and b of integer datatype whose initial value is 2 and 3 respectively.…
Q: What value will be stored in the variable t after each of the following statements executes? A) t =…
A: Note: There are multiple questions are given in one question. According to the rule, you will get…
Q: Assume that int a[ 2 ][ 2 ] = { { 1, 2 }, { 3, 4 } }; the value of a[ 1, 1 ] = ______;
A: #include<stdio.h> int main(){ int i=0,j=0; int arr[2][2]={{1,2},{3,4}};…
Q: (int score) Returns how many entries in the scoreboard are greater than or equal to the given score.…
A: Q. Use C++ Programming int exemplary(int score) Returns how many entries in the scoreboard are…
Q: Which is correct with respect to the size of the data types? ans. double > char >int char>int> float…
A: Option C Char<int<double
Q: 41 In the code below, how many print statements will run? 1 age = 13 2 if age = 13: %3D%3D 3 print…
A: Here in this question we have given python code segment and we have asked that how many times print…
Q: What would be the value of y after the following statements are executed? {int y = 36; if(y== 35) y…
A: The output of the code is given below
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: Correct the errors in each of the following statements: 1- if ( age >= 65) cout> i>>j; **** *****
A: To correct the errors in the given statements: The given statement is: if ( age >= 65)…
Q: How many times would you see the asterisk shown in the following code? for (int x=1; x <= 100; x++)…
A: for (int x=1; x <= 100; x++) for (int y = 1; y <= 100; y++) for (int z = 1; z…
Q: Assume int x-5, y-4; int z= (x<4) ? x++: (--x + (2 y++)): What is the value of z? а. n a. n None of…
A: We are given a programming logic question where we are using ternary operator. In ternary operator…
Q: 9 - With the following declaration: int [.] points = {{300, 100, 200, 400, 600}, {550, 700, 900,…
A: Required:
Q: Write an application that initialize the radius of a circle as an integer and prints the circle’s…
A: PROGRAM CODE: import java.util.*; // import the utility package public class Main{…
Q: What would be the value of y after the following statements are executed? {int y = 36; if(y== 35) y…
A: Ans: The value of y after executing the following statement is: int y=36; if(y == 35){ y…
Q: The product of the following statements is. float x=2.4; cout<< ceil(x)<<"\t"<<floor (x+1.9)…
A: ceil: If there exist a fraction part for a number then ceil of that number is next integer value.…
Q: * What will be the contents of the variable x after the following statement is executed? x =…
A: Answer in step 2
Q: def f(x: float) -> int: return int(x) def g(x: str) -> float: return float(x) y = f(g("3.14"))…
A: Answer: Option 3 - y's inferred data type is int Explanation: The given equation is y=f(g("3.14"))…
Q: What is the output of this code? int value = 50, a = 9, b = 3, c = 6; cout (value > 30 ? "YES" :…
A: 1) Above code has one error where operator << is missing in cout statement 2) This can be…
Q: Can you declare a variable as int and later redeclare it as double?
A:
Q: in this program. a, int b, int *c, int *d, int *resu a, int *b, int *c, int *d, int *resu int *res
A: I have written the code below:
Q: Write a method named presentValue that performs this calculation. The method should accept the…
A: We know that the amount we get for a principal P after t years is P + PTR/100 So, according to the…
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: The following declaration, program, and program segment has errors. Locate as many as you can.…
A: One may want to set a default value for the property member, and therefore when not started would…
Q: The value of a in below code is } ;int a=3 ;float b=3.0 ;a+= (a==b)? b:-b ;cout << a {
A: Here, one C++ code snippet is given. Find the output of the code: int a=3; float b=3.0;…
Q: 4. Which among the following is correct? a) void test(int x=0, int y, int z=0) b) void test(int…
A: Question 4. Which among the following is correct? a) void test(int x=0, int y, int z=0) b) void…
Q: Evaluate the following expressions, assume the following declarations: int a=28; int b=4; int c=2;…
A: The given expression is as below- int a=28; int b=4; int c=2; int z=0; z*=a/b-c;
Q: Evaluate the following expressions, assume the following declarations: int x = 4; int y = 1/2; int…
A: Given x=4 As y is int it takes 1/2=0.5 It take only 0 as it is int. y=0 num=6 num*=x + y num=num * x…
Q: Evaluate the following expressions, assume the following declarations: int x = 4; int y = 9/2; int…
A: Given expressions: int x = 4; int y = 9 / 2; int num = 6; num *= x + y;
Q: Can this be done in a form of a flowchart please? 1. Prompt the user and read in the number of a…
A: Flow chart is a step by step in which the sequence of steps are connected using the flows. In Flow…
Q: Suppose you want to deposit a certain amount of money into a savings account and then leave it alone…
A: Note: Programming language is missing in the question. So we will answer this program in C++…
Q: int num1 = 3, num2; cin >> num2; if (num2 > 6) int num1 = 5; cout << num1
A: Please find the answer below :
Q: What are the values of a, b, and c after executing the following statements? int a, b, c; a = 1: b…
A: int a, b, c; // declares variables a, b and c a=1; b=2; c=2;…
Q: What would be the value of y after the following statements are executed? {int y = 36; if(y == 35) y…
A: Ans: The value of y after executing the following statement is: int y=36; if(y == 35){ y…
Q: Given an airplane's acceleration and take-off speed v, you can compute the minimum runway length…
A: The given problem can be solved using simple arithmetic operations in any programming language.…
Q: int a = 5, b = 12; double x = 3.4, z = 9.1; What are the values of the following expressions? A) b/…
A: Here is the program which execute these statements #include<iostream>using namespace std;int…
Q: suppose u,v and w are int variables and u =1 ,v=2, w=3, what is the value of each variable after the…
A:
Step by step
Solved in 3 steps with 3 images
- What does the following code segment display? for(f=0; f<3; ++f); write ("{0} ", f); a. 0 b. nothing c. 3 d. 0 1 230 Suppose a, b, and sum are int variables and c is a double variable. What value is assigned to each variable after each statement executes? Suppose a = 6, b = 3, and c = 2.2. (14) a b c sum sum = static_cast<int>(a + b + c); __ __ __ __ b += c * a; __ __ __ __ c -= a; __ __ __ __ a *= 2 * b - c; __ __ __ __B) What is the value of speed when the following code snippet runs successfully? const int MIN_SPEED = 45; const int MAX_SPEED = 65; int speed = 55; if (!(speed < MAX_SPEED)) { speed = speed - 10; } if (!(speed > MIN_SPEED)) { speed = speed + 10; } C) Assume: int a = 3, b = 2; double c = 5.0; And evaluate the expression and show each step to indicate the evaluation sequence. (c + a / b) / 8 * 2
- For the following declaration statements, determine if the statement is valid or invalid, if invalid indicate why. a) int My Age; b) double double_1; c) double Income Tax; d) float gpa = 3.90; e) String Name = ‘Joe’; f) Char MI = M; g) Char Letter = “B”; h) double static; i) double Salary$ = 0.0; j) int _VarM;3. B) What is the value of num when the following code snippet runs successfully? int num = 100; if (num < 100) { if (num < 50) { num -= 5; } else { num -= 10; } } else { if (num > 150) { num += 5; } else { num += 10; } } C) A store provides 10 percent discount on all items with a price of at least $100. No discount is otherwise applicable. Assume that two variables are declared, discount and price. Write the code segment that does the job.The great circle distance is the distance betweentwo points on the surface of a sphere. Let (x1, y1) and (x2, y2) be the geographicallatitude and longitude of two points. The great circle distance between the twopoints can be computed using the following formula:d = radius X arccos(sin (x1) X sin(x2) + cos(x1) X cos(x2) X cos(y1 - y2))Write a program that prompts the user to enter the latitude and longitude of twopoints on the earth in degrees and displays its great circle distance. The averageradius of the earth is 6,371.01 km. Note you need to convert the degrees into radiansusing the Math.toRadians method since the Java trigonometric methods useradians. The latitude and longitude degrees in the formula are for north and west.Use negative to indicate south and east degrees. Here is a sample run: Enter point 1 (latitude and longitude) in degrees: 39.55 −116.25 ↵EnterEnter point 2 (latitude and longitude) in degrees: 41.5 87.37 ↵EnterThe distance between the two points is…
- (Parking fee) The short-term, 0-24 hours, parking fee, F, at an international airport is given by the following formula: where int(h + 1) is the integer value of h + 1. For example, int(3.2) = 3, int(4.8) = 4. Write a program that prompts the user to enter the number of hours a car is parked at the airport and outputs the parking fee.Phyton In the United States, fuel efficiency for vehicles is normally expressed in miles-pergallon (MPG). In Canada, fuel efficiency is normally expressed in liters-per-hundred kilometers (L/100 km). Use your research skills to determine how to convert from MPG to L/100 km. Then create a program that reads a value from the user in American units and displays the equivalent fuel efficiency in Canadian units1. Prompt the user and read in the number of a team playing the current game, i.e. Team 1, Team 2, Team 3, etc. 2. Prompt the user and read in the number of the opponent team. It is probably helpful to think of the first team as the home team for this game, and the second team as the away team. 3. Prompt the user and read in a team’s score for the current game. Use the team’s number when asking for the score in your printf statement. 4. Prompt the user and read in the opponent’s score for that game. Again, use the opponent’s team number when asking for the score. 5. Notify the user and repeat steps 3 and 4 in the case that the user enters a negative value. 6. Calculate the points earned by each team and add it to a cumulative score. A win is worth 3 points, a draw is worth 1 point and a loss is zero points. Also update the amount of games played by each team and their goals for and against. 7. Print to the screen the following header and beneath it a line of data that corresponds to…
- Fahrenheit to Celsius using multiple statements Given a Fahrenheit value temperatureFahrenheit, write a statement that assigns temperatureCelsius with the equivalent Celsius value. While the equation is C = 5/9 * (F - 32), as an exercise use two statements, the first of which is "fractionalMultiplier = 5/9:". Check if varlables temperatureFahrenheit, fractionalMultiplier, and temperatureCelsius exist Variable temperatureCelsius does not exist. From Matlabint the given statement 10 timWrite a pseudo code that calculates the total point earned by a football team over a series of games and calculate the average of team. It allow the user to enter the series of game points, As soon as the user enters a negative value -1 to program, it should calculate the average test score and display it. Team A series 1 point: 10Team A series 2 point: 5Team A series 3 point: 8Team A series 4 point: 9Team A series 5 point: 12Team A series 6 point: -1Average of Team A =8.8