# Big Java Binder Early Objects

Computing

## Quiz 5 : Decisions Study Flashcards  Looking for Programming Homework Help?

## Quiz 5 :Decisions

Question Type  What is the output of the following code snippet? double income = 45000; Double cutoff = 55000; Double minIncome = 30000; If (minIncome > income) { System.out.println("Minimum income requirement is not met."); } If (cutoff < income) { System.out.println("Maximum income limit is exceeded."); } Else { System.out.println("Income requirement is met."); }
Free
Multiple Choice

C

Tags
Choose question tag  What is the output of the following code snippet if the input is 25? Int i; Scanner in = new Scanner(System.in); System.out.print("Enter a number: "); I = in.nextInt(); If (i > 25) { I++; } Else { I--; } System.out.print(i);
Free
Multiple Choice

A

Tags
Choose question tag  Assuming that the user provides 303 as input, what is the output of the following code snippet? Int x; Int y; Scanner in = new Scanner(System.in); System.out.print("Please enter a number: "); Y = in.nextInt(); If (y > 300) { X = y; } Else { X = 0; } System.out.println("x: " + x);
Free
Multiple Choice

C

Tags
Choose question tag  The following code snippet contains an error. What is the error? If (cost > 100); { Cost = cost - 10; } System.out.println("Discount cost: " + cost);
Multiple Choice
Tags
Choose question tag  Assuming that a user enters 25 as the value for x, what is the output of the following code snippet? Int x; Scanner in = new Scanner(System.in); System.out.print("Enter a number: "); X = in.nextInt(); If (x < 100) { X = x + 5; } If (x < 500) { X = x - 2; } If (x > 10) { X++; } Else { X--; } System.out.println(x);
Multiple Choice
Tags
Choose question tag  What kind of operator is the <= operator?
Multiple Choice
Tags
Choose question tag  The operator !> stands for
Multiple Choice
Tags
Choose question tag  Which of the following statements is true about the if statement?
Multiple Choice
Tags
Choose question tag  Which of the following statements is (are) true about an if statement? I. It guarantees that several statements are always executed in a specified order. II. It repeats a set of statements as long as the condition is true. III. It allows the program to carry out different actions depending on the value of a condition.
Multiple Choice
Tags
Choose question tag  Suppose one needs an if statement to check whether an integer variable pitch is equal to 440 (which is the frequency of the note "A" to which strings and orchestras tune). Which condition is correct?
Multiple Choice
Tags
Choose question tag  Assuming that the user provides 99 as input, what is the output of the following code snippet? Int a; Int b; Scanner in = new Scanner(System.in); System.out.print("Please enter a number: "); B = in.nextInt(); If (b > 300) { A = b; } Else { A = 0; } System.out.println("a: " +A);
Multiple Choice
Tags
Choose question tag  Which of the following statements is correct about an if statement?
Multiple Choice
Tags
Choose question tag  What can be done to improve the following code fragment? If ((counter % 10) == 0) { System.out.println("Counter is divisible by ten: " + counter); Counter++; } Else { System.out.println("Counter is not divisible by ten: " + counter); Counter++; }
Multiple Choice
Tags
Choose question tag  A store provides 10 percent discount on all items with a price of at least \$100. No discount is otherwise applicable. Which of the following DOES NOT correctly compute the discount?
Multiple Choice
Tags
Choose question tag  Which of the following operators is used as a relational operator?
Multiple Choice
Tags
Choose question tag  What are the two parts of an if statement?
Multiple Choice
Tags
Choose question tag  Which of the following is the correct syntax for an if statement?
Multiple Choice
Tags
Choose question tag  Which statement about an if statement is true?
Multiple Choice
Tags
Choose question tag  Assuming that a user enters 15 as input, what is the output of the following code snippet? Scanner in = new Scanner(System.in); System.out.print("Please enter a number: "); Int number = in.nextInt(); If (number > 20) { System.out.println("The number is LARGE!"); } Else { System.out.println("The number is SMALL!"); }
Multiple Choice   