0

programming languages Online Quiz - 253

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

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

Which of the following compiles correctly if "f" is an instance of the File class?

  1. String[] s =f.list();

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

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

  4. List files=f.listFiles();


Correct Option: A,C

What will happen when you attempt to compile and run the given code? 1. public class EqualsTest 2.{ 3. public static void main(String[] args) 4.{ 5. Boolean b = new Boolean(true); 6. String str = new String(""+b); 7. StringBuffer buff = new StringBuffer(str); 8. 9. System.out.println(b.equals(str) + ", " + 10. str.equals(buff) + ", " + 11. buff.equals(b)); 12. } 13. }

  1. It will print - false, true, false

  2. It will print - true, true, false

  3. It will print - false, false, false

  4. It will print - true, false, false

  5. Compilation error

  6. ClassCastException at runtime


Correct Option: D

Which of the following are true about the readPassword() method of the Console class? choose two

  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

What is the result of compiling and running the following program? import java.util.Arrays; class Split2 { public static void main(String[] args) { String str = "She sells sea shells"; System.out.println(Arrays.toString(str.split("\s"))); } }

  1. Compiler error

  2. An exception is thrown at runtime

  3. Prints [She, sells, sea, shells]

  4. Prints [he, ells, ea, hells]

  5. Prints []


Correct Option: C

The .NET framework which provides automatic memory management using a technique called

  1. Overriding

  2. Garbage Collection

  3. Assemblies

  4. Serialization


Correct Option: B

Which browsers are supported by AJAX ?

  1. Internet Explorer 5.0

  2. Netscape 7.1

  3. Firefox 1.0

  4. All of Above


Correct Option: D

How to convert a string to integer?

  1. strtod()

  2. srttoi()

  3. atoi()

  4. None of these


Correct Option: C

What’s the .NET collection class that allows an element to be accessed using a unique key?

  1. ArrayList

  2. NameValue Collection

  3. StringCollection

  4. HashTable


Correct Option: D

Which method do you use to expllicitly to kill a user session?

  1. session.clear()

  2. session.dispose()

  3. Session.Abandon

  4. None


Correct Option: C

What’ is the sequence in which ASP.NET events are processed ?

  1. 1)Page_Init 2)Page_Load.3)Control events 4)Page_Unload event.

  2. 1)Page_Init 2)Page_Unload event..3)Control events 4)Page_Load

  3. 1)Page_Load 2)Page_Init 3)Control events 4)Page_Unload event.

  4. None


Correct Option: A

In ASP.NET the < authorization > section contain which of the following elements

  1. < allow >

  2. < deny>

  3. Both 1 and 2

  4. None


Correct Option: C

Constructors have no return type, not even void.

  1. True

  2. False


Correct Option: A

constructors can be abstract, final, native, static, or synchronized.

  1. True

  2. False


Correct Option: B

constructors can have any of the access modifiers: public, protected, private.

  1. True

  2. False


Correct Option: A

Constructors name is not same as their class name

  1. True

  2. False


Correct Option: B

Constructors use "this"(keyword) to refer to another constructor in the same class with a different parameter list

  1. True

  2. False


Correct Option: A

If a constructor uses this, it must not be in the constructor's first line

  1. True

  2. False


Correct Option: B

Interfaces have constructors

  1. True

  2. False


Correct Option: A

Every class in java has constructors including abstract classes

  1. True

  2. False


Correct Option: A
- Hide questions