Tag: programming languages

Questions Related to programming languages

  1. Null Pointer Exception at client side

  2. Client will receive warning message

  3. ConnectException is thrown

  4. Compilation Error


Correct Option: C

The assigned port at the server can be obtained in the client side by

  1. getLocalPort() method

  2. getActivePort() method

  3. By pinging the server

  4. By giving value 0 as port number


Correct Option: A

Which one of the following is not marker interface?

  1. Serializable

  2. Remote

  3. Cloneable

  4. List


Correct Option: D

Which algorithm is used in thread scheduling?

  1. Fixed Priority

  2. Round Robin

  3. Discrete Optimization

  4. None of the above


Correct Option: A

Which modifier tells JVM to avoid object persistence during serialization?

  1. final

  2. transient

  3. public

  4. private


Correct Option: B

Main is the only thread that runs when a Java program is started?

  1. True

  2. False


Correct Option: B

Which of the following does not guarantee the order of data storage will be constant over a period of time?

  1. HashMap

  2. ArrayList

  3. Stack

  4. Queue


Correct Option: A

What is the result of compiling and running the following program? import java.util.Formatter; class Format2 { public static void main(String[] args) { String s="hello123"; Formatter f=new Formatter(); f.format("%S",s); System.out.println(f); } }

  1. Prints "hello123"

  2. Prints "HELLO123"

  3. Compiler error

  4. IllegalFormatException


Correct Option: B