Tag: programming languages

Questions Related to programming languages

  1. abstract

  2. assert

  3. synchronized

  4. strictfp


Correct Option: B

Assume the bit pattern of byte x is: 10110001. What will the sign of x be after x>>2?

  1. postive

  2. negative

  3. can't be find

  4. none of the above


Correct Option: B
  1. compiler error

  2. smaller type is promoted

  3. must explicitly cast

  4. none of the above


Correct Option: B
  1. java.lang.Exception

  2. java.lang.Error

  3. java.lang.Throwable

  4. none of the above


Correct Option: C

package polymorphism; class TestSup { static int p = 100; } public class TestPoly extends TestSup { public static void main(String[] args) { TestPoly TP = new TestPoly(); TP.p = 400; TestSup TS = new TestSup(); TS.p = 100; TestSup TSP = new TestPoly(); TSP.p = 500; System.out.print("TestSup = " + TestSup.p); System.out.print(" ,TestPoly = " + TestPoly.p); System.out.print(" ,TP = " + TP.p); System.out.print(" ,TS = " + TS.p); System.out.print(" ,TSP = " + TSP.p); } }

  1. TestSup = 100 ,TestPoly = 400 ,TP = 500 ,TS = 500 ,TSP = 500

  2. TestSup = 500 ,TestPoly = 500 ,TP = 500 ,TS = 500 ,TSP = 500

  3. TestSup = 100 ,TestPoly = 400 ,TP = 400 ,TS = 100 ,TSP = 500

  4. TestSup = 500 ,TestPoly = 400 ,TP = 500 ,TS = 100 ,TSP = 400


Correct Option: B