0

programming languages Online Quiz - 223

Description: programming languages Online Quiz - 223
Number of Questions: 20
Created by:
Tags: programming languages
Attempted 0/20 Correct 0 Score 0
  1. significant digits

  2. length

  3. numerator

  4. denominator


Correct Option: A
  1. An entity that receives inputs and outputs

  2. A way of storing values

  3. A sequence of characters enclosed by quotes

  4. A kind of computer


Correct Option: A

class C1 { static interface I { static class C2 { } } public static void main(String a[]) { C1.I.C2 ob1=new C1.I.C2(); System.out.println("object created"); } } What is the result of attempting to compile and run the program?

  1. prints object created

  2. Compile time error

  3. Runtime Excepion

  4. None of the above


Correct Option: A

class C1 { static class C2 { static int i1; } public static void main(String a[]) { System.out.println(C1.C2.i1); } } What is the result of attempting to compile and run the program?

  1. prints 0

  2. Compile time error

  3. Runtime exception

  4. None of the above


Correct Option: A

Which declare a compilable abstract class? (Choose all that apply.)

  1. A. public abstract class Canine { public Bark speak(); }

  2. B. public abstract class Canine { public Bark speak() { } }

  3. C. public class Canine { public abstract Bark speak(); }

  4. D. public class Canine abstract { public abstract Bark speak(); }


Correct Option: B

Which are legal declarations?

  1. short x [];

  2. short [] y;

  3. short [5] x2;

  4. short z2 [5];

  5. short [] z [] [];

  6. short [] y2 = [5];


Correct Option: A,B,E

Which is true? (Choose all that apply. )

  1. A. "X extends Y" is correct if and only if X is a class and Y is an interface

  2. B. "X extends Y" is correct if and only if X is an interface and Y is a class

  3. C. "X extends Y" is correct if X and Y are either both classes or both interfaces

  4. D. "X extends Y" is correct for all combinations of X and Y being classes and/or interfaces


Correct Option: C

Given: 1. class Voop { 2. public static void main(String [] args) { 3. doStuff(1); 4. doStuff(1, 2); 5. } 6. // insert code here 7. } Which, inserted independently at line 6, will compile? (Choose all that apply.)

  1. static void doStuff(int... doArgs) { }

  2. static void doStuff (int [] doArgs) { }

  3. static void doStuff(int doArgs...) { }

  4. static void doStuff(int... doArgs, int y) { }

  5. static void doStuff(int x, int... doArgs) { }


Correct Option: A,E

Given the following, 1. interface Base { 2. boolean m1 (); 3. byte m2(short s); 4. } Which code fragments will compile? (Choose all that apply.)

  1. interface Base2 implements Base { }

  2. abstract class Class2 extends Base { public boolean ml() { return true; } }

  3. abstract class Class2 implements Base { }

  4. abstract class Class2. implements Base { public boolean m1() { return (true); } }

  5. class Class2 implements Base { boolean m1( ) { return false; } byte m2(short s) { return 42; } }


Correct Option: C,D

Which declare a compilable abstract class? (Choose all that apply.)

  1. public abstract class Canine { public Bark speak(); }

  2. public abstract class Canine { public Bark speak() { } }

  3. public class Canine { public abstract Bark speak(); }

  4. public class Canine abstract { public abstract Bark speak(); }


Correct Option: B
  1. "X extends Y" is correct if and only if X is a class and Y is an interface.

  2. "X extends Y" is correct if and only if X is an interface and Y is a class.

  3. "X extends Y" is correct if X and Y are either both classes or both interfaces.

  4. "X extends Y" is correct for all combinations of X and Y being classes and/or interfaces.


Correct Option: C

Given: 1. class Voop { 2. public static void main(String [] args) { 3. doStuff(1); 4. doStuff(1, 2); 5. } 6. // insert code here 7. } Which, inserted independently at line 6, will compile? (Choose all that apply.)

  1. static void doStuff(int... doArgs) { }

  2. static void doStuff (int [] doArgs) { }

  3. static void doStuff(int doArgs...) { }

  4. static void doStuff(int... doArgs, int y) { }

  5. static void doStuff(int x, int... doArgs) { }


Correct Option: A,E

Which are legal declarations? (Choose all that apply. )

  1. short x [];

  2. short [] y;

  3. short [5] x2;

  4. short z2 [5];

  5. short [] z [] [];

  6. short [] y2 = [5];


Correct Option: A,B,E

Can there be multiple tag in tiles-defs.xml?

  1. No

  2. Yes

  3. always present

  4. None of the above


Correct Option: A
- Hide questions