• ( 2 ) Which of these occupy first 0 to 127 in Unicode character set used for characters in Java?

    • 1) ASCII
    • 2) ISO-LATIN-1
    • 3) Both 1 & 2
    • 4) None of these
    • Discussion in forum
      Answer : 3) Both 1 & 2
      Solution : First 0 to 127 character set in Unicode are same as those of ISO-LAIN-1 and ASCII.








      discussion


      Answer : 3) Both 1 & 2

    • ( 3 ) What is the output of the following program?
      class A{
      public static void main(String args[]){
      byte b;
      int i = 258;
      double d = 325.59;
      b = (byte) i;
      System.out.print(b);
      i = (int) d;
      System.out.print(i);
      b = (byte) d;
      System.out.print(b);
      }
      }

    • 1) 258 325 325
    • 2) 258 326 326
    • 3) 2 325 69
    • 4) Error
    • Discussion in forum
      Answer : 3) 2 325 69
      Solution :








      discussion


      Answer : 3) 2 325 69

    • ( 4 ) Which of the following line will not compile assuming b1, b2 and b3 are byte variables and J is Int variable?

    • 1) b1 = 3;
    • 2) b3 = b1 * b2;
    • 3) b3 = 10 * b1;
    • 4) b2 = (byte) j;
    • Discussion in forum
      Answer : 3) b3 = 10 * b1;
      Solution : 10 is an integer variable and b1 is a byte variable. The multiplication of these two results an integer variable which cannot be stored in b3








      discussion


      Answer : 3) b3 = 10 * b1;

    • ( 5 ) Determine output:
      public class Test{
      int a = 10;
      public void method(int a){
      a += 1;
      System.out.println(++a);
      }
      public static void main(String args[]){
      Test t = new Test();
      t.method(3);
      }
      }

    • 1) 4
    • 2) 5
    • 3) 12
    • 4) 11
    • Discussion in forum
      Answer : 2) 5
      Solution :








      discussion


      Answer : 2) 5

    • ( 6 ) Which of these can not be used for a variable name in Java?

    • 1) identifier
    • 2) keyword
    • 3) identifier & keyword
    • 4) None of these
    • Discussion in forum
      Answer : 2) keyword
      Solution : Keywords are specially reserved words which can not be used for naming a user defined variable, example : class, int, for etc.








      discussion


      Answer : 2) keyword

    • ( 7 ) Which of these literals can be contained in a data type float variable?

    • 1) 1.7e-308
    • 2) 3.4e-038
    • 3) 1.7e+308
    • 4) 3.4e-050
    • Discussion in forum
      Answer : 2) 3.4e-038
      Solution : Range of data type float is 3.4e-038 to 3.4e+308








      discussion


      Answer : 2) 3.4e-038

    • ( 8 ) class Datatype {
      public static void main(String[] args) {
      byte number=0101;
      System.out.print(number);
      }
      }
      What will be the output when you compile and run the above code?

    • 1) 101
    • 2) 65
    • 3) 5
    • 4) Compiler error
    • Discussion in forum
      Answer : 2) 65
      Solution :








      discussion


      Answer : 2) 65

    • ( 9 ) Default value of character data type in Java Programming is ___________________.

    • 1) undefine
    • 2) null
    • 3) 0
    • 4) '\u0000'
    • Discussion in forum
      Answer : 4) '\u0000'
      Solution :








      discussion


      Answer : 4) '\u0000'

    • ( 10 ) Automatic type conversion in Java takes place when

    • 1) Two type are compatible and size of destination type is shorter than source type
    • 2) Two type are compatible and size of destination type is equal of source type
    • 3) Two type are compatible and size of destination type is larger than source type.
    • 4) All of the above
    • Discussion in forum
      Answer : 3) Two type are compatible and size of destination type is larger than source type.
      Solution :








      discussion


      Answer : 3) Two type are compatible and size of destination type is larger than source type.





Top