Written #2 2A Which of the following two options will correctly prompt the user until they enter a valid weekend day? # Option 1 SAT = "Sat" SUN = "Sun" day = input("Which day is better for brunch?\n") while day != SAT and day != SUN: day = input("Sorry, what? Please enter a valid day.\n") print("Thank you!")
Q: For which one of the following statement, x[1] = 1 does NOT cause an ERROR? O x="1,2,3" O All of…
A: Defined for the given statement,x[1]=1 does not cause error
Q: Which of the following code is not correct ? Select one: a. if val(textbox1.text) >59 then…
A: For comparing text the raw data should be enclosed in double quotes at both the ends.
Q: Which of the following option is the correct representation of the following C statement ? e = a b +…
A: According to order of precedence, addition operation will be the last one to be performed. The…
Q: Select from the options to fill in the blanks with a correct statement. Options may be used more…
A: The program creates a fork using fork(). Whenever pid > 0 the process is parent. When pid == 0…
Q: What is the output of the following code: Dim number As Integer Number 7. %3D Select Case number…
A: The correct option is an option a i.e. Text 1
Q: You are required to write a code that requests the user to enter four integer numbers that…
A: C++:- c++ is an object-oriented language . Because c++ follows oops property.c++ evolved from c.c++…
Q: A Sub procedure named GetEndInv is passed four Integer variables from its calling statement. The…
A: Given statement: The given procedure header (a) states that all the variables except final are…
Q: A customer want to buy 6 items. He has only 50.50 OMR with him. The price of the products are…
A: Solution: Algorithm to check weather all the 6 products can be bought :…
Q: Please write a program which user can enter the fruit name in a dialog box to find the price online.…
A: prompt function in HTML programming: The method, prompt() is used to ask a user to enter the input…
Q: You are writing a program that checks whether the user can order from the kids' menu (ages 12 and…
A: Please find the answer below :
Q: Question 15 Which of the following switch statements Is equivalent to this if statement: int x = 10;…
A: In option C, default:"not less"; is changed to default:cout<<"not less"; then we will get…
Q: Which of the following is true? O In a simple if state, the command right below the CMP is the…
A: let us see the answer:- The correct option is a) i.e. In a simple, if the state, the command right…
Q: Provide the following instructions for writing an application that questions the user for two…
A: PROGRAM INTRODUCTION: Import the required libraries. Start the definition of the main function.…
Q: Which of the following statements displays a dialog box that prompts the user for the name of a…
A: The answer is strCity = InputBox (“Enter the city name”,,”City”) (option b) Explanation:- In visual…
Q: Checkpoint 3.27 Write an if statement that displays “Goodbye" if the variable myCharacter is equal…
A: Given:
Q: Welcomes user to the Windchill Temperature (WCT) Weather Report calculator. Prompts the user to…
A: Program approach: Print program heading. Input decimal precision as an integer. Print error…
Q: 16. Which statement will add leading zeroes to x? O string x += "0" string x = "0" + x either of the…
A: If zeroes are present at the starting, then it is called leading zeroes. For example, all the…
Q: Welcome to the cs 110 Gemstone shop! Which gemstone would you like to collect? 1. diamond 2. ruby 3.…
A: """Python program for Gemstone collection from shop""" #initialize gemstone values to 0diamond =…
Q: If a message is for informational purposes only and does not require the user to make a decision,…
A: MessageBox is used to display message to the user and sometimes it allows to take some decision. The…
Q: You are required to write a code that requests the user to enter four integer numbers that…
A: Since no programming language is mentioned, I am using python. Code: majors=["Medical…
Q: 1) Check if even 2) Check if odd 3) Check if Negative 4) Check if positive For each option ask the…
A: C++ used to answer this question
Q: Q1: Determine which of the following statements is true or false, and correct the false one: 1. An…
A: 1) an if statement can only have one Elself and else statement associated with it is false.
Q: Question 8 Which of the following switch statements is equivalent to this if statement: int x 10;…
A: The if statement can be converted to switch statement. In the mentioned scenario, the case statement…
Q: The expression in which of the following assignment statements will not calculate correctly? a.…
A: The incorrect statement from the given options is b. lblTotal.Text = Val(txtSales1.Text +…
Q: A customer want to buy five items. He has only 75.0 OMR with him. The price of the products are…
A: No.of items = 6 Total_Cost = 0 items = 0 Total_OMR = 75 while items !=No.of Items Add…
Q: A customer want to buy five items. He has only 70.0 OMR with him. The price of the products are…
A: Flowchart and algorithm represent how a problem can be solved in several steps programmatically. A…
Q: Which of the following statements declares a procedure-level variable that is removed from the…
A: Explanation: Procedure level variable is a variable declaration statement, which maintains the…
Q: The program will ask the user to enter weight in pounds and height in inches and displays the Body…
A: Code: To calculate and display BMI status, height in meters and weight in kgs #include…
Q: int option=2; switch(option){ case 1: printf("1"); break; case 2: printf("2"); case 3: printf("3");…
A: 1- The correct answer is 23. 2- The break statement missing for case: 2, therefore the output will…
Q: Which of the 'if statements below is the correct one for the following problem statement? Adjust…
A: if employee salary is more than 11000 per month then we should increase salary by 2.5%, else we…
Q: How many times will the following function call itself if 5 is passed as the argument? void…
A: Given: How many times will the following function call itself if 5 is passed as the argument?void…
Q: Which of the following switch statements is equivalent to this if statements int x = 10; %3D if(x <…
A: Given:-
Q: Write a statement that assigns operationResult with the division of number1 by number2. Ex: If…
A: Javascript code: <script>//test case 1var number1 = 6; var number2 = 2; var operationResult =…
Q: N=5; Z=input('Z=?"); for J=1:2:N Z=Z+1; if J>2 break end Z=Z+1; end Z=Z+1; disp(Z);
A: First of all let's understand the code: (1) N is initialized to 5. (2) Z=input(Z=?) Z is taking as…
Q: How many times will the message box be displayed in the given code below? For x = 4 To 11 Step 3…
A: Loops are used to perform a set of task repeatedly.
Q: input into the variable "value"? a) value >> cin; b) cin >> value; c) value > cin; b) cin >> score;…
A: Answer: 1)Option B is correct: cin>>value; 2) Option D is correct: cout<<score; 3)…
Q: 13: Evaluate (or (= 50 13) (> 16 88)) 00 #T 1 This expression would produce an error message when…
A: Answer 13: after run value is NIL.#F so correct option is e Answer 14: after run it in lisp so…
Q: Which of the following switch statements is equivalent to this if statement: int x = 10; if(x < 15)…
A: Switch Case syntax is switch( expression ) { case value-1: Block-1; Break; case value-2:…
Q: The value of H after executing the program, g=6 is: Private Sub Command1_Click (.) Dim g, H As…
A: SUMMARY: - hence we discussed all the points
Q: Which of the following expressions would produce a Boolean value of True? O((True or False) and…
A: your question is about which of the following True value let's see the correct answer
Q: scanf_s("%d", &choice); if (choice == 1) {…
A: Flow chart:- A flowchart is a pictorial representation that shows overall process. They are mainly…
Q: Which of the following operators reverses the meaning of a test statement?a. #!b. -oc. -ad. !
A: Explanation: The “#!” is used to define the path name. The “-o” denotes “OR” operator that uses two…
Q: Which of the following is a correct statement that accepts a whole number value using JOptionPane? O…
A: Given:
Q: Which of the 'if' statements below is the correct one for the following problem statement? Jabho…
A: It is defined as a programming conditional statement that, if proved true, performs a function or…
Q: x = Clnt(Text1.Text) If x 1 Then MsgBox ("Sunday") Elself x = 2 Then %3D MsgBox ("Monday") Elself x…
A: Given questions are multiple choice questions so we provide both questions answers.
Q: Which of the following will test to make sure the number entered by the user into the variable named…
A: According to company guidelines only one question can be answered . Kindly repost the other question…
Q: Which one of the following (2 statements use to print the ? value of the variable num1…
A: Please find the answer below :
Q: Which of the following statements displays a dialog box that prompts the user for a name, and then…
A: “InputBox()” is a function of Visual Basic, that is used to display an input dialog box. Syntax for…
Q: Which of the following determines whether the radAddition radio button is selected? a. If…
A: The Rad addition radio button is selected a. If radAddition.Checked = True Then
Q: Write the value of H after executing the program, g=6 Private Sub Commandl_Click () Dim g. HAs…
A: Value of g = 6 G will be true after executing instruction four H = 2.75 *g + 1 =2.75 * 6 + 1…
Question 2A:
Since the given inputs are
SAT = "Sat"
SUN = "Sun"
The input will be only valid when we enter only Sat and Sun
the while condition : while day!=SAT and day != SUN: will check for both Sat and Sun and will return if it is true either it will again ask for input.
Trending now
This is a popular solution!
Step by step
Solved in 2 steps
- 1. Which of the following statements places input into the variable "value"?a) value >> cin;b) cin >> value;c) value << cin;d) cin << value;2. Which of the following statements outputs the value of variable score?a) score >> cin;b) cin >> score;c) score << cin;d) cout << score;3. Assuming that the user inputs a value of 25 for the price and 10 for the discount rate in thefollowing code snippet, what is the output?int main(){double price;double discount;cout << "Enter the price: ";cin >> price;cout << "Enter the discount rate: ";cin >> discount;cout << "The new price is ";cout << price - price * (discount / 100.0) << endl;return 0;}a) The new price is 25b) The new price is 15c) The new price is 22.5d) The new price is 20.04. What is the value inside the "value" variable at the end of the given code snippet?int main(){int value = 3;value = value – 2 * value;value++;return 0;}a) –2b) 0c) 2d) 425.…Write an application that prompts the user for two integers and then prompts the user to enter an option as follows: 1 to add the two integers, 2 to subtract the second integer from the first, 3 to multiply the integers, and 4 to divide the first integer by the second. Display an error message if the user enters an option other than 1 through 4 or if the user chooses the divide option but enters 0 for the second integer. Otherwise, display the results of the arithmetic.Write an application that prompts the user for two integers and then prompts the user to enter an option. If the choice is 1, add the two integers. If it is 2, subtract the second integer from the first; if it is 3, multiply the integers. Display the results of the arithmetic.
- Ask the user for the name? Ask the user to input five test scores and calculate the total of the test scores and Average of the test Scores. Using the following 10-point grading scale for the average tests score, display the grade and reward the gift certificate using the formula. Average testscore Grade Gift Certificate formula 90 and above A 120% of average testscore 80–89 B 60% of average testscore 70–79 C 20% of average testscore 60–69 D 0% of average testscore Please display Name of the user, five test scores, total, Average test score, Grade and the Gift Certificate amount based on above user input and calculations. programming language - PythonSelect from the options to fill in the blanks with a correct statement. Options may be used more than once or not at all. Options: Error Parent Child Grandchild Zombie int main() { pid_t pid; pid = fork(); if (pid > 0) { fprintf(stdout, “__________\n”); // Statement 1 } else if (pid == 0) { fprintf(stdout, “_________\n”); // Statement 2 if ((pid = fork()) > 0) { fprintf(stdout, “_________\n”); // Statement 3 } else if (pid < 0) { fprintf(stdout, “_________\n”); // Statement 4 } else { fprintf(stdout, “__________\n”); // Statement 5 } } return 0;}scanf_s("%d", &choice); if (choice == 1) { choice = 0; goto label2; } else if (choice == 2) { choice = 0; goto label3; } else { choice = 0; printf("\aError please enter 1 or 2\n"); goto label4; } } } else { printf("\aWrong password\n"); printf("If you want to try again Press 1 , if you want to end the process Press 2\n"); scanf_s("%d", &choice); if (choice == 1) { choice = 0; goto…
- What is the output of the following segment of code if the value 4 is input by the user?int num;int total = 0;cout << "Enter a number from 1 to 10: ";cin >> num;switch (num){ case 1: case 2: total = 5; case 3: total = 10; case 4: total = total + 3; case 8: total = total + 6; default: total = total + 4;}cout << total << endl;What is the output of the following code segment?inte=5,f=10;if(eff0)Write(Purple) inte=5,f=10;if(eff0)Write(Purple) else Write(Gold); Purple Gold PurpleGold nothingWe have recently walked through a simple if statement block that results to a value based on the input given. The script is shown again in Snippet 3.11: python3_year = 2008year = int(input('When was Python3 first released?')) if year == python3_year: print('That is correct.')elif year > python3_year: print('Incorrect, too late.')elif year < python3_year: print('Incorrect, too early.')print('Have a great day!') Snippet 3.11 Modify this block as follows: • The user prompt should be Return TRUE or FALSE: Python3 was released in 2008:. • If the user inputs TRUE, print out Correct. • If the user inputs FALSE, print out Incorrect. • Any other user input should result in Please answer TRUE or FALSE. Go to your main.py file and add your code to it. Then, run it in a terminal. The output should look like Snippet 3.12: python3 main.py Return TRUE or FALSE: Python3 was released in 2008: TRUE CorrectHave a great day! python3 main.py Return TRUE or FALSE: Python3 was released in…
- Write a VB program to ask user to assign a value to “i” to find the answer for the following three cases. 1. Case 1. Assume i = 1 and HowMuch = 0IF i < 5 THENHowMuch = HowMuch + 1ELSEIF i = 5 THENHowMuch = HowMuch - 5ELSEHowMuch = HowMuch + 3END IFDISPLAY HowMuch2. Case 2. Assume i = 5 and HowMuch = 0IF i < 5 THENHowMuch = HowMuch + 1ELSEIF i = 5 THENHowMuch = HowMuch - 5ELSEHowMuch = HowMuch + 3END IFDISPLAY HowMuch3. Case 3. Assume i = 6 and HowMuch = 0IF i < 5 THENHowMuch = HowMuch + 1ELSEIF i = 5 THENHowMuch = HowMuch - 5ELSEHowMuch = HowMuch + 3END IFDISPLAY HowMuchWhat is the output of the following, if n=1, n=2, n=3, n=4, and n=5, respectively? int n = scan.nextInt(); switch (n) { case 1: case 2: System.out.print(“less than 3”); break; case 3: case 4: System.out.print(“less than 5 but bigger than 2”); break; default: System.out.print(“Other situations”); }How many times will the computer display the message box in the code below? intCounter = 0Do While intCounter > 3MsgBox(“Hello”)intCounter = intCounter + 1Loop How many times will the computer display the message box in the code below? intCounter = 0Do MsgBox(“Hello”)intCounter = intCounter + 1Loop While intCounter > 3