0
Alien head

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

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

  1. No

  2. Yes

  3. always present

  4. None of the above


Correct Option: A

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

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 is true? (Choose all that apply. )

  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

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

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

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 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

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 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

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

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

A signed data type has an equal number of non-zero positive and negative values available.TRUE/FALSE ?

  1. True

  2. False


Correct Option: A

A function is:

  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

The method setLabel can be used with what type of Object?

  1. DoubleField

  2. int

  3. TextField

  4. String


Correct Option: A

Given the following statement:huey.setDouble(8.0*32.2+1.0);What must be the data type of huey?

  1. DoubleField

  2. TextField

  3. IntField

  4. double


Correct Option: A

Given the following code fragment:int A[];int i = 0;A = new int A[4];while (i < 4){A[i] = 10;i = i + 1;}

  1. 0

  2. 3

  3. 10

  4. UNKNOWN


Correct Option: C

What is the value of k after the following code fragment? int k = 0; int n = 12 while (k < n) { k = k + 1; }

  1. O

  2. 11

  3. 12

  4. -3


Correct Option: C

After the following code fragment, what is the value in a?String s;int a;s = "Foolish boy.";a = s.indexOf("fool");

  1. -1

  2. 0

  3. 4

  4. 8


Correct Option: A

What are the two parts of a value of type double?

  1. significant digits

  2. length

  3. numerator

  4. denominator


Correct Option: A
+ View questions