0
Alien head

programming languages Online Quiz - 137

Description: programming languages Online Quiz - 137
Number of Questions: 20
Created by:
Tags: programming languages
Attempted 0/20 Correct 0 Score 0

Find the odd one?

  1. public

  2. private

  3. protected

  4. abstract


Correct Option: D

Choose the illegal identifier?

  1. int _a;

  2. int $b;

  3. int _123;

  4. int e#123;


Correct Option: D

JAVA ME applications can remain unsigned.

  1. True

  2. False


Correct Option: A

SSL connection can be established in JAVA ME based applications.

  1. True

  2. False


Correct Option: A

MIDP 2.0

  1. JSR 118

  2. JSR 30

  3. JSR 20

  4. JSR 21


Correct Option: A

What will be the output of following code? public class Main { public static void main(String[] args) { int values[] = {1,2,3,4,5,6,7,8}; for(int i=0;i<8; ++i) System.out.println(values[i++]); } }

  1. 1 3 5 7

  2. 2 4 6 8

  3. 2 3 4 5 6 7 8

  4. None of above


Correct Option: A

Select the key words, which can not be used to define an identifier.

  1. goto

  2. enum

  3. null

  4. extend


Correct Option: A,B,C

What will be output of following code? 1 double d = 10.10/0.0; 2 int i = 10/0;

  1. Compile time error

  2. Runtime error at line 1

  3. Runtime error at line 2

  4. Runtime error at line 1 & 2


Correct Option: C

What will be output of following code? 1 public class Main { 2 public static void main(String[] args) { 3 short a = 22; 4 execute(3); 5 System.out.println(a); 6 } 7 8 static void execute(short s){ 9 s = 33; 10 } 11 }

  1. Compile time error at line 3

  2. Compile time error at line 4

  3. 22

  4. None of above


Correct Option: B

What will be output of following code ? 1 public class Main { 2 public static void main(String[] args) { 3 byte b = (int)2.12; 4 b = b + 3; 5 System.out.println(b); 6 } 7 }

  1. Compile time error at line 3

  2. Compile time error at line 4

  3. 5

  4. None


Correct Option: B

What will be the output of following code? 1 public class Main { 2 public static void main(String[] args) { 3 float b = 2.12; 4 b = b + 3.10; 5 System.out.println(b); 6 } 7 }

  1. Compile time error at line 3

  2. Compile time error at line 4

  3. 5.22

  4. None of above


Correct Option: A

What will be the output following code with executed with command ? >java Main 2 public class Main { private static int a = 2; private static int b; public static void main(String[] args) { b = Integer.parseInt(args[0]); a = a + b; System.out.println("a=" + a); System.out.println("b=" + b); } static{ a = 0; } }

  1. a=4; b=2;

  2. a=2; b=4;

  3. a=0; b=2; *

  4. Run time error


Correct Option: C

What will be outcome of following code?

  1. first >> second >>

  2. first >>

  3. Compile time Error

  4. Runtime Error -- ConcurrentModificationException


Correct Option: B

What will be output of following code? package test; import java.lang.Math.PI; public class Main { public static void main(String[] args) { System.out.println(PI); } }

  1. 3.14

  2. Compile time error

  3. Run time error

  4. None of above


Correct Option: B

What will be outcome of following code? List list = new ArrayList(); list.add(0, new Integer(42)); int total = list.get(0); System.out.println(total);

  1. 42

  2. Compilation Error - Incompatible Type

  3. Runtime Error - Java.lang.ClassCastException

  4. None of above


Correct Option: A

How much memory is allocated for objects of a class?

  1. Depending upon data members only

  2. Depending upon constructors, destructors, data members, member functions only.

  3. Depending upon data members and non static member functions only.

  4. Depending upon data members and non static member functions, constructors and destructors only.

  5. None of these


Correct Option: C

try{ throw int;} catch (float) catch (double) catch (int) catch (long) catch (...)

  1. catch (float)

  2. catch (...)

  3. catch (int)

  4. catch (long)


Correct Option: C

Why virtual functions are used ?

  1. To access derived class objects using base class pointer.

  2. To access base class objects using derived class pointer.

  3. To avoid ambiguity in inheritance.

  4. To create array of objects.


Correct Option: A

Can the private data members of a class be modified or accessed outside the class, without using member functions.

  1. True

  2. False


Correct Option: A

class A

  1. 10,10,garbage,garbage

  2. error

  3. error because of ambiguty

  4. garbage,10,10,garbage


Correct Option: A
+ View questions