Question: If you enter 1 2 3, when you run this program, what will be the output? import java.util.Scanner; public class Test1 { public static void

  1. If you enter 1 2 3, when you run this program, what will be the output?

import java.util.Scanner;

public class Test1 {

public static void main(String[] args) {

Scanner keyboard = new Scanner(System.in);

System.out.print(Enter three numbers: );

double number1 = keyboard.nextDouble();

double number2 = keyboard.nextDouble();

double number3 = keyboard.nextDouble();

// Compute average

double average = (number1 + number2 + number3) / 3;

// Display result

System.out.println(average);

}

}

  1. 1.0
  2. 3.0
  3. 4.0
  4. 2.0

  1. Assuming the variable score has been assigned the value 13, which of the following statements display XXX?
  1. if (score > 0) System.out.println (XXX) ;
  2. if (score > 17) ; System.out.println (XXX) ;
  3. if (score < 7) ; System.out.println (XXX) ;
  4. All of the above display XXX;

  1. What is the output of the following code segment?

t = 0;

if (t > 7)

System.out.println (AAA) ;

System.out.println( BBB );

  1. AAA
  2. BBB
  3. AAABBB
  4. Nothing

  1. Which of the following is a valid identifier?
  1. main
  2. *calculate
  3. $Salary
  4. hello-world

  1. To declare a constant PI inside a method with value of 3.14 you write
  1. final PI = 3.14;
  2. final float PI = 3.14;
  3. double PI = 3.14;
  4. final double PI = 3.14;

  1. A confirm dialog box that displays the options Yes, No and Cancel can be created in a Java program using the showConfirmDialog( ) method in the ________________.
  1. util.Scanner class
  2. keyboard.Scanner class
  3. JOptionPane class
  4. javax.swing class

  1. If m = 9, then after n = m++, the value of n is _________.
  1. 8
  2. 9
  3. 10
  4. 11

  1. What does the following program segment output?

d = 0;

do

{

System.out.print (d + );

d ++;

} while (d < 2);

  1. 0
  2. 01
  3. 012
  4. nothing

  1. After you write and save a Java application file, you ______________ it.
  1. interpret and then compile
  2. interpret and then execute
  3. compile and then resave
  4. compile and then interpret

  1. Which is the output of the following code?

b = 1;

while (b < 4)

System.out.print (b + ) ;

  1. 1
  2. 123
  3. 1234
  4. 11111

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!