Question
1. Given the following code, the output is __. int x = 7; System.out.print(x/4); A. x/4 B. 1 C. 7/4 D. 1.75 E. Compiler Error.
1. Given the following code, the output is __. int x = 7; System.out.print(x/4); A. x/4 B. 1 C. 7/4 D. 1.75 E. Compiler Error. 2. Given the following code, the output is __. String s = "Hello"; s += " world! "; s += "It is "; s = "nice."; A. nice. B. It is nice. C. Hello world! It is nice. D. Hello world! E. Hello 3. Given the following code, the output is __. int x = 5; System.out.println(x++); A. 7 B. x++ C. 4 D. 6 E. 5 4. Given the following code, the output is __. String s1 = "apple"; String s2 = "apple"; System.out.println(s1 == s2); A. 0 B. false C. 1 D. true E. None of the options 5. Given the following code, the output is __. String s1 = new String("apple"); String s2 = new String("apple"); System.out.println(s1 == s2); A. 0 B. false C. 1 D. true E. None of the options
6. Given the following code, the output is __. String s = "Orange"; int x = 5; double y = 15.7; System.out.println(s + x + y); A. Orange515.7 B. Orange20.7 C. Orange 515.7 D. Orange 20.7 E. Orange 5 15.7 7. Given the following code, the output is __. System.out.println(23 ^ 15); A. 7 B. 31 C. 16 D. 23 E. 24 8. Which produce the word, false, as output? A. System.out.println( (4 > 3) ^ (4 > 5) ); B. System.out.println( (4 > 3) && (4 < 5) ); C. System.out.println( (4 < 3) || (4 > 5) ); D. System.out.println( (4 > 3) ^ (4 > 5) ); E. System.out.println( (4 > 3) || (4 < 5) ); 9. Given the following code, the output is __. int x = 5; x *= 2; x *= 3; x *= 4; System.out.println(x); A. 10 B. 15 C. 20 D. 24 E. 120 10. Given the following code, the output is __. char x = (3 < 4) ? 'A' : 'B'; System.out.print(x); A. 0 B. (3<4) C. A D. B E. false
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started