Exam (elaborations) CMIS 141/CMIS 141 (CMIS 141) University of Maryland. CMIS 141 Quiz 2, version 1. Questions With Answers. 100% Answered
University of Maryland. CMIS 141 Quiz 2, version 1. Questions With Answers. 100% Answered.1. Using the Google style guide document, select the proper declaration of a Java constant. a. int CONSTANT SPEED = 3.0; b. double final SPEED = 3.0; c. float FINAL speed = 3.0; d. Final SPEED = 3.0; e. None of the above 2. What is the output of the following Java code: ______________________. public class Quizzes { public static void main(String args[]){ int momAge = 62; int dadAge = 64; Sln(M(momAge, dadAge) + M(momAge, dadAge)); } } 126 3. What method would you use in the Scanner class to read an int from standard input in Java? a. nextBoolean(); b. nextFloat(); c. nextByte(); d. nextInt(); e. None of the above 4. What is the value of balance after the following code is executed? int balance = 10; while (balance = 1) { if (balance 9) { break; } balance = balance - 9; } a. –1 b. 0 c. 1 d. 2 e. None of the above 5. How would you construct an instance of scanner class that will read from the standard input (keyboard) in Java? a. Scanner scannerIn = new ScannerIn(); b. Scanner myOut = new Scanner(); c. Scanner myOut = new Scanner(Standard.Input); d. Scanner myOut = new Scanner(S); e. None of the above 6. What is the output of the following Java code: ____________________. public class Quizzes { public static void main(String args[]){ double examAvg = 85.9983; Sln(M(examAvg)); } } 86.0 7. Analyze the following code: public class Test { public static void main (String args[]) { int i = 0; for (i = 0; i 10; i++); Sln(i + 4); } } a. The program has a compile error because of the semicolon (;) on the for loop line. b. The program compiles despite the semicolon (;) on the for loop line, and displays 4. c. The program compiles despite the semicolon (;) on the for loop line, and displays 14. d. The program has a runtime error because of the semicolon (;) on the for loop line. 8. In the following Java code, what is the largest possible value that could be printed while executing the following code? // Import import .Random; public class Quizzes { public static void main(String args[]){ // create random object Random randomNo = new Random(); for (int i=0; i10000; i++) { Sln(randomNInt(100)); } } } 99 9. Which of the following values would read using the Scanner nextShort() without producing an error? a. 32768 b. -32768 c. - d. e. None of the above 10. What Java data type is returned while calling the nextGaussian() method in the .Random class? double
Geschreven voor
- Instelling
- Loyola University Of Maryland
- Vak
- CMIS 141/CMIS 141 (CMIS141)
Documentinformatie
- Geüpload op
- 29 juli 2021
- Aantal pagina's
- 36
- Geschreven in
- 2020/2021
- Type
- Tentamen (uitwerkingen)
- Bevat
- Vragen en antwoorden
Onderwerpen
-
cmis 141
-
cmis 141 quiz 2
-
quiz 2
-
version 1
-
version 1
-
version 1
-
using the google style guide document
-
select the proper declaration of a java constant