Database System Concepts
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
Bartleby Related Questions Icon

Related questions

bartleby

Concept explainers

Question

Answer 10 to 12

11. What is y after the following statement is executed?
x = -1;
y = (x < 0) ? -2 : 3;
а.
-3
b.
-2
с.
3
d.
e. Illegal expression
12. What is the output of the following code?
boolean even = false;
System.out.println((even ? "true" : "false"));
a. true
b. false
c. nothing
d. true false
13. What is Math.floor(3.6)?
а.
3.0
b.
3
с.
4
d.
5.0
14. Which of the following assignment statements is correct?
char c = 'dn';
char c = 100;
char c = 'm';
a.
b.
с.
d.
char c = "100";
15. Which of the following are valid identifiers?
a.
$failure
b.
public
с.
988ht
d.
8=9
е.
radius
expand button
Transcribed Image Text:11. What is y after the following statement is executed? x = -1; y = (x < 0) ? -2 : 3; а. -3 b. -2 с. 3 d. e. Illegal expression 12. What is the output of the following code? boolean even = false; System.out.println((even ? "true" : "false")); a. true b. false c. nothing d. true false 13. What is Math.floor(3.6)? а. 3.0 b. 3 с. 4 d. 5.0 14. Which of the following assignment statements is correct? char c = 'dn'; char c = 100; char c = 'm'; a. b. с. d. char c = "100"; 15. Which of the following are valid identifiers? a. $failure b. public с. 988ht d. 8=9 е. radius
7. To obtain the are sine of 0.5 degree, use
Math.asin(0.5)
Math.asin(Math.toDegrees(0.5))
Math.asin(Math.toRadians(0.5))
Math.sin(0.5)
a.
b.
с.
d.
8. What is the value of the following expression?
true || true && false
true
false
а.
b.
9. What is y displayed in the following code?
public class Testl {
public static void main(String[] args) {
int x = 1;
int y = x = x + 1;
System.out.println("y is " + y);
}
}
a. y is 0.
b. y is 1 because x is assigned to y first.
c. y is 2 because x + 1 is assigned to x and then x is assigned to y.
d. The program has a compile error since x is redeclared in the statement int y = x = x +1
10. Analyze the following program fragment:
int x;
double d = 1.5;
switch (d) {
case 1.0: x = 1;
case 1.5: x = 2;
case 2.0: x = 3;
Which of these is correct about the above code?
The program has a compile error because the required break statement is missing
in the switch statement.
The program has a compile error because the required default case is missing in
the switch statement.
a.
b.
с.
The switch control variable cannot be double.
d.
No errors.
expand button
Transcribed Image Text:7. To obtain the are sine of 0.5 degree, use Math.asin(0.5) Math.asin(Math.toDegrees(0.5)) Math.asin(Math.toRadians(0.5)) Math.sin(0.5) a. b. с. d. 8. What is the value of the following expression? true || true && false true false а. b. 9. What is y displayed in the following code? public class Testl { public static void main(String[] args) { int x = 1; int y = x = x + 1; System.out.println("y is " + y); } } a. y is 0. b. y is 1 because x is assigned to y first. c. y is 2 because x + 1 is assigned to x and then x is assigned to y. d. The program has a compile error since x is redeclared in the statement int y = x = x +1 10. Analyze the following program fragment: int x; double d = 1.5; switch (d) { case 1.0: x = 1; case 1.5: x = 2; case 2.0: x = 3; Which of these is correct about the above code? The program has a compile error because the required break statement is missing in the switch statement. The program has a compile error because the required default case is missing in the switch statement. a. b. с. The switch control variable cannot be double. d. No errors.
Expert Solution
Check Mark
Step 1

let us see the answer:-

 

Knowledge Booster
Background pattern image
Computer Science
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Recommended textbooks for you
Text book image
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education