Concept explainers
What would be the output in Self-Test Exercise 9 if the Boolean expression (x > 10) were changed to (x > 100)?
9. What output will be produced by the following code, when embedded in a complete
int x = 200;
cout << “Start\n”;
if (x < 100)
cout << “First Output. \n”;
else if (x > 10)
cout << “Second Output. \n”;
else
cout << “Third Output. \n”;
cout << “End\n”;
Want to see the full answer?
Check out a sample textbook solutionChapter 3 Solutions
Problem Solving with C++ (9th Edition)
Additional Engineering Textbook Solutions
Starting Out With Visual Basic (8th Edition)
Introduction to Java Programming and Data Structures, Comprehensive Version (11th Edition)
Starting Out with C++: Early Objects
Starting Out With Visual Basic (7th Edition)
Computer Science: An Overview (13th Edition) (What's New in Computer Science)
Starting Out with Java: From Control Structures through Objects (7th Edition) (What's New in Computer Science)
- Consider the following code: def test(*x): for k in x: print(type(k)) what will be the output if test function is culled with 876? Oa. O b. O c. O d. 876arrow_forwardComplete the if-else statement to output "Below 90" if the value of userInput is below 90. Otherwise, output "90 or more". Ex: If the input is 88, then the output is: Below 90 1 import java.util.Scanner; 3 public class Relational { 345678 9 10 11 12 13 14 FREEdd public static void main(String[] args) { Scanner scnr = new Scanner(System.in); int userInput; 15 16 } 17 } userInput = scnr.nextInt (); if (* Your code goes here */) { System.out.println("Below 90"); } else { } System.out.println("90 or more");arrow_forwardConsider the following function: int test(int x, int y) { if (x == y) return x; else if (x > y) return (x + y); else return test(x + 1, y - 1); } What is the output of the following statements? a. cout << test(5, 10) << endl; b. cout << test(3, 9) << endl;arrow_forward
- javaarrow_forwarda. public static boolean checkNumber (integer x) 4) To definc a mcthod checkNumber to check b. public static int checkNumber (integer x) and return if a given integer is odd or not, we c. public static int checkNumber (int x) write the header as : d. public static void checkNumber (int x) e. None of the above 5) Which of the following loops is infinite? a. for (int i 0; true ; i++) b. for (int i 0; i < Math.pow (2, 32); i++) c. Both a. & b. d. None of the abovearrow_forward4 Write an if-else statement to output "Exceeds capacity" if the value of roomCapacity is greater than 161. Otherwise, output "Does not exceed capacity". End with a newline. Ex: If the input is 163, then the output is: Exceeds capacity 1 import java.util.Scanner; 3 public class Relational { 4 public static void main(String[] args) { Scanner scnr = new Scanner(System.in); int roomCapacity; L23456789 5 11 10 11 12 } 13 } roomCapacity = scnr.nextInt (); /* Your code goes here */ 2arrow_forward
- An instructor wants to give feedback to students in an assignment according to the number of correctly solved programs. Example of feedback :Nb of correct programs Feedback 0 incomplete assignment1 partially correct assignment2 Satisfactory attempt 3 Good attempt4 Excellent attemptThe following figure shows an example of execution.Write the Java program that reads the number of correctly solved programs and displays the adequate feedback.Note: Choose your own feedback message and do not copy from the previous table. Use any of the conditional statements like if-else/ if-else-if/switch case.arrow_forwardJAVA Program ASAP Please modify this program with further modifications which are below so it passes the test cases in Hypergrade. I have provided the failed test cases. 1) For test cases 2 and 3 for the outputted numbers there needs to be commas and there needs to be nothing after that 2)for test case 1 outputted numbers there needs to be nothing after that, 3) for test 4 when file is not found there needs to be nothing after that 4) and for test case 5 and 7 afer a file is not found it needs to display Please re-enter the file name or type QUIT to exit: so you input the text file and displays the numbers. import java.io.BufferedReader;import java.io.FileReader;import java.io.IOException;import java.util.ArrayList;import java.util.Arrays;import java.util.InputMismatchException;import java.util.Scanner;public class FileSorting { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); while (true) { System.out.println("Please…arrow_forwardWrite TRUE if the output of the expression is true and FALSE if the output of the expression is false.arrow_forward
- Write a single statement that prints outside Temperature with 4 digits. End with newline. Sample output with input 103.45632: 103.5 Code writing challenge activity demo 468126.2649352.qx3zqy7 1 #include 2 #include 3 using namespace std; 4 5 6 7 8 9 int main() { 10 11 12 13} Run double outside Temperature; cin >> outside Temperature; /* Your solution goes here return 0; View your last submission ✓ 1 test passed All tests passedarrow_forwardjavaarrow_forwardGiven: char newFunc(int & a, int b) { char output = 'Q'; %3D while (aarrow_forwardarrow_back_iosSEE MORE QUESTIONSarrow_forward_ios
- EBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENT