programming languages Online Quiz - 134
Description: programming languages Online Quiz - 134 | |
Number of Questions: 20 | |
Created by: Aliensbrain Bot | |
Tags: programming languages |
Expressions are evaluated from right to left by default.
When assigning a value to a reference variable, type doesn't matter.
Which are most typically thrown by an API developer or an application developer as opposed to being thrown by the JVM.
class Hello{} class Hai extends Hello{} class Me{ static int x=7; static String s=null; public static void getWeight(Hello m){ int y=0/x; System.out.print(s+""); } public static void main(String [] args){ Hello [] ha={new Hello(),new Hai()}; for(Object o:ha) getWeight((Hello)o); } } When i run as--- java Me.java
class Emu { static String s = "-"; public static void main(String[] args) { try { throw new Exception(); } catch (Exception e) { try { try { throw new Exception(); } catch (Exception ex) { s += "ic "; } throw new Exception(); } catch (Exception x) { s += "mc "; } finally { s += "mf "; } } finally { s += "of "; } System.out.println(s); } }
What is the result? class Circus { public static void main(String[] args) { int x = 9; int y = 6; for(int z = 0; z < 6; z++, y--) { if(x > 2) x--; label: if(x > 5) { System.out.print(x + " "); --x; continue label; } x--; } } }
class Eggs { int doX(Long x, Long y) { return 1; } int doX(long... x) { return 2; } int doX(Integer x, Integer y) { return 3; } int doX(Number n, Number m) { return 4; } public static void main(String[] args) { new Eggs().go(); } void go() { short s = 7; System.out.print(doX(s,s) + " "); System.out.println(doX(7,7)); } } What is the result?
class MyThread extends Thread { MyThread() { System.out.print(" MyThread"); } public void run() { System.out.print(" bar"); } public void run(String s) { System.out.print(" baz"); } } public class TestThreads { public static void main (String [] args) { Thread t = new MyThread() { public void run() { System.out.print(" foo"); } }; t.start(); } } What is the result?
public static synchronized void main(String[] args) throws InterruptedException { Thread t = new Thread(); t.start(); System.out.print("X"); t.wait(10000); System.out.print("Y"); } What is the result of this code?
Which are methods of the Object class? (Choose all that apply.)
Which method names follow the JavaBeans standard? (Choose all that apply.)
public abstract class AbstractTest { public int getNum() { return 45; } public abstract class Bar { public int getNum() { return 38; } } public static void main(String[] args) { AbstractTest t = new AbstractTest() { public int getNum() { return 22; } }; AbstractTest.Bar f = t.new Bar() { public int getNum() { return 57; } }; System.out.println(f.getNum() + " " + t.getNum()); } } What is the result?
import static java.lang.System.*; class _ { static public void main(String... _A_V) { String $ = ""; for(int x=0; ++x < _A_V.length; ) $ += _A_V[x]; out.println($); } } And the command line: java _ - A .
- class X { void do1() { } } 2. class Y extends X { void do2() { } } 3. 4. class Chrome { 5. public static void main(String [] args) { 6. X x1 = new X(); 7. X x2 = new Y(); 8. Y y1 = new Y(); 9. // insert code here 10. } 11. } Which, inserted at line 9, will compile? (Choose all that apply.)
- class Dog { } 2. class Beagle extends Dog { } 3. 4. class Kennel { 5. public static void main(String [] arfs) { 6. Beagle b1 = new Beagle(); 7. Dog dog1 = new Dog(); 8. Dog dog2 = b1; 9. // insert code here 10. } 11. } Which, inserted at line 9, will compile? (Choose all that apply.)
class Scoop { static int thrower() throws Exception { return 42; } public static void main(String [] args) { try { int x = thrower(); } catch (Exception e) { x++; } finally { System.out.println("x = " + ++x); } } } What is the result?
class Fizz { int x = 5; public static void main(String[] args) { final Fizz f1 = new Fizz(); Fizz f2 = new Fizz(); Fizz f3 = FizzSwitch(f1,f2); System.out.println((f1 == f3) + " " + (f1.x == f3.x)); } static Fizz FizzSwitch(Fizz x, Fizz y) { final Fizz z = x; z.x = 6; return z; } } What is the result?
What will be the output of the following program?
What is the output of the program?
Which of these statements are true?