Tag: programming languages

Questions Related to programming languages

What is the result of compiling and running the following code ? 1. StringBuffer s1=new StringBuffer("hello"); 2. StringBuffer s2=new StringBuffer("hello"); 3. Float f1=9.0F; 4. Double f2=9.0; 5. System.out.print(f1.equals(f2)); 6. System.out.print(s1==s2); 7. System.out.print(s1.equals(s2));

  1. Prints "truetruetrue"

  2. Prints "falsefalsetrue"

  3. Prints "falsefalsefalse"

  4. Compiler error on line 5

  5. Compiler error on line 7

  6. None


Correct Option: B

What is the result of compiling and running the following code? String s=new String("hello"); StringBuffer sb=new StringBuffer("hello"); System.out.println(s.equals(sb));

  1. Compiler error: String and StringBuffer objects cannot be compared

  2. ClassCastException: String and StringBuffer objects cannot be compared

  3. Prints "true"

  4. Prints "false"


Correct Option: D
  1. String[] s =f.list();

  2. File[] files=f.list();

  3. File[] files=f.listFiles();

  4. List files=f.listFiles();


Correct Option: A,C
  1. Its return type is String

  2. It reads the password from the console

  3. It has echoing disabled

  4. It takes a single argument

  5. None of them


Correct Option: B,C
  1. Internet Explorer 5.0

  2. Netscape 7.1

  3. Firefox 1.0

  4. All of Above


Correct Option: D
  1. strtod()

  2. srttoi()

  3. atoi()

  4. None of these


Correct Option: C