Question 11 1 Point Would Construct Instance Scanner Class Read Standard Input Keyboard Ja Q13536837

Question 11 (1 point)

Question 11 Unsaved

How would you construct an instance ofscanner class that will read from the standard input (keyboard) inJava?

Question 11 options:

Scanner scannerIn = new ScannerIn();

Scanner myOut = new Scanner();

Scanner myOut = new Scanner(Standard.Input);

Scanner myOut = new Scanner(Standard.io);

None of the above

Question 12 (1 point)

Question 12 Unsaved

How many times does the following loop iterate?

public class Quizzes {
public static void main(String args[]){
   int cnt = 1;
   int maxLoop =30;        
   while (cnt < maxLoop) {         
        if (cnt==3) {
          break;
           }            
           cnt++;  
        }
   }
}

Question 13 (1 point)

Question 13 Unsaved

Analyze the following code.

    int x = 1;
    while (0 < x) && (x < 100)
      System.out.println(x++);

Question 13 options:

The code does not compile because the loop body is not in thebraces.

The number 1 to 99 are displayed.

The number 2 to 100 are displayed.

The code does not compile because (0 < x) & (x < 100)is not enclosed in a pair of parentheses.

The loop runs for ever.

Question 14 (1 point)

Question 14 Unsaved

How many times will the following code print “Welcome toJava”?

int count = 0;
do {
   System.out.println(“Welcome to Java”);
   count++;
} while (count < 10);

Question 14 options:

11

0

9

10

8

Question 15 (1 point)

Question 15 Unsaved

What is the output of the following Java code?____________________

public class Quizzes {
public static void main(Stringargs[]){          
   String string1 = “243”;  
   String string2 = “true”;
   String string3 = “24.1”   ;
   boolean results = (Boolean.parseBoolean(string2)&& false);
   System.out.println(results);
   }
}

Question 16 (1 point)

Question 16 Unsaved

What is the value of y after executing this Java code?

int y = 0;
for (int i = 0; i<10; ++i) {
   y += i;
}
System.out.println(y);

Question 16 options:

44

11

13

12

none of the above

Question 17 (1 point)

Question 17 Unsaved

According to the Google style guide,Java variable and class names should be named usingUpperCamelCase.

Question 17 options:

True

False

Question 18 (1 point)

Question 18 Unsaved

Which of the following values wouldread using the Scanner nextShort() withoutproducing an error?

Question 18 options:

32768

-32768

-100000

100000

None of the above

Question 19 (1 point)

Question 19 Unsaved

What is the output of the following Java code:______________________.

public class Quizzes {
public static void main(Stringargs[]){    
      double angle = 90;
      angle = Math.toRadians(angle);
      System.out.println(Math.sin(angle) +Math.pow(Math.cos(angle),2));    
   }
}

Question 20 (1 point)

Question 20 Unsaved

How many times with the string hi be printed after executing thefollowing code?

public class Quizzes {
public static void main(String args[]){
       int colCnt = 0;
       int rowCnt = 0;
   do {     
       colCnt = 0;     
      do {
         System.out.print(“hi” +”t”);          
            colCnt++;
       } while (colCnt <8);         
        System.out.print(“n”);
           rowCnt++;
        } while (rowCnt <7);
   }
}

0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

Your email address will not be published. Required fields are marked *