What is the final value of variable myNum after the following code fragment executes? int myNum 0; int value - 1; switch (value) case 1: myNum - 10; break; case 2: myNum- 20; break; case 3: myNum 30B break; case 4: myNum -40; break: default: break: 10 20
Q: What is the output of the following code segment? double vall = -7; int val2 = 9;…
A: If we break the calculation into segments. Floor value will return the lower bound of the integer.…
Q: How do you know if your variable should be declared as an enum type or another data type? Give…
A: The solution to the given question is: When declaring a variable as enum type , you must use the…
Q: sing C#, write an application that computes the area of a circle, rectangle, and cylinder. Display a…
A: According to the Question below the Solution: Output:
Q: What is the value of x in the given code? def getX(num): if num > 10: return 10 else: return 20 x =…
A: b. x = 20 Explanation:- the parameter for getX is 5. So, num =5 condition: if num > 10 then…
Q: What is value of ans after the following code is executed? >> 5 * 5; ; >> ans +
A: ans in matlab is used store the values of the operation. It is a default varible to store the result…
Q: void change( int a[]) , the compiler converts the parameter to: Select one: a. int *const a b. int…
A: The compiler changes void change(int a[]) silently to void change(int *const a) at the time of…
Q: Pass the first parameter by reference and the second parameter by value. 1 char mein ( int c, char…
A: Given code: char mein(int c, char i) { c=50; i= (char) c; cout<< (int)c+i<<endl; return…
Q: What is the result of evaluating the following postfix expression?
A: Firstly, create a stack to store operands or values Scan the expression and do the following- if…
Q: What would be the result of y the following line of code? y= 10 *2 - 9 + 4; 15
A: Code in python :- y = 10 * 2 - 9 + 4print(y) Output:-
Q: Print either "Fruit", "Drink", or "Unknown" (followed by a newline) depending on the value of…
A: This is multiple type question, hence only first question has been answered. The question is to…
Q: نقطة واحدة What is the output of the * ?following program 1 #include using namespace std; int main…
A: #include <iostream>using namespace std;int main(){ int u=10, y=20; switch (u) {…
Q: What will be the value stored in the variable "s" after executing the following code segment? double…
A: Programming Approach: Defining the necessary header files. Defining the main function. Defining 2-D…
Q: What will be the output of the following code? int v = 15; V--; cout << "v = " << v++ << endl; %3D…
A: In the given code, int j=2,k=23,l; l= ++(j+k); Answer:- The values of j, k and l is…
Q: Complete the code that returns the value of ?(?)f(x), which has the value 1 inside the range…
A: Given that, given function f(x), which has the value 1 inside the range -1≤x≤1 otherwise it is the…
Q: Modify your working program from Assignment #19 so that when the user enters data into the Selling…
A: Description : Entry widgets are the basic widgets of Tkinter used to get input, for example text…
Q: Modify your working program from Assignment #19 so that when the user enters data into the Selling…
A: Note: Follow proper indentation to get output. Basic Methods used in Program: mainloop(): mainloop…
Q: What is the final value of variable myNum after the following code fragment executes? int myNum = 0;…
A: From the above given options Option B will be the correct answer Explanation: As we can see in the…
Q: What is the output of the following segment of code if 4 is input by the us asked to enter a number?…
A: Switch case is branching statement. An expression is passed within switch and corresponding case is…
Q: Given what is supposed to be typed and what is actually typed, write a function that returns the…
A: Coded using JavaScript.
Q: Q4/B/Rewrite the code by using input box for each parameter and print result also each input…
A: Code: Public Class Form1 Private Sub Form1_Load(sender As Object, e As EventArgs) Handles…
Q: How many times will the following code will print "Final Test"? three times none one time four times
A: In the do-while loop, first of all, the body of the loop is executed and then the condition is…
Q: What is the content of the variable myString after executing the following code successfully stri -…
A: Given strings: str1="This is my first program" str2="I am a programmer" str3="I am an engineer"…
Q: In the code given below, the values of installment1.dueDate and installment2.dueDate is getting…
A: Debug the given JavaScript code such that there is a difference of 5 months in the dueDate of the…
Q: (ii) A variable x is declared as an integer. Is the assignment x <2.08 possible? Why br why not? If…
A: ii) A variable x is declared as an integer is the assignment x <--2.08 is possible? No it is not…
Q: Debug the section of code that follows. Check the code carefully for all 10 errors and list the…
A: ERRORS : 1) Line 3: There is no datatype named integer, rather it is called int 2) Line 4: There is…
Q: Modify songVerse to play "The Name Game" (OxfordDictionaries.com), by replacing " (Name)" with…
A: Program with modified “songVerse” to play “The Name Game” by replacing “(Name)” with “userName” but…
Q: What is the output of this code? def main(): x = myfun(5) y = myfun(4) z = myfun(2) print(x + y + z)…
A: X = myfun(5) will call the function myfun with p=5 So the function will return value 15 which will…
Q: What will be the result of running the following code fragment? int time = 0; int year = 0; int rate…
A: The, given code is: int time = 0;int year = 0;int rate = 0;int principal = 1000;int interest =…
Q: Given the code below: type point real a, b end type type (point) v read*, v z=v%a/v%b print*,…
A: Wrong options none of the given code choices ,because option is there type point real a, b end type…
Q: ubtractMe(x): k = x - (2/0) if (k <= 6): return 6
A: Lets see the solution.
Q: What will be output by the above code segment ?
A: #include <iostream> using namespace std; int main(void){ int m=1,n=2; //initialize m…
Q: Please write me a testing code for this im Junit5 i dont know how to test it
A: Here I am going to show you how to use testing tool for Junit5. We can create a Maven project that…
Q: int result= %3D%3B For (int i-o;ikait) int count = 7; Whire count >=0) resuit ttj Count--
A: According to the Question below the Solution:
Q: What is the output from this code if the user enters the letter b and ALL the break statements are…
A: The modified code after removing the break statement is shown below -
Q: Can the argument have the same name as its parameter?
A: Lets see the solution.
Q: Given a code snippet below. What is the content of variable wide? float final(int a) { return 20 - a…
A: According to the asked question, the solution is given below with a proper explanation.
Q: int j; switch (i) { case 0: j = 2*i; break; case 1: j = -i; break; default: j = -2*i;…
A: If i=1, then j will be -1. Because here i=1 which jumped to case 1 where j = -i => j = -1 then…
Q: What is the value of average after the following code? int x, sum = 0,…
A: Here we have declared three variables. Next, we have a loop that generates numbers from 0 to 5,…
Q: By using class interface write a program to read three numbers and using a friend function to find…
A: Algorithm: Start Define a class with one virtual method and one friend method. Implement the 2…
Q: ould change if you see the above variable declar
A: var x = “blue”; is there anything that you would change if you see the above variable…
Q: Answer the following true/false questions using the following code. And state why it is true or…
A: 1. Yes we can tell what type of variable match is by seeing the above code. True 2. Yes we can tell…
Q: You are developing a restaurant recommender program. This is a snippet of your code. Pick all of the…
A: Given: You are Developing a restaurant recommender program. this is the snippet of your code . Pick…
Q: What is the value stored in Y after the above code is executed?. Express your
A: Answer is in given below:-
Q: Write a switch statement that tests the value of the char variable response and performs the…
A: PROGRAM STRUCTURE: Include the required header files. Start the definition of the main function.…
Q: What will be displayed by the following code? int k = 0; while(k <= 10) {k++;} cout << k << endl;
A: I have given an answer in step 2.
Q: Identify the correct statement for varjable initialization from the following? O a. 38.7=heat O b.…
A: Question is about how variable initialisation is done. We are given 4 option lets see:
Q: what is the type of value returned by the following fumction ? carEstPlusPetit (char a, char b) int…
A: function
Q: Write a code fragment to prompt the user to enter the age of the visitor for the concert with the…
A: The solution is provided below.
Q: What is value of the variables after theif statement? int n = 1; %3D int k = 2; int r = 3; if (r < n…
A: n = 1 k = 6 r = 3
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 1 images
- True or False An output parameter works like a by value parameter.Pass the first parameter by reference and the second parameter by value. *Write a statement that assigns finalValue with the multiplication of userNum1 and userNum2. Ex: If userNum1 is 6 and userNum2 is 2, finalValue is 12. let userNum1 = 6; // Code tested with values: 6 and 4let userNum2 = 2; // Code tested with values: 2 and -2 let finalValue = 0;
- Analyze the following code: int x = 0;int y = ((x < 100) && (x > 0)) ? 1: -1; The code has syntax error. y becomes 1 after the code is executed. y becomes -1 after the code is executed. The code has run time error.Create an Adder application which prompts a player for the answer to an addition problem. The Adder game creates a problem from two randomly selected integers between 0 and 20. Adderallows the player three tries to enter a correct answer. If the correct answer isentered on the first try, the player is awarded 5 points. If the correct ansewer is enterd on the second try, 3 points are awarded. The correct answer on the third try earns 1 point. If after three tries, the correct answer is still not entered the player receives no points and the correct answer is displayed. The game continues until 999 is entered as sn answer. At the end of the game, Adder displays the players score. Application output should look similar to the following 20+5=25 20+2=20 Wrong answer. Enter another answer: 22 3+6=5 Wrong answer. Enter another answer: 4 5+12=17 14+18=999 Your score is 13The following code results in an error message. What will the error message be andhow can it be fixed? def TryParseInt(p1, p2):return p1 + p2#Calling Codep3 = TryParseInt(10)
- Text-based adventure game: Pretend you are creating a text-based adventure game. At different points in the game, you want the user to select to fight, run, or hide from certain enemies. Modify the application below (week3.py) so that the selection variable is sent as an argument into the choice() function. The user should enter 1 to fight, 2 to run, or 3 to hide in the main(). The choice() function should print one of the three options. You will need to add an if statement in the choice() function to make the correct selection.Q1: The local Driver's License Office has asked you to write a program that grades the writ- ten portion of the driver's license exam. The exam has 20 multiple choice questions. Here are the correct answers: 1. A 2. D 3. B 4. B 5. C 6. B 7. A 8. B 9. C 10. D 11. A 12. C 13. D 14. B 15. D 16. C 17. C 18. A 19. D 20. B Your program should store the correct answers shown above in an array. It should ask the user to enter the student's answers for each of the 20 questions, and the answers should be stored in another array. After the student's answers have been entered, the program should display a message indicating whether the student passed or failed the exam. (A student must correctly answer 15 of the 20 questions to pass the exam.) It should then display the total number of correctly answered questions, the total number of incorrectly answered questions, and a list showing the question numbers of the incorrectly answered questions. Input Validation: Only accept the letters A, B, C, or…What is the final value of y? int x = 4; 6; int y if (x < 10) { if (y < 5) { y = y + 1; } } else { } y = 7; } else { y = y + 10;
- Using a Sentinel Value to Control a while Loop in Java Summary In this lab, you write a while loop that uses a sentinel value to control a loop in a Java program that has been provided. You also write the statements that make up the body of the loop. The source code file already contains the necessary variable declarations and output statements. Each theater patron enters a value from 0 to 4 indicating the number of stars the patron awards to the Guide’s featured movie of the week. The program executes continuously until the theater manager enters a negative number to quit. At the end of the program, you should display the average star rating for the movie. Instructions Ensure the file named MovieGuide.java is open. Write the while loop using a sentinel value to control the loop, and write the statements that make up the body of the loop to calculate the average star rating. Execute the program by clicking Run. Input the following: 0, 3, 4, 4, 1, 1, 2, -1 Check that the…Note: passing value without return anything#include<stdio.h>#include<stdlib.h> int cent50=0;int cent20=0;int cent10=0;int cent05=0; void calculatechange(int* change){if(*change>0){if(*change>=50){*change-=50;cent50++;}else if(*change>=20){*change-=20;cent20++;}else if(*change>=10){*change-=10;cent10++;}else if(*change>=05){*change-=05;cent05++;}calculatechange(change);}}void printchange(){if(cent50)printf("\n50cents:%d coins",cent50);if(cent20)printf("\n20cents:%d coins",cent20);if(cent10)printf("\n10cents:%d coins",cent10);if(cent05)printf("\n05cents:%d coins",cent05);cent50=0;cent20=0;cent10=0;cent05=0;}void takechange(int* change){scanf("%d",change);getchar();}int main(){int change=0;int firstinput=0;while(1){if(!firstinput){printf("\nEnter the amount:");firstinput++;}else{printf("\n\nEnter the amount to continue or Enter -1 to…